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

Kay Sievers kay at freedesktop.org
Fri Jan 13 08:40:34 PST 2006


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

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

        * hald/linux2/classdev.c: (usbraw_compute_udi), (video4linux_add),
        (video4linux_compute_udi), (dvb_add), (dvb_compute_udi): Add device
        objects for video and dvb devices, to have a way for applications to
        find the associated device nodes. Meaningful properties need to be
        added by someone who knows about this device class.

        * tools/device-manager/Representation.py: Add match to show icon
        in hal-device-manager.


Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- classdev.c	13 Jan 2006 15:37:59 -0000	1.39
+++ classdev.c	13 Jan 2006 16:40:31 -0000	1.40
@@ -514,6 +514,84 @@
 			      hal_device_property_get_string (d, "info.parent"));
 	hal_device_set_udi (d, udi);
 	hal_device_property_set_string (d, "info.udi", udi);
+
+	return TRUE;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+video4linux_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", "video4linux");
+	hal_device_add_capability (d, "video4linux");
+	hal_device_property_set_string (d, "info.product", "Video Device");
+	hal_device_property_set_string (d, "video4linux.device", device_file);
+
+out:
+	return d;
+}
+
+static gboolean
+video4linux_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi), "%s_video4linux",
+			      hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+
+	return TRUE;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
+dvb_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", "dvb");
+	hal_device_add_capability (d, "dvb");
+	hal_device_property_set_string (d, "info.product", "DVB Device");
+	hal_device_property_set_string (d, "dvb.device", device_file);
+
+out:
+	return d;
+}
+
+static gboolean
+dvb_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi), "%s_dvb",
+			      hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+
+	return TRUE;
 }
 
 
@@ -1059,6 +1137,26 @@
 	.remove       = classdev_remove
 };
 
+static ClassDevHandler classdev_handler_video4linux =
+{ 
+	.subsystem    = "video4linux",
+	.add          = video4linux_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = video4linux_compute_udi,
+	.remove       = classdev_remove
+};
+
+static ClassDevHandler classdev_handler_dvb =
+{ 
+	.subsystem    = "dvb",
+	.add          = dvb_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = dvb_compute_udi,
+	.remove       = classdev_remove
+};
+
 static ClassDevHandler classdev_handler_sound = 
 { 
 	.subsystem    = "sound",
@@ -1117,6 +1215,8 @@
 	&classdev_handler_scsi_host,
 	&classdev_handler_usbclass,
 	&classdev_handler_usbraw,
+	&classdev_handler_video4linux,
+	&classdev_handler_dvb,
 	&classdev_handler_sound,
 	&classdev_handler_serial,
 	&classdev_handler_tape,




More information about the hal-commit mailing list