hal/hald/linux2 classdev.c,1.38,1.39

Kay Sievers kay at freedesktop.org
Fri Jan 13 07:38:01 PST 2006


Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv21369/hald/linux2

Modified Files:
	classdev.c 
Log Message:
2006-01-13  Kay Sievers  <kay.sievers at vrfy.org>

        * hald/linux2/classdev.c: (usbraw_add), (usbraw_compute_udi): Add
        "usbraw" device object, that contains the name of the device node
        to catch for libusb access.


Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- classdev.c	6 Jan 2006 15:38:58 -0000	1.38
+++ classdev.c	13 Jan 2006 15:37:59 -0000	1.39
@@ -484,6 +484,42 @@
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
+usbraw_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev, const gchar *sysfs_path_in_devices)
+{
+	HalDevice *d;
+
+	d = NULL;
+
+	if (physdev == NULL || sysfs_path_in_devices == NULL)
+		goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", physdev->udi);
+	hal_device_property_set_string (d, "info.category", "usbraw");
+	hal_device_add_capability (d, "usbraw");
+	hal_device_property_set_string (d, "info.product", "USB Raw Device Access");
+	hal_device_property_set_string (d, "usbraw.device", device_file);
+
+out:
+	return d;
+}
+
+static gboolean
+usbraw_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi), "%s_usbraw",
+			      hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
 sound_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev, const gchar *sysfs_path_in_devices)
 {
 	HalDevice *d;
@@ -1013,6 +1049,16 @@
 	.remove       = classdev_remove
 };
 
+static ClassDevHandler classdev_handler_usbraw =
+{ 
+	.subsystem    = "usb_device",
+	.add          = usbraw_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = usbraw_compute_udi,
+	.remove       = classdev_remove
+};
+
 static ClassDevHandler classdev_handler_sound = 
 { 
 	.subsystem    = "sound",
@@ -1070,6 +1116,7 @@
 	&classdev_handler_scsi_generic,
 	&classdev_handler_scsi_host,
 	&classdev_handler_usbclass,
+	&classdev_handler_usbraw,
 	&classdev_handler_sound,
 	&classdev_handler_serial,
 	&classdev_handler_tape,




More information about the hal-commit mailing list