hal/hald/linux2 classdev.c,1.12,1.13

David Zeuthen david at freedesktop.org
Tue Feb 22 12:18:06 PST 2005


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

Modified Files:
	classdev.c 
Log Message:
2005-02-22  David Zeuthen  <davidz at redhat.com>

	* hald/linux2/probing/probe-printer.c: New file

	* hald/linux2/probing/Makefile.am: Add build rules for 
	hald-probe-printer

	* hald/linux2/classdev.c (usbclass_add, usbclass_get_prober)
	(usbclass_compute_udi): Add support for USB printers



Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- classdev.c	9 Feb 2005 00:56:38 -0000	1.12
+++ classdev.c	22 Feb 2005 20:18:04 -0000	1.13
@@ -381,6 +381,18 @@
 		hal_device_property_set_string (d, "info.product", "USB HID Device");
 
 		hal_device_property_set_string (d, "hiddev.device", device_file);
+	} else if (sscanf (last_elem, "lp%d", &host_num) == 1) {
+
+		d = hal_device_new ();
+		hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+		hal_device_property_set_string (d, "linux.sysfs_path_device", sysfs_path_in_devices);
+		hal_device_property_set_string (d, "info.parent", physdev->udi);
+
+		hal_device_property_set_string (d, "info.category", "printer");
+		hal_device_add_capability (d, "printer");
+
+		hal_device_property_set_string (d, "info.product", "Printer");
+		hal_device_property_set_string (d, "printer.device", device_file);
 	}
 
 out:
@@ -392,6 +404,8 @@
 {
 	if (hal_device_has_capability (d, "hiddev"))
 		return "hald-probe-hiddev";
+	else if (hal_device_has_capability (d, "printer"))
+		return "hald-probe-printer";
 	else
 		return NULL;
 }
@@ -401,11 +415,24 @@
 {
 	gchar udi[256];
 
-	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-			      "%s_hiddev",
-			      hal_device_property_get_string (d, "info.parent"));
-	hal_device_set_udi (d, udi);
-	hal_device_property_set_string (d, "info.udi", udi);
+	if (hal_device_has_capability (d, "hiddev")) {
+		hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+				      "%s_hiddev",
+				      hal_device_property_get_string (d, "info.parent"));
+		hal_device_set_udi (d, udi);
+		hal_device_property_set_string (d, "info.udi", udi);
+	} else if (hal_device_has_capability (d, "printer")) {
+		char *serial;
+
+		serial = hal_device_property_get_string (d, "printer.serial");
+		hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+				      "%s_printer_%s",
+				      hal_device_property_get_string (d, "info.parent"),
+				      serial != NULL ? serial : "noserial");
+		hal_device_set_udi (d, udi);
+		hal_device_property_set_string (d, "info.udi", udi);
+	}
+
 	return TRUE;
 }
 




More information about the hal-commit mailing list