hal/hald/linux2/probing probe-printer.c,1.6,1.7

Kay Sievers kay at kemper.freedesktop.org
Mon Apr 17 07:59:53 PDT 2006


Update of /cvs/hal/hal/hald/linux2/probing
In directory kemper:/tmp/cvs-serv25874/hald/linux2/probing

Modified Files:
	probe-printer.c 
Log Message:
2006-04-17  Kay Sievers  <kay.sievers at vrfy.org>

        Add printer command set returned by 1284 query.
        "Each key will have at least one value, and may have more than one
         value. The minimum necessary keys (case-sensitive) are MANUFACTURER,
         COMMAND SET, and MODEL. (These keys may be abbreviated as MFG, CMD,
         and MDL respectively.) Each implementation will supply these three
         keys and possibly additional ones as well"
        http://www.longrange.net/ParallelPort/1284d12.pdf

        * doc/spec/hal-spec.xml.in:
        * hald/linux2/probing/probe-printer.c: (main):


Index: probe-printer.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-printer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- probe-printer.c	2 Nov 2005 15:38:14 -0000	1.6
+++ probe-printer.c	17 Apr 2006 14:59:51 -0000	1.7
@@ -61,6 +61,7 @@
 	char *model;
 	char *serial;
 	char *desc;
+	char *cmd;
 
 	fd = -1;
 
@@ -97,6 +98,7 @@
 	model = NULL;
 	serial = NULL;
 	desc = NULL;
+	cmd = NULL;
 
 	dbg ("device_id = %s", device_id + 2);
 
@@ -120,6 +122,10 @@
 			desc = *iter + 4;
 		else if (strncmp (*iter, "DESCRIPTION:", 12) == 0)
 			desc = *iter + 12;
+		else if (strncmp (*iter, "COMMAND SET:", 12) == 0)
+			cmd = *iter + 12;
+		else if (strncmp (*iter, "CMD:", 4) == 0)
+			cmd = *iter + 4;
 	}
 
 	dbus_error_init (&error);
@@ -141,6 +147,13 @@
 		libhal_device_set_property_string (ctx, udi, "printer.description", desc, &error);
 	}
 
+	if (cmd != NULL) {
+		char **cmdset = g_strsplit (cmd, ",", 0);
+		for (iter = cmdset; *iter != NULL; iter++)
+			libhal_device_property_strlist_append (ctx, udi, "printer.commandset", *iter, &error);
+		g_strfreev (cmdset);
+	}
+
 	g_strfreev (props);
 
 	ret = 0;




More information about the hal-commit mailing list