hal/hald/linux block_class_device.c, 1.49, 1.50 ide_bus_device.c, 1.6, 1.7 ide_host_bus_device.c, 1.7, 1.8 ieee1394_host_class_device.c, 1.4, 1.5 ieee1394_node_class_device.c, 1.4, 1.5 macio_bus_device.c, 1.3, 1.4 pcmcia_socket_class_device.c, 1.3, 1.4 scsi_device_class_device.c, 1.9, 1.10 scsi_host_class_device.c, 1.9, 1.10 usb_bus_device.c, 1.11, 1.12 usbif_bus_device.c, 1.8, 1.9

David Zeuthen david at freedesktop.org
Mon Aug 9 11:33:32 PDT 2004


Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv27210/hald/linux

Modified Files:
	block_class_device.c ide_bus_device.c ide_host_bus_device.c 
	ieee1394_host_class_device.c ieee1394_node_class_device.c 
	macio_bus_device.c pcmcia_socket_class_device.c 
	scsi_device_class_device.c scsi_host_class_device.c 
	usb_bus_device.c usbif_bus_device.c 
Log Message:
2004-08-09  David Zeuthen  <david at fubar.dk>

	* doc/spec/Makefile.am (FIGURE_FILES): Added hal-fdi-example3.png

	* doc/spec/hal-spec.xml.in: Added some text about how storage_lun%d.*
	and storage.* properties are merged from the physical device object
	backing the block devices. Included .fdi example with 6in1 reader
	to further clarify this.

	* doc/spec/hal/hal-devices1.png: 
	* doc/spec/hal/hal-fdi-example1.png:
	Updated to show full device tree now that info.virtual is gone.

	* doc/spec/hal/hal-fdi-example2.png: New file

	* doc/spec/hal/hal-fdi-example3.png: New file

2004-08-08  David Zeuthen  <david at fubar.dk>

	* doc/TODO: Remove the TODO entry about support for multiple USB
	interfaces since this is now done

	* hald/linux/usbif_bus_device.c (compute_name_from_if): New function

	* hald/linux/usb_bus_device.c: Rename all usb.* properties to
	usb_device.*

	* hald/linux/usbif_bus_device.c: Rename all usbif.* properties to
	usb.*. Merge usb_device.* properties from parent device. Essentially
	an USB interface is now like an USB device was except that it
	exports properties usb.interface.* to describe the USB interface

	* tools/device-manager/Const.py.in: 
	* tools/device-manager/Representation.py: 
	Handle the s/usb/usb_device/ and s/usbif/usb/ renamings

	* doc/spec/hal-spec.xml.in: Apply a patch from Kay with spelling/
	language/grammar improvements. Also update to reflect the USB
	renaming.

	* hald/linux/usbif_bus_device.c (usbif_device_pre_process): 
	* hald/linux/scsi_host_class_device.c (scsi_host_class_pre_process): 
	* hald/linux/scsi_device_class_device.c 
	(scsi_device_class_pre_process): 
	* hald/linux/macio_bus_device.c (macio_device_pre_process): 
	* hald/linux/ieee1394_node_class_device.c 
	(ieee1394_node_class_pre_process): 
	* hald/linux/ieee1394_host_class_device.c 
	(ieee1394_host_class_pre_process): 
	* hald/linux/ide_host_bus_device.c (ide_host_device_pre_process): 
	* hald/linux/ide_bus_device.c (ide_device_pre_process): 
	* hald/linux/block_class_device.c (block_class_pre_process): 
	Don't set the info.virtual property

2004-08-06  David Zeuthen  <david at fubar.dk>

	* fdi/20freedesktop/canon-digital-ixus-v.fdi: Updated to match spec

	* fdi/20freedesktop/jetflash-mp3-player.fdi: Updated to match spec

	* doc/spec/hal-spec.xml.in: Work in progress

	* hald/linux/pcmcia_socket_class_device.c 
	(pcmcia_socket_class_pre_process): Add property pcmcia_socket.number



Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- block_class_device.c	1 Aug 2004 23:17:02 -0000	1.49
+++ block_class_device.c	9 Aug 2004 18:33:29 -0000	1.50
@@ -1220,7 +1220,6 @@
 
 		/* We are a volume */
 		find_and_set_physical_device (d);
-		hal_device_property_set_bool (d, "info.virtual", TRUE);
 		hal_device_add_capability (d, "volume");
 		hal_device_property_set_string (d, "info.category", "volume");
 		hal_device_property_set_string (d, "volume.label", "");

