[gnome-lirc-properties] Don't show an error when receiver doesn't need a node



commit 80b8f8e4cf0f8135c7fa02c5bdc51da166f73f08
Author: Bastien Nocera <hadess hadess net>
Date:   Tue May 18 15:55:32 2010 +0100

    Don't show an error when receiver doesn't need a node
    
    Some of the user-space LIRC device drivers don't need a device node,
    so don't show a warning when that happens.

 .../ui/RemoteControlProperties.py                  |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gnome_lirc_properties/ui/RemoteControlProperties.py b/gnome_lirc_properties/ui/RemoteControlProperties.py
index e064547..775c977 100644
--- a/gnome_lirc_properties/ui/RemoteControlProperties.py
+++ b/gnome_lirc_properties/ui/RemoteControlProperties.py
@@ -1075,6 +1075,14 @@ class RemoteControlProperties(object):
         '''Retrieve the currently selected device.'''
         return self.__entry_device.get_text().strip()
 
+    def __requires_device_node(self, driver):
+        '''Check whether the LIRC driver used requires a device node'''
+        # You can check this by hand by opening the daemons/hw_*.c drivers
+        # in lirc, and checking for ".device" being used from the
+        # struct hardware
+        no_device_node = ('atilibusb', 'awlibusb', 'caraca', 'commandir', 'dfclibusb')
+        return driver not in no_device_node
+
     def __set_selected_device(self, device_node):
         '''Change the currently selected device.'''
 
@@ -1100,9 +1108,9 @@ class RemoteControlProperties(object):
 
             tree_iter = tree_model.iter_next(tree_iter)
 
-        # device node not found in combo box, fallback to modify its entry:
+        # device node required but not found in combo box, fallback to modify its entry:
         markup = (
-            receiver and not device_node and
+            receiver and not device_node and self.__requires_device_node(receiver.lirc_driver) and
             _('<b>Warning:</b> Cannot find such receiver.') or '')
 
         self.__entry_device.set_text(device_node or '')



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