summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDuncan McGreggor <duncan@ubuntu.com>2011-03-14 19:07:26 -0600
committerDuncan McGreggor <duncan@ubuntu.com>2011-03-14 19:07:26 -0600
commitc123dfb42bd2ba2082af7cba8d040e13cb9704b3 (patch)
treece4c8ba0ac444e868411e54f69323afe982ec336 /python
parentc6d0a6be797866dd048b1e114f5d7aece529d520 (diff)
Removed references to device_name when creating a new device.
Diffstat (limited to 'python')
-rw-r--r--python/evemu/device.py10
-rw-r--r--python/evemu/testing.py2
-rw-r--r--python/evemu/tests/test_device.py2
-rw-r--r--python/evemu/tests/test_wrapper.py2
-rw-r--r--python/evemu/wrapper.py11
5 files changed, 12 insertions, 15 deletions
diff --git a/python/evemu/device.py b/python/evemu/device.py
index cfd247c..fe518cb 100644
--- a/python/evemu/device.py
+++ b/python/evemu/device.py
@@ -10,11 +10,14 @@ class EvEmuDevice(base.EvEmuBase):
"""
A wrapper class for the evemu device fucntions.
"""
- def __init__(self, device_name, library):
+ def __init__(self, library):
super(EvEmuDevice, self).__init__(library)
device_new = self._lib.evemu_new
device_new.restype = ctypes.c_void_p
- self._device = device_new(device_name)
+ # The C API expects a device name to be passed, however, it doesn't do
+ # anything with it, so we're not going to provide it as an option in
+ # the Python API.
+ self._device = device_new("")
self._node = ""
self._device_file_stream = None
self._uinput_fd = None
@@ -22,7 +25,8 @@ class EvEmuDevice(base.EvEmuBase):
def __del__(self):
self.get_lib().evemu_delete(self._device)
del(self._device_file_stream)
- os.close(self._uinput_fd)
+ if self._uinput_fd:
+ os.close(self._uinput_fd)
if self.get_node_name() and os.path.exists(self.get_node_name()):
os.unlink(self.get_node_name())
diff --git a/python/evemu/testing.py b/python/evemu/testing.py
index d853115..7a849e2 100644
--- a/python/evemu/testing.py
+++ b/python/evemu/testing.py
@@ -57,7 +57,7 @@ class BaseTestCase(unittest.TestCase):
self.library = library
#timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
#self.device_name = "evm tst dvc: %s" % timestamp
- self.device_name = "evemu-%d:%s" % (os.getpid(), self._testMethodName)
+ #self.device_name = "evemu-%d:%s" % (os.getpid(), self._testMethodName)
basedir = util.get_top_directory()
self.data_dir = os.path.join(basedir, "..", "..", "data")
diff --git a/python/evemu/tests/test_device.py b/python/evemu/tests/test_device.py
index 70f1458..21c183b 100644
--- a/python/evemu/tests/test_device.py
+++ b/python/evemu/tests/test_device.py
@@ -9,7 +9,7 @@ class EvEmuDeviceTestCase(BaseTestCase):
def setUp(self):
super(EvEmuDeviceTestCase, self).setUp()
- self.device = EvEmuDevice(self.device_name, self.library)
+ self.device = EvEmuDevice(self.library)
self.device.create_node(self.get_device_file())
def tearDown(self):
diff --git a/python/evemu/tests/test_wrapper.py b/python/evemu/tests/test_wrapper.py
index 3f7aed2..eb0c2aa 100644
--- a/python/evemu/tests/test_wrapper.py
+++ b/python/evemu/tests/test_wrapper.py
@@ -9,7 +9,7 @@ class EvEmuWrapperTestCase(BaseTestCase):
def setUp(self):
super(EvEmuWrapperTestCase, self).setUp()
- self.wrapper = EvEmuWrapper(self.device_name, self.library)
+ self.wrapper = EvEmuWrapper(self.library)
def test_initialize(self):
self.assertTrue(self.wrapper.device is not None)
diff --git a/python/evemu/wrapper.py b/python/evemu/wrapper.py
index fb70511..f0dbc47 100644
--- a/python/evemu/wrapper.py
+++ b/python/evemu/wrapper.py
@@ -10,21 +10,14 @@ from evemu.exception import ExecutionError
class EvEmuWrapper(base.EvEmuBase):
- def __init__(self, device_name, library=""):
+ def __init__(self, library=""):
"""
- @device_name: wanted input device name (or NULL to leave empty)
-
This method allocates a new evemu device structure and initializes
all fields to zero. If name is non-null and the length is sane, it is
copied to the device name.
-
- The device name will be used in the device data, similarly as is
- presented by the device data that is viewable when you do the
- following:
- $ cat /proc/bus/input/devices
"""
super(EvEmuWrapper, self).__init__(library)
- self.device = device.EvEmuDevice(device_name, library)
+ self.device = device.EvEmuDevice(library)
def _as_parameter_(self):
return self.get_device()