Index: ide_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ide_bus_device.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ide_bus_device.c	5 Jul 2004 18:21:07 -0000	1.6
+++ ide_bus_device.c	9 Aug 2004 18:33:29 -0000	1.7
@@ -86,8 +86,6 @@
 		hal_device_property_set_string (d, "info.product",
 						"IDE device (slave)");
 	}
-
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
 }
 
 

Index: ide_host_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ide_host_bus_device.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ide_host_bus_device.c	5 Jul 2004 18:21:07 -0000	1.7
+++ ide_host_bus_device.c	9 Aug 2004 18:33:29 -0000	1.8
@@ -91,9 +91,6 @@
 
 	/* guestimate product name */
 	hal_device_property_set_string (d, "info.product", "IDE host controller");
-
-	/* virtual device */
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
 }
 
 

Index: ieee1394_host_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ieee1394_host_class_device.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ieee1394_host_class_device.c	2 Aug 2004 17:49:43 -0000	1.4
+++ ieee1394_host_class_device.c	9 Aug 2004 18:33:29 -0000	1.5
@@ -113,7 +113,6 @@
 		}
 	}
 
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
 }
 		  
 /** Method specialisations for ieee1394_host device class */

Index: ieee1394_node_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ieee1394_node_class_device.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ieee1394_node_class_device.c	2 Aug 2004 17:49:43 -0000	1.4
+++ ieee1394_node_class_device.c	9 Aug 2004 18:33:29 -0000	1.5
@@ -124,8 +124,6 @@
 		hal_device_property_set_string (d, "info.vendor",
 						numeric_name);
 	}
-
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
 }
 		  
 /** Method specialisations for ieee1394_node device class */

Index: macio_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/macio_bus_device.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- macio_bus_device.c	5 Jul 2004 18:21:07 -0000	1.3
+++ macio_bus_device.c	9 Aug 2004 18:33:29 -0000	1.4
@@ -72,7 +72,6 @@
 			  struct sysfs_device *device)
 {
 	hal_device_property_set_string (d, "macio.bus_id", device->bus_id);
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
 }
 
 

Index: pcmcia_socket_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/pcmcia_socket_class_device.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pcmcia_socket_class_device.c	5 Jul 2004 18:21:07 -0000	1.3
+++ pcmcia_socket_class_device.c	9 Aug 2004 18:33:29 -0000	1.4
@@ -72,8 +72,14 @@
 				const char *sysfs_path,
 				struct sysfs_class_device *class_device)
 {
+	int num;
+
+	sscanf (class_device->name, "pcmcia_socket%d", &num);
+	hal_device_property_set_int (d, "pcmcia_socket.number", num);
+
 	hal_device_add_capability (d, "pcmcia_socket");
 	hal_device_property_set_string (d, "info.category", "pcmcia_socket");
+
 }
 
 /** Method specialisations for input device class */

Index: scsi_device_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_device_class_device.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- scsi_device_class_device.c	1 Aug 2004 19:56:43 -0000	1.9
+++ scsi_device_class_device.c	9 Aug 2004 18:33:29 -0000	1.10
@@ -73,9 +73,6 @@
 	/* guestimate product name */
 	hal_device_property_set_string (d, "info.product", "SCSI Device");
 
-	/* this is a virtual device */
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
-
 	hal_device_add_capability (d, "scsi_device");
 }
 

Index: scsi_host_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_host_class_device.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- scsi_host_class_device.c	1 Aug 2004 19:56:43 -0000	1.9
+++ scsi_host_class_device.c	9 Aug 2004 18:33:29 -0000	1.10
@@ -68,9 +68,6 @@
 	hal_device_property_set_string (d, "info.product",
 					"SCSI Host Interface");
 
-	/* this is a virtual device */
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
-
 	hal_device_add_capability (d, "scsi_host");
 }
 

Index: usb_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usb_bus_device.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- usb_bus_device.c	5 Jul 2004 18:21:07 -0000	1.11
+++ usb_bus_device.c	9 Aug 2004 18:33:29 -0000	1.12
@@ -601,21 +601,21 @@
 	static char buf[256];
 
 	if (append_num == -1)
-		format = "/org/freedesktop/Hal/devices/usb_%x_%x_%x_%d_%s";
+		format = "/org/freedesktop/Hal/devices/usb_device_%x_%x_%x_%d_%s";
 	else
 		format =
