hal/hald/linux class_device.c, 1.9, 1.10 osspec.c, 1.13,
1.14 pci_bus_device.c, 1.4, 1.5 usb_bus_device.c, 1.7, 1.8
David Zeuthen
david at pdx.freedesktop.org
Thu Apr 22 14:52:08 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv656/hald/linux
Modified Files:
class_device.c osspec.c pci_bus_device.c usb_bus_device.c
Log Message:
2004-04-22 David Zeuthen <david at fubar.dk>
* hald/linux/usb_bus_device.c (usb_add_caps_from_class): don't set
capabilities from device class since this is very misleading.
In fact, capabilities should only stem from kernel- or userspace-
drivers. We retain the right to set the usbhub capability as no
kernel driver is bound to this class of devices. Yet.. who knows?
In either case, a GUI device browsers can always inspect the info.bus
and consult the appropriate stuff, e.g. the usb.device_class,
_sub_class and _protocol deal for usb devices, to select an appropriate
icon.
* hald/linux/pci_bus_device.c (pci_add_caps_from_class): removed for
same reasons as above
(pci_device_pre_process): don't call pci_add_caps_from_class
* tools/device-manager/Representation.py:
s/bridge.cardbus/pcmcia_socket/
* hald/linux/osspec.c: add pcmcia_socket_class_handler
* hald/linux/pcmcia_socket_class_device.c: new file; very simple just
tag a busdevice with the capability pcmcia_socket
* hald/linux/class_device.c (class_device_final): log an informative
message when we merge onto a device
Index: class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/class_device.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- a/class_device.c 22 Apr 2004 18:16:17 -0000 1.9
+++ b/class_device.c 22 Apr 2004 21:52:05 -0000 1.10
@@ -404,6 +404,10 @@
* device */
hal_device_merge (sysdevice, d);
+ HAL_INFO (("Merged udi=%s onto %s",
+ hal_device_get_udi (d),
+ hal_device_get_udi (sysdevice)));
+
/* get rid of temporary device */
hal_device_store_remove (hald_get_tdl (), d);
g_object_unref (d);
Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- a/osspec.c 22 Apr 2004 18:16:17 -0000 1.13
+++ b/osspec.c 22 Apr 2004 21:52:05 -0000 1.14
@@ -56,6 +56,7 @@
extern ClassDeviceHandler scsi_device_class_handler;
extern ClassDeviceHandler scsi_generic_class_handler;
extern ClassDeviceHandler block_class_handler;
+extern ClassDeviceHandler pcmcia_socket_class_handler;
/*
extern ClassDeviceHandler ieee1394_host_class_handler;
@@ -82,6 +83,7 @@
&scsi_device_class_handler,
&scsi_generic_class_handler,
&block_class_handler,
+ &pcmcia_socket_class_handler,
/*&ieee1394_host_class_handler,
&ieee1394_node_class_handler,*/
NULL
Index: pci_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/pci_bus_device.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/pci_bus_device.c 12 Apr 2004 20:11:51 -0000 1.4
+++ b/pci_bus_device.c 22 Apr 2004 21:52:05 -0000 1.5
@@ -361,283 +361,6 @@
}
-/** Set capabilities from PCI class. This is a function from hell,
- * maybe some searchable data-structure would be better...
- *
- * @param d HalDevice to set caps on
- * @param dev_class device class
- * @param dev_sub_class device sub class
- * @param dev_proto device protocol
- */
-static void
-pci_add_caps_from_class (HalDevice * d,
- int dev_class, int dev_sub_class, int dev_proto)
-{
- char *cat = NULL;
-
- switch (dev_class) {
- case 0x01:
- cat = "storage_controller";
- hal_device_add_capability (d, "storage_controller");
- switch (dev_sub_class) {
- case 0x00:
- hal_device_add_capability (d, "storage_controller.scsi");
- break;
- case 0x01:
- hal_device_add_capability (d, "storage_controller.ide");
- break;
- case 0x02:
- hal_device_add_capability (d, "storage_controller.floppy");
- break;
- case 0x03:
- hal_device_add_capability (d, "storage_controller.ipi");
- break;
- case 0x04:
- hal_device_add_capability (d, "storage_controller.raid");
- break;
- }
- break;
- case 0x02:
- cat = "net";
- hal_device_add_capability (d, "net");
- switch (dev_sub_class) {
- case 0x00:
- hal_device_add_capability (d, "net.ethernet");
- break;
- case 0x01:
- hal_device_add_capability (d, "net.tokenring");
- break;
- case 0x02:
- hal_device_add_capability (d, "net.fddi");
- break;
- case 0x03:
- hal_device_add_capability (d, "net.atm");
- break;
- case 0x04:
- hal_device_add_capability (d, "net.isdn");
- break;
- }
- break;
- case 0x03:
- cat = "video";
- hal_device_add_capability (d, "video");
- if (dev_sub_class == 0x00 && dev_proto == 0x00)
- hal_device_add_capability (d, "video.vga");
- if (dev_sub_class == 0x00 && dev_proto == 0x01)
- hal_device_add_capability (d, "video.8514");
- else if (dev_sub_class == 0x01)
- hal_device_add_capability (d, "video.xga");
- else if (dev_sub_class == 0x02)
- hal_device_add_capability (d, "video.3d");
- break;
- case 0x04:
- cat = "multimedia";
- hal_device_add_capability (d, "multimedia");
- switch (dev_sub_class) {
- case 0x00:
- hal_device_add_capability (d, "multimedia.video");
- cat = "multimedia.video";
- break;
- case 0x01:
- hal_device_add_capability (d, "multimedia.audio");
- cat = "multimedia.audio";
- break;
- case 0x02:
- hal_device_add_capability (d, "multimedia.telephony");
- cat = "multimedia.telephony";
- break;
- }
- break;
- case 0x06:
- cat = "bridge";
- hal_device_add_capability (d, "bridge");
- switch (dev_sub_class) {
- case 0x00:
- hal_device_add_capability (d, "bridge.host");
- break;
- case 0x01:
- hal_device_add_capability (d, "bridge.isa");
- break;
- case 0x02:
- hal_device_add_capability (d, "bridge.eisa");
- break;
- case 0x03:
- hal_device_add_capability (d, "bridge.micro_channel");
- break;
- case 0x04:
- hal_device_add_capability (d, "bridge.pci");
- break;
- case 0x05:
- hal_device_add_capability (d, "bridge.pcmcia");
- break;
- case 0x06:
- hal_device_add_capability (d, "bridge.nubus");
- break;
- case 0x07:
- cat = "bridge.cardbus";
- hal_device_add_capability (d, "bridge.cardbus");
- break;
- case 0x08:
- hal_device_add_capability (d, "bridge.raceway");
- break;
- case 0x09:
- hal_device_add_capability (d, "bridge.semi_transparent");
- break;
- case 0x0a:
- hal_device_add_capability (d, "bridge.infiniband");
- break;
- }
- break;
- case 0x07:
- cat = "comm";
- hal_device_add_capability (d, "comm");
- if (dev_sub_class == 0x00) {
- cat = "comm.serial";
- hal_device_add_capability (d, "comm.serial");
- switch (dev_proto) {
- case 0x00:
- hal_device_add_capability (d, "comm.serial.8250");
- break;
- case 0x01:
- hal_device_add_capability (d, "comm.serial.16450");
- break;
- case 0x02:
- hal_device_add_capability (d, "comm.serial.16550");
- break;
- case 0x03:
- hal_device_add_capability (d, "comm.serial.16650");
- break;
- case 0x04:
- hal_device_add_capability (d, "comm.serial.16750");
- break;
- case 0x05:
- hal_device_add_capability (d, "comm.serial.16850");
- break;
- case 0x06:
- hal_device_add_capability (d, "comm.serial.16950");
- break;
- }
- } else if (dev_sub_class == 0x01) {
- cat = "comm.parallel";
- hal_device_add_capability (d, "comm.parallel");
- switch (dev_proto) {
- case 0x00:
- hal_device_add_capability (d, "comm.parallel.spp");
- break;
- case 0x01:
- hal_device_add_capability (d,
- "comm.parallel.bidir");
- break;
- case 0x02:
- hal_device_add_capability (d, "comm.parallel.ecp");
- break;
- case 0x03:
- hal_device_add_capability (d,
- "comm.parallel.ieee1284");
- break;
- case 0xfe:
- hal_device_add_capability (d,
- "comm.parallel.ieee1284_target");
- break;
- }
- } else if (dev_sub_class == 0x02) {
- cat = "comm.serial";
- hal_device_add_capability (d, "comm.serial");
- hal_device_add_capability (d, "comm.serial.multiport");
- } else if (dev_sub_class == 0x03) {
- cat = "modem";
- hal_device_add_capability (d, "modem");
- if (dev_proto >= 0x01 && dev_proto <= 0x04)
- hal_device_add_capability (d, "modem.hayes");
- }
- break;
- case 0x0c:
- cat = "serial_controller";
- hal_device_add_capability (d, "serial_controller");
- switch (dev_sub_class) {
- case 0x00:
- cat = "serial_controller.ieee1394";
- hal_device_add_capability (d,
- "serial_controller.ieee1394");
- if (dev_proto == 0x10)
- hal_device_add_capability (d,
- "serial_controller.ieee1394.ohci");
- break;
- case 0x01:
- hal_device_add_capability (d, "serial_controller.access");
- break;
- case 0x02:
- hal_device_add_capability (d, "serial_controller.ssa");
- break;
- case 0x03:
- cat = "serial_controller.usb";
- hal_device_add_capability (d, "serial_controller.usb");
- switch (dev_proto) {
- case 0x00:
- hal_device_add_capability (d,
- "serial_controller.usb.uhci");
- break;
- case 0x01:
- hal_device_add_capability (d,
- "serial_controller.usb.ohci");
- break;
- case 0x02:
- hal_device_add_capability (d,
- "serial_controller.usb.ehci");
- break;
- case 0xfe:
- hal_device_add_capability (d,
- "serial_controller.usb.device");
- break;
- }
- break;
- }
- break;
- case 0x0d:
- cat = "wireless";
- hal_device_add_capability (d, "wireless");
- switch (dev_sub_class) {
- case 0x00:
- hal_device_add_capability (d, "wireless.irda");
- break;
- case 0x01:
- hal_device_add_capability (d,
- "wireless.consumer_controller");
- break;
- case 0x02:
- hal_device_add_capability (d, "wireless.rf_controller");
- break;
- }
- break;
- case 0x0f:
- cat = "satellite_controller";
- hal_device_add_capability (d, "satellite_controller");
- switch (dev_sub_class) {
- case 0x00:
- hal_device_add_capability (d, "satellite_controller.tv");
- break;
- case 0x01:
- hal_device_add_capability (d,
- "satellite_controller.audio");
- break;
- case 0x02:
- hal_device_add_capability (d,
- "satellite_controller.video");
- break;
- case 0x03:
- hal_device_add_capability (d, "satellite_controller.data");
- break;
- }
- break;
- }
-
- if (cat != NULL)
- hal_device_property_set_string (d, "info.category", cat);
-}
-
-
-
-
/** Init function for PCI handling
*
*/
@@ -753,8 +476,6 @@
hal_device_property_set_int (d, "pci.device_class", (cls >> 16) & 0xff);
hal_device_property_set_int (d, "pci.device_subclass", (cls >> 8) & 0xff);
hal_device_property_set_int (d, "pci.device_protocol", cls & 0xff);
- pci_add_caps_from_class (d, (cls >> 16) & 0xff, (cls >> 8) & 0xff,
- cls & 0xff);
}
Index: usb_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usb_bus_device.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/usb_bus_device.c 21 Apr 2004 18:44:41 -0000 1.7
+++ b/usb_bus_device.c 22 Apr 2004 21:52:06 -0000 1.8
@@ -514,9 +514,7 @@
*/
}
-/** Set capabilities from interface and/or device class. This is a
- * function from hell, maybe some searchable data-structure would be
- * better...
+/** Set capabilities from interface and/or device class.
*
* @param d The HalDevice to set the caps
* @param if_class Interface class
@@ -529,58 +527,9 @@
char *cat = NULL;
switch (if_class) {
- case 0x01:
- cat = "multimedia.audio";
- hal_device_add_capability (d, "multimedia.audio");
- break;
- case 0x02:
- if (if_sub_class == 0x06) {
- cat = "net";
- hal_device_add_capability (d, "net");
- hal_device_add_capability (d, "net.ethernet");
- } else if (if_sub_class == 0x02 && if_proto == 0x01) {
- cat = "modem";
- hal_device_add_capability (d, "modem");
- }
- break;
- case 0x03:
- cat = "input";
- hal_device_add_capability (d, "input");
- if (if_sub_class == 0x00 || if_sub_class == 0x01) {
- if (if_proto == 0x01) {
- cat = "input.keyboard";
- hal_device_add_capability (d, "input.keyboard");
- } else if (if_proto == 0x02) {
- cat = "input.mouse";
- hal_device_add_capability (d, "input.mouse");
- }
- }
- break;
- case 0x04:
- break;
- case 0x05:
- break;
- case 0x06:
- break;
- case 0x07:
- cat = "printer";
- hal_device_add_capability (d, "printer");
- break;
- case 0x08:
- cat = "storage_controller";
- hal_device_add_capability (d, "storage_controller");
- break;
case 0x09:
- cat = "hub";
- hal_device_add_capability (d, "hub");
- break;
- case 0x0a:
- break;
- case 0xe0:
- if (if_sub_class == 0x01 && if_proto == 0x01) {
- cat = "bluetooth_adaptor";
- hal_device_add_capability (d, "bluetooth_adaptor");
- }
+ cat = "usbhub";
+ hal_device_add_capability (d, "usbhub");
break;
}
More information about the hal-commit
mailing list