printer: export commandset returned by IEEE-1284 ID

Kay Sievers kay.sievers at vrfy.org
Thu Apr 6 16:56:59 PDT 2006


People asked to export this.

Thanks,
Kay
-------------- next part --------------
Index: doc/spec/hal-spec.xml.in
===================================================================
RCS file: /cvs/hal/hal/doc/spec/hal-spec.xml.in,v
retrieving revision 1.69
diff -u -r1.69 hal-spec.xml.in
--- doc/spec/hal-spec.xml.in	10 Mar 2006 18:46:16 -0000	1.69
+++ doc/spec/hal-spec.xml.in	6 Apr 2006 23:44:09 -0000
@@ -3743,6 +3743,12 @@
               <entry>Yes</entry>
               <entry>TODO</entry>
             </row>
+            <row>
+              <entry><literal>printer.commandset</literal> (strlist)</entry>
+              <entry></entry>
+              <entry>No</entry>
+              <entry>List of supported commands / printer languages.</entry>
+            </row>
 
           </tbody>
         </tgroup>
Index: hald/linux2/probing/probe-printer.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-printer.c,v
retrieving revision 1.6
diff -u -r1.6 probe-printer.c
--- hald/linux2/probing/probe-printer.c	2 Nov 2005 15:38:14 -0000	1.6
+++ hald/linux2/probing/probe-printer.c	6 Apr 2006 23:44:09 -0000
@@ -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,8 @@
 			desc = *iter + 4;
 		else if (strncmp (*iter, "DESCRIPTION:", 12) == 0)
 			desc = *iter + 12;
+		else if (strncmp (*iter, "CMD:", 4) == 0)
+			cmd = *iter + 4;
 	}
 
 	dbus_error_init (&error);
@@ -141,6 +145,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 mailing list