hal/tools/device-manager DeviceManager.py, 1.16,
1.17 Representation.py, 1.11, 1.12
David Zeuthen
david at freedesktop.org
Wed Jan 19 14:26:49 PST 2005
Update of /cvs/hal/hal/tools/device-manager
In directory gabe:/tmp/cvs-serv2403/tools/device-manager
Modified Files:
DeviceManager.py Representation.py
Log Message:
2005-01-19 David Zeuthen <davidz at redhat.com>
Some more refactoring... You want to redo 'make install' to
get h-d-m working after this...
* hald/linux2/classdev.c:
(input_add): Don't set info.bus as it doesn't really make sense
since it is a class device
(input_post_probing): New function
(input_compute_udi): New function
(bluetooth_add): New function
(bluetooth_compute_udi): New function
(add_classdev_after_probing): New function
(add_classdev_probing_helper_done): New function
(hotplug_event_begin_add_classdev): Create and use a framework
where we don't have to think about asynchronous issues per
logical device class.
(hotplug_event_begin_remove_classdev): -do-
(input_helper_done): Deleted due to new framework
* tools/device-manager/DeviceManager.py: Do not assume that
info.bus is available
* tools/device-manager/Representation.py: Do not assume that
info.bus is available
Index: DeviceManager.py
===================================================================
RCS file: /cvs/hal/hal/tools/device-manager/DeviceManager.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- DeviceManager.py 8 Nov 2004 22:30:25 -0000 1.16
+++ DeviceManager.py 19 Jan 2005 22:26:47 -0000 1.17
@@ -298,12 +298,15 @@
category = self.xml.get_widget("ns_device_category")
capabilities = self.xml.get_widget("ns_device_capabilities")
- # we always have Bus and State
- bus.set_label(Const.BUS_NAMES[device.properties["info.bus"]])
+ 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"]])
#state.set_label(Const.STATE_NAMES[device.properties["State"]])
# guestimate product and vendor if we have no device information file
- if device.properties["info.bus"]=="usb":
+ if device.properties.has_key("info.bus") and device.properties["info.bus"]=="usb":
if device.properties.has_key("info.product"):
product.set_label("%s"%device.properties["info.product"])
elif device.properties.has_key("usb.product"):
@@ -323,7 +326,7 @@
vendor.set_label("Unknown")
- elif device.properties["info.bus"]=="pci":
+ elif device.properties.has_key("info.bus") and device.properties["info.bus"]=="pci":
if device.properties.has_key("info.product"):
product.set_label("%s"%device.properties["info.product"])
elif device.properties.has_key("pci.product"):
@@ -341,7 +344,7 @@
vendor.set_label("Unknown (0x%x)"%device.properties["pci.vendor_id"])
else:
vendor.set_label("Unknown")
- elif device.properties["info.bus"]=="block":
+ elif device.properties.has_key("info.bus") and device.properties["info.bus"]=="block":
if device.properties.has_key("info.product"):
product.set_label("%s"%device.properties["info.product"])
else:
@@ -370,7 +373,7 @@
def update_tab_usb(self, device):
"""Updates the 'USB' tab given a Device object; may hide it"""
page = self.xml.get_widget("device_notebook").get_nth_page(1)
- if device.properties["info.bus"]!="usb":
+ if not device.properties.has_key("info.bus") or device.properties["info.bus"]!="usb":
page.hide_all()
return
@@ -404,7 +407,7 @@
def update_tab_pci(self, device):
"""Updates the 'PCI' tab given a Device object; may hide it"""
page = self.xml.get_widget("device_notebook").get_nth_page(2)
- if device.properties["info.bus"]!="pci":
+ if not device.properties.has_key("info.bus") or device.properties["info.bus"]!="pci":
page.hide_all()
return
Index: Representation.py
===================================================================
RCS file: /cvs/hal/hal/tools/device-manager/Representation.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Representation.py 20 Sep 2004 18:31:15 -0000 1.11
+++ Representation.py 19 Jan 2005 22:26:47 -0000 1.12
@@ -52,11 +52,14 @@
return self.icons["computer"]
# First look at bus type, every device got Bus property
- bus = device.properties["info.bus"]
- if bus=="usb_device":
- icon = self.icons["bus_usb"]
- elif bus=="pci":
- icon = self.icons["bus_pci"]
+ if device.properties.has_key("info.bus"):
+ bus = device.properties["info.bus"]
+ if bus=="usb_device":
+ icon = self.icons["bus_usb"]
+ elif bus=="pci":
+ icon = self.icons["bus_pci"]
+ else:
+ bus = "unknown"
# Then look at Category, if available
if not device.properties.has_key("info.category"):
More information about the hal-commit
mailing list