-		    "/org/freedesktop/Hal/devices/usb_%x_%x_%x_%d_%s-%d";
+		    "/org/freedesktop/Hal/devices/usb_device_%x_%x_%x_%d_%s-%d";
 
-	if (hal_device_has_property (d, "usb.serial"))
-		serial = hal_device_property_get_string (d, "usb.serial");
+	if (hal_device_has_property (d, "usb_device.serial"))
+		serial = hal_device_property_get_string (d, "usb_device.serial");
 	else
 		serial = "noserial";
 
 	snprintf (buf, 256, format,
-		  hal_device_property_get_int (d, "usb.vendor_id"),
-		  hal_device_property_get_int (d, "usb.product_id"),
-		  hal_device_property_get_int (d, "usb.device_revision_bcd"),
-		  hal_device_property_get_int (d, "usb.cfg_value"),
+		  hal_device_property_get_int (d, "usb_device.vendor_id"),
+		  hal_device_property_get_int (d, "usb_device.product_id"),
+		  hal_device_property_get_int (d, "usb_device.device_revision_bcd"),
+		  hal_device_property_get_int (d, "usb_device.cfg_value"),
 		  serial, append_num);
 
 	return buf;
@@ -644,7 +644,7 @@
 		/* Is of form "usb%d" which means that this is a USB virtual 
 		 * root hub, cf. drivers/usb/hcd.c in kernel 2.6
 		 */
