[PATCH] fix 'bus type' display in h-d-m

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 10 02:09:52 PST 2007


Hi,

h-d-m does not correctly update the 'bus type' field, see Ubuntu bug
[1] for details. I just cooked up a small patch.


[1] https://launchpad.net/ubuntu/+source/hal/+bug/26362

(Pasting patches inline now, as requested by Danny).

Thanks,

Martin

--- hal-0.5.8.1/tools/device-manager/DeviceManager.py	2006-09-19 22:23:25.000000000 +0200
+++ hal-0.5.8.1/tools/device-manager/DeviceManager.py	2007-01-10 11:04:59.000000000 +0100
@@ -292,11 +292,18 @@
         category = self.xml.get_widget("ns_device_category")
         capabilities = self.xml.get_widget("ns_device_capabilities")
 
-	if not device.properties.has_key("info.bus"):
-            product.set_label("Unknown")
-            vendor.set_label("Unknown")
-	else:
-	    bus.set_label(Const.BUS_NAMES[device.properties["info.bus"]])	    
+        product.set_label("Unknown")
+        vendor.set_label("Unknown")
+
+        # walk up the device tree to find the bus type
+        bus.set_label("Unknown")
+        d = device
+        while d:
+            if d.properties.has_key("info.bus"):
+                bus.set_label(Const.BUS_NAMES[d.properties["info.bus"]])	    
+                break
+            d = self.udi_to_device(d.properties["info.parent"])
+
         #state.set_label(Const.STATE_NAMES[device.properties["State"]])
 
         # guestimate product and vendor if we have no device information file

-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/hal/attachments/20070110/106beb79/attachment.pgp


More information about the hal mailing list