diff options
author | Duncan McGreggor <duncan@ubuntu.com> | 2011-03-14 19:54:14 -0600 |
---|---|---|
committer | Duncan McGreggor <duncan@ubuntu.com> | 2011-03-14 19:54:14 -0600 |
commit | 04430a441f216f3773e1a905ceef2249a1a0b46f (patch) | |
tree | 4a2b005997d374daa8cf28fa2a8780012bd3a03d /python | |
parent | 752ebaff4bc59f942ebddaaf9a1b6beb20d6b319 (diff) |
* Updated docstrings for delete/destory methods.
* Changed the create() method to check for for the device attribute first.
Diffstat (limited to 'python')
-rw-r--r-- | python/TODO | 1 | ||||
-rw-r--r-- | python/evemu/wrapper.py | 28 |
2 files changed, 25 insertions, 4 deletions
diff --git a/python/TODO b/python/TODO index 17453b5..7256d38 100644 --- a/python/TODO +++ b/python/TODO @@ -37,7 +37,6 @@ The script does this: TODO ==== - * rename device_fd to device_pointer * EvEmuWrapper creates a device in __init__ - the create() method should check to see if there's a device already created, and then abort if so... creating one only if it's necessary diff --git a/python/evemu/wrapper.py b/python/evemu/wrapper.py index d314b21..5faf2d7 100644 --- a/python/evemu/wrapper.py +++ b/python/evemu/wrapper.py @@ -47,16 +47,38 @@ class EvEmuWrapper(base.EvEmuBase): return os.read(output_fd, 1024) def create(self, device_file): - self.device.create_node(device_file) + if not self.device: + self.device.create_node(device_file) # XXX now destroy the device? #self._call(self.get_lib().evemu_destroy, input_fd) #return (virtual_input_device, virtual_input_fd) def delete(self): - pass + """ + Frees up the memory associated with the pointer (and deletes the + pointer). + + This is done when: + * uncessessfully attempting to create a new device data structure + * unsuccessfully attempting to read the device description file + * unsuccessfully attempting to open the UINPUT_NODE for writing + + Note that when uncsuccessfully calling evemu_create, just the close + operation is performed, nothing else. + """ + self.device = None def destroy(self): - pass + """ + Deletes the /dev/device/eventXX device that was created. + + This is done when: + * successfully setup up the eventXX device, after all the work is done + + Note that when uncsuccessfully calling evemu_create, just the close + operation is performed, nothing else. + """ + self.device = None def write_event(self): pass |