-		hal_device_property_set_int (d, "usb.bus_number", bus_number);
+		hal_device_property_set_int (d, "usb_device.bus_number", bus_number);
 
 		proc_info = usb_proc_find_virtual_hub (bus_number);
 	} else {
@@ -667,7 +667,7 @@
 		/* the first part is easy */
 		bus_number = atoi (bus_id);
 
-		hal_device_property_set_int (d, "usb.bus_number", bus_number);
+		hal_device_property_set_int (d, "usb_device.bus_number", bus_number);
 
 		/* The naming convention also guarantees that
 		 *
@@ -693,7 +693,7 @@
 				proc_info =
 				    usb_proc_find_virtual_hub_child
 				    (bus_number, port_number);
-				hal_device_property_set_int (d, "usb.port_number",
+				hal_device_property_set_int (d, "usb_device.port_number",
 						     port_number);
 			}
 		} else {
@@ -710,7 +710,7 @@
 				port_number += digit;
 			}
 
-			hal_device_property_set_int (d, "usb.port_number",
+			hal_device_property_set_int (d, "usb_device.port_number",
 					     port_number);
 
 			/* Ok, got the port number and bus number; this is 
@@ -725,7 +725,7 @@
 			} else {
 				parent_device_number =
 				    hal_device_property_get_int (
-					    parent, "usb.linux.device_number");
+					    parent, "usb_device.linux.device_number");
 				//printf("parent_device_number = %d\n", parent_device_number);
 				proc_info =
 				    usb_proc_find_on_hub (bus_number,
@@ -740,17 +740,17 @@
 	if (proc_info != NULL) {
 		char kernel_path[32 + 1];
 
-		hal_device_property_set_int (d, "usb.level_number",
+		hal_device_property_set_int (d, "usb_device.level_number",
 				     proc_info->t_level);
-		hal_device_property_set_int (d, "usb.linux.device_number",
+		hal_device_property_set_int (d, "usb_device.linux.device_number",
 				     proc_info->t_device);
-		hal_device_property_set_int (d, "usb.linux.parent_number",
+		hal_device_property_set_int (d, "usb_device.linux.parent_number",
 				     proc_info->t_device);
-		hal_device_property_set_int (d, "usb.num_ports",
+		hal_device_property_set_int (d, "usb_device.num_ports",
 				     proc_info->t_max_children);
-		hal_device_property_set_int (d, "usb.speed_bcd",
+		hal_device_property_set_int (d, "usb_device.speed_bcd",
 				     proc_info->t_speed_bcd);
-		hal_device_property_set_int (d, "usb.version_bcd",
+		hal_device_property_set_int (d, "usb_device.version_bcd",
 				     proc_info->d_version_bcd);
 
 		/* Ok, now compute the unique name that the kernel sometimes 
@@ -760,7 +760,7 @@
 		if (proc_info->t_level == 0) {
 			snprintf (kernel_path, 32, "usb-%s",
 				  hal_device_property_get_string (d,
-							  "usb.serial"));
+							  "usb_device.serial"));
 			hal_device_property_set_string (d, "linux.kernel_devname",
 						kernel_path);
 		} else {
@@ -772,7 +772,7 @@
 						   "linux.kernel_devname"),
 						  hal_device_property_get_int (
 							  d,
-							  "usb.port_number"));
+							  "usb_device.port_number"));
 				} else {
 					snprintf (kernel_path, 32, "%s.%d",
 						  hal_device_property_get_string
@@ -780,7 +780,7 @@
 						   "linux.kernel_devname"),
 						  hal_device_property_get_int (
 							  d,
-							  "usb.port_number"));
+							  "usb_device.port_number"));
 				}
 				hal_device_property_set_string (d,
 							"linux.kernel_devname",
@@ -831,22 +831,22 @@
 		else if (strcmp (attr_name, "idVendor") == 0)
 			vendor_id = parse_hex (cur->value);
 		else if (strcmp (attr_name, "bcdDevice") == 0)
-			hal_device_property_set_int (d, "usb.device_revision_bcd",
+			hal_device_property_set_int (d, "usb_device.device_revision_bcd",
 					     parse_hex (cur->value));
 		else if (strcmp (attr_name, "bMaxPower") == 0)
-			hal_device_property_set_int (d, "usb.max_power",
+			hal_device_property_set_int (d, "usb_device.max_power",
 					     parse_dec (cur->value));
 		else if (strcmp (attr_name, "serial") == 0
 			 && strlen (cur->value) > 0)
-			hal_device_property_set_string (d, "usb.serial",
+			hal_device_property_set_string (d, "usb_device.serial",
 						cur->value);
 		else if (strcmp (attr_name, "bmAttributes") == 0) {
 			int bmAttributes = parse_hex (cur->value);
 
 			/* USB_CONFIG_ATT_SELFPOWER */
-			hal_device_property_set_bool (d, "usb.is_self_powered",
+			hal_device_property_set_bool (d, "usb_device.is_self_powered",
 					      (bmAttributes & 0x40) != 0);
-			hal_device_property_set_bool (d, "usb.can_wake_up",
+			hal_device_property_set_bool (d, "usb_device.can_wake_up",
 					      (bmAttributes & 0x20) != 0);
 		}
 /*
@@ -860,30 +860,30 @@
 		else if (strcmp (attr_name, "product") == 0)
 			product_name_kernel = cur->value;
 		else if (strcmp (attr_name, "bDeviceClass") == 0)
-			hal_device_property_set_int (d, "usb.device_class",
+			hal_device_property_set_int (d, "usb_device.device_class",
 					     parse_hex (cur->value));
 		else if (strcmp (attr_name, "bDeviceSubClass") == 0)
-			hal_device_property_set_int (d, "usb.device_subclass",
+			hal_device_property_set_int (d, "usb_device.device_subclass",
 					     parse_hex (cur->value));
 		else if (strcmp (attr_name, "bDeviceProtocol") == 0)
-			hal_device_property_set_int (d, "usb.device_protocol",
+			hal_device_property_set_int (d, "usb_device.device_protocol",
 					     parse_hex (cur->value));
 
 		else if (strcmp (attr_name, "bNumConfigurations") == 0)
-			hal_device_property_set_int (d, "usb.num_configurations",
+			hal_device_property_set_int (d, "usb_device.num_configurations",
 					     parse_dec (cur->value));
 		else if (strcmp (attr_name, "bConfigurationValue") == 0)
-			hal_device_property_set_int (d, "usb.configuration_value",
+			hal_device_property_set_int (d, "usb_device.configuration_value",
 					     parse_dec (cur->value));
 
 		else if (strcmp (attr_name, "bNumInterfaces") == 0)
-			hal_device_property_set_int (d, "usb.num_interfaces",
+			hal_device_property_set_int (d, "usb_device.num_interfaces",
 					     parse_dec (cur->value));
 
 	}			/* for all attributes */
 
-	hal_device_property_set_int (d, "usb.product_id", product_id);
-	hal_device_property_set_int (d, "usb.vendor_id", vendor_id);
+	hal_device_property_set_int (d, "usb_device.product_id", product_id);
+	hal_device_property_set_int (d, "usb_device.vendor_id", vendor_id);
 
 	/* Lookup names in usb.ids; these may override what the kernel told
 	 * us, but, hey, it's only a name; it's not something we are going
@@ -895,27 +895,27 @@
 	 */
 	usb_ids_find (vendor_id, product_id, &vendor_name, &product_name);
 	if (vendor_name != NULL) {
-		hal_device_property_set_string (d, "usb.vendor", vendor_name);
+		hal_device_property_set_string (d, "usb_device.vendor", vendor_name);
 		hal_device_property_set_string (d, "info.vendor", vendor_name);
 	} else if (vendor_name_kernel != NULL) {
 		/* fallback on name supplied from kernel */
-		hal_device_property_set_string (d, "usb.vendor",
+		hal_device_property_set_string (d, "usb_device.vendor",
 					vendor_name_kernel);
 		hal_device_property_set_string (d, "info.vendor",
 					vendor_name_kernel);
 	} else {
 		/* last resort; use numeric name */
 		snprintf (numeric_name, sizeof(numeric_name), "Unknown (0x%04x)", vendor_id);
-		hal_device_property_set_string (d, "usb.vendor", numeric_name);
+		hal_device_property_set_string (d, "usb_device.vendor", numeric_name);
 		hal_device_property_set_string (d, "info.vendor", numeric_name);
 	}
 
 	if (product_name != NULL) {
-		hal_device_property_set_string (d, "usb.product", product_name);
+		hal_device_property_set_string (d, "usb_device.product", product_name);
 		hal_device_property_set_string (d, "info.product", product_name);
 	} else if (product_name_kernel != NULL) {
 		/* name supplied from kernel (if available) */
-		hal_device_property_set_string (d, "usb.product",
+		hal_device_property_set_string (d, "usb_device.product",
 					product_name_kernel);
 		hal_device_property_set_string (d, "info.product",
 					product_name_kernel);
@@ -923,15 +923,15 @@
 		/* last resort; use numeric name */
 		snprintf (numeric_name, sizeof(numeric_name), "Unknown (0x%04x)",
 			  product_id);
-		hal_device_property_set_string (d, "usb.product", numeric_name);
+		hal_device_property_set_string (d, "usb_device.product", numeric_name);
 		hal_device_property_set_string (d, "info.product", numeric_name);
 	}
 
 
 	/* Check device class */
-	usb_add_caps_from_class (d, hal_device_property_get_int (d, "usb.device_class"),
-				 hal_device_property_get_int (d, "usb.device_subclass"),
-				 hal_device_property_get_int (d, "usb.device_protocol"));
+	usb_add_caps_from_class (d, hal_device_property_get_int (d, "usb_device.device_class"),
+				 hal_device_property_get_int (d, "usb_device.device_subclass"),
+				 hal_device_property_get_int (d, "usb_device.device_protocol"));
 
 	usb_merge_info_from_proc (d);
 }
@@ -948,9 +948,9 @@
 	usb_device_compute_udi,    /**< UDI computing function */
 	usb_device_pre_process,    /**< add more properties */
 	bus_device_got_udi,        /**< got UDI */
-	bus_device_in_gdl,            /**< in GDL */
+	bus_device_in_gdl,         /**< in GDL */
 	"usb",                     /**< sysfs bus name */
-	"usb"                      /**< namespace */
+	"usb_device"               /**< namespace */
 };
 
 

Index: usbif_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usbif_bus_device.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- usbif_bus_device.c	5 Jul 2004 18:21:07 -0000	1.8
+++ usbif_bus_device.c	9 Aug 2004 18:33:29 -0000	1.9
@@ -38,6 +38,7 @@
 
 #include "../logger.h"
 #include "../device_store.h"
+#include "../hald.h"
 #include "bus_device.h"
 #include "common.h"
 
@@ -84,9 +85,9 @@
 	static char buf[256];
 
 	if (append_num == -1)
-		format = "/org/freedesktop/Hal/devices/usbif_%s_%d";
+		format = "/org/freedesktop/Hal/devices/usb_%s_%d";
 	else
-		format = "/org/freedesktop/Hal/devices/usbif_%s_%d-%d";
+		format = "/org/freedesktop/Hal/devices/usb_%s_%d-%d";
 
 	/*hal_device_print (d);*/
 
@@ -97,13 +98,92 @@
 
 	snprintf (buf, 256, format,
 		  name,
-		  hal_device_property_get_int (d, "usbif.number"), append_num);
+		  hal_device_property_get_int (d, "usb.interface.number"), 
+		  append_num);
 
 	return buf;
 }
 
 
 static void 
