gnome-lirc-properties r67 - in trunk: . gnome_lirc_properties



Author: hadess
Date: Fri Oct 17 13:32:42 2008
New Revision: 67
URL: http://svn.gnome.org/viewvc/gnome-lirc-properties?rev=67&view=rev

Log:
2008-10-17  Bastien Nocera  <hadess hadess net>

	* gnome_lirc_properties/hardware.py: Detect input devices
	with the input.keys capabilities as well, Ignore "Video Bus"
	devices, fixes detection of the PS3 BD remote control, and other
	input device remote controls (Closes: #555802)



Modified:
   trunk/ChangeLog
   trunk/gnome_lirc_properties/hardware.py

Modified: trunk/gnome_lirc_properties/hardware.py
==============================================================================
--- trunk/gnome_lirc_properties/hardware.py	(original)
+++ trunk/gnome_lirc_properties/hardware.py	Fri Oct 17 13:32:42 2008
@@ -179,7 +179,7 @@
         '''
 
         # check if HAL considers this device a keyboard:
-        if self.has_capability('input.keyboard'):
+        if self.has_capability('input.keyboard') or self.has_capability('input.keys'):
             # read and parse key-code map from sysfs:
             keys = self.read_sysfs_file('..', 'capabilities', 'key')
 
@@ -187,6 +187,10 @@
                 keys = [int(value, 16) for value in keys.split()]
                 keys = decode_bitmap(keys)
 
+                # Ignore ACPI Video Bus devices (as defined in drivers/acpi/video.c)
+		if str(self['info.product']) == 'Video Bus':
+		    return True
+
 		# The Logitech Mini-Receivers, when in HID mode, only show
 		# a portion of the keys on this interface (with a separate keyboard
 		# and mouse still visible). We shouldn't try to configure that device
@@ -196,6 +200,9 @@
                 # check that at least 85 key-codes are supported:
                 if len(keys) >= 85:
                     return True
+	else:
+	     # It's not a keyboard, but we don't want it anyway
+	     return True
 
         return False
 
@@ -255,6 +262,8 @@
         self.__hal.connect_to_signal('DeviceAdded', self._on_device_added)
         self.__hal.connect_to_signal('DeviceRemoved', self._on_device_removed)
 
+	for udi in self.__hal.FindDeviceByCapability('input.keys'):
+            self._on_device_added(udi)
         for udi in self.__hal.FindDeviceByCapability('input.keyboard'):
             self._on_device_added(udi)
 
@@ -288,7 +297,7 @@
 
         device = self.lookup_device(udi)
 
-        if (device.has_capability('input.keyboard') and
+        if (device.has_capability('input') and
             not device.is_real_keyboard()):
 
             product_name = str(device['info.product'])
@@ -304,13 +313,13 @@
             receiver = lirc.Receiver(_('Linux Input Device'),
                                      product_name, **properties)
 
-            self.__devinput_receivers[udi] = receiver
+            self.__devinput_receivers[str(udi)] = receiver
             self.emit('receiver-added', receiver)
 
     def _on_device_removed(self, udi, sender=None):
         '''Handle removal of hot-plugable devices.'''
 
-        receiver = self.__devinput_receivers.pop(udi, None)
+        receiver = self.__devinput_receivers.pop(str(udi), None)
 
         if receiver is not None:
             self.emit('receiver-removed', receiver)
@@ -474,7 +483,7 @@
                 continue
 
             # report findings:
-            receiver = self.devinput_receivers[device.udi]
+            receiver = self.devinput_receivers[str(device.udi)]
             self._receiver_found(receiver, device.udi, device_node)
 
     def find_instance(self, receiver):
@@ -505,9 +514,9 @@
         claiming being thread-safe.
         '''
 
-        # retreive list of USB devices from HAL
+        # retrieve list of USB devices from HAL
         usb_devices = self.__hal.FindDeviceStringMatch('info.subsystem', 'usb_device')
-        input_devices = self.__hal.FindDeviceByCapability('input.keyboard')
+        input_devices = self.__hal.FindDeviceByCapability('input')
 
         self.__search_canceled = False
         self.__device_count = float(len(usb_devices) + len(input_devices))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]