+compute_name_from_if (HalDevice *d)
+{
+	int c, s, p;
+
+	c = hal_device_property_get_int (d, "usb.interface.class");
+	s = hal_device_property_get_int (d, "usb.interface.subclass");
+	p = hal_device_property_get_int (d, "usb.interface.protocol");
+
+	hal_device_property_set_string (
+		d, "info.product", "USB Interface");
+
+	/* Just do this for a couple of mainstream interfaces. GUI
+	 * Device Managers should do this themselves (for i18n reasons)
+	 *
+	 * See http://www.linux-usb.org/usb.ids for details */
+	switch (c)
+	{
+	case 0x01:
+		hal_device_property_set_string (
+			d, "info.product", "USB Audio Interface");
+		break;
+
+	case 0x02:
+		hal_device_property_set_string (
+			d, "info.product", "USB Communications Interface");
+		break;
+
+	case 0x03:
+		hal_device_property_set_string (
+			d, "info.product", "USB HID Interface");
+		break;
+
+	case 0x06:
+		if (s==0x01 && p==0x01)
+			hal_device_property_set_string (
+				d, "info.product", "USB PTP Interface");
+		break;
+
+	case 0x07:
+		hal_device_property_set_string (
+			d, "info.product", "USB Printing Interface");
+		break;
+
+	case 0x08:
+		hal_device_property_set_string (
+			d, "info.product", "USB Mass Storage Interface");
+		break;
+
+	case 0x09:
+		hal_device_property_set_string (
+			d, "info.product", "USB Hub Interface");
+		break;
+
+	case 0x0a:
+		hal_device_property_set_string (
+			d, "info.product", "USB Data Interface");
+		break;
+
+	case 0x0e:
+		hal_device_property_set_string (
+			d, "info.product", "USB Video Interface");
+		break;
+
+	case 0xe0:
+		if (s==0x01 && p==0x01)
+			hal_device_property_set_string (
+				d, "info.product", "USB Bluetooth Interface");
+		break;
+
+	case 0xff:
+		hal_device_property_set_string (
+			d, "info.product", "Vendor Specific Interface");
+		break;
+	}
+}
+
+
+static void 
 usbif_device_pre_process (BusDeviceHandler *self,
 			  HalDevice *d,
 			  const char *sysfs_path,
@@ -113,6 +193,17 @@
 	int len;
 	struct sysfs_attribute *cur;
 	char attr_name[SYSFS_NAME_LEN];
+	const char *parent_udi;
+	HalDevice *parent_device;
+
+	/* Merge all the usb_device.* properties into the usb.* namespace */
+	parent_udi = hal_device_property_get_string (d, "info.parent");
+	parent_device = hal_device_store_find (hald_get_gdl (), parent_udi);
+	hal_device_merge_with_rewrite (d, parent_device, "usb.", "usb_device.");
+	/* But maintain the correct usb.linux.sysfs_path property */
+	hal_device_property_set_string (d, "usb.linux.sysfs_path", 
+					device->path);
+
 
 	dlist_for_each_data (sysfs_get_device_attributes (device), cur,
 			     struct sysfs_attribute) {
@@ -130,20 +221,20 @@
 		/*printf("attr_name=%s -> '%s'\n", attr_name, cur->value); */
 
 		if (strcmp (attr_name, "bInterfaceClass") == 0)
-			hal_device_property_set_int (d, "usbif.interface_class",
+			hal_device_property_set_int (d, "usb.interface.class",
 					     parse_dec (cur->value));
 		else if (strcmp (attr_name, "bInterfaceSubClass") == 0)
-			hal_device_property_set_int (d, "usbif.interface_subclass",
+			hal_device_property_set_int (d, "usb.interface.subclass",
 					     parse_dec (cur->value));
 		else if (strcmp (attr_name, "bInterfaceProtocol") == 0)
-			hal_device_property_set_int (d, "usbif.interface_protocol",
+			hal_device_property_set_int (d, "usb.interface.protocol",
 					     parse_dec (cur->value));
 		else if (strcmp (attr_name, "bInterfaceNumber") == 0)
-			hal_device_property_set_int (d, "usbif.number",
+			hal_device_property_set_int (d, "usb.interface.number",
 					     parse_dec (cur->value));
 	}
 
-	hal_device_property_set_bool (d, "info.virtual", TRUE);
+	compute_name_from_if (d);
 }
 
 /** Method specialisations for bustype usbif */
@@ -159,7 +250,7 @@
 	bus_device_got_udi,        /**< got UDI */
 	bus_device_in_gdl,            /**< in GDL */
 	"usb",                     /**< sysfs bus name */
-	"usbif"                    /**< namespace */
+	"usb"                      /**< namespace */
 };
 
 /** @} */




More information about the hal-commit mailing list