Bug 660

Summary: GetPrinterList doesn't return printer descriptions on Solaris
Product: xprint Reporter: Alan Coopersmith <alan.coopersmith>
Component: Server: Spooler support: OtherAssignee: Roland Mainz <roland.mainz>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: highest    
Version: unspecified   
Hardware: SPARC   
OS: Solaris   
URL: http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4376961
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Patch against older version of xc/programs/Xserver/Xprint/Init.c
none
Proposed patch for 2004-06-12-trunk
alan.coopersmith: review+
Patch for checkin none

Description Alan Coopersmith 2004-05-23 06:01:00 UTC
[Originally reported as Sun bug id #4376961 against the Solaris Xprint.]

The Solaris print system provides printer descriptions via the command 
"lpget -k description printername(s)".  The Solaris Xprint server should
return these printer descriptions in the description field of the
GetPrinterList response.
Comment 1 Alan Coopersmith 2004-05-23 06:07:12 UTC
Created attachment 313 [details] [review]
Patch against older version of xc/programs/Xserver/Xprint/Init.c

This is the patch that was added to the Solaris 9 Xprint source to add this
support.  The code in the open source release has diverged a bit since
then to add support for other spooling systems, so if you actually want this 
to be integrated into the current Xprint, it would need to be reworked to fit 
into the current source (and hopefully to produce better error messages than
this
does, as noted in http://freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=660
).
Comment 2 Roland Mainz 2004-05-27 08:11:35 UTC
Nice work... :)
Do you know whether CUPS and LPRng have similar ways to fetch the descriptions
of a printer ?
Comment 3 Roland Mainz 2004-06-08 13:15:24 UTC
I see a small problem with this statement:
-- snip --
-        name[strlen(name) - 1] = (char)'\0'; /* strip the \n */
-        AddPrinterDbName(name);
+       desc = strchr(name, '\t');
+       
+       if (desc) {
+           *(desc++) = '\0';
+           if (*desc == '\0') {
+               desc = NULL;
+           }
+       }
+        name[namelen - 1] = (char)'\0'; /* strip the \n */
+        AddPrinterDbName(name,desc);
-- snip --
If I read this right the new code uses the format "${name}<tab>${description}",
right ?

What about using "${name}<tab>xp-desc=${description}" - that would allow custom
scripts to provide more attributes (like the model-config name, e.g.
"xp-model-identifier=${mode-config-name}") in the future (e.g. the mechanism
would be extensible) ?
Comment 4 Roland Mainz 2004-06-09 16:57:22 UTC
Comment on attachment 313 [details] [review]
Patch against older version of xc/programs/Xserver/Xprint/Init.c

I found a more or elss fatal flaw in the patch:
A "descriptor" set in the model-config overrides the "descriptor" set via this
patch. 
And since all mode-config's (at least those from HP and those from
xprint.mozdev.org, incl. "PSdefault") set that attribute the functionality
becomes a NO-OP... ;-(
Comment 5 Roland Mainz 2004-06-09 16:58:06 UTC
s/more or elss/more or less/
Comment 6 Roland Mainz 2004-06-12 12:27:50 UTC
Created attachment 365 [details] [review]
Proposed patch for 2004-06-12-trunk
Comment 7 Roland Mainz 2004-06-12 12:28:53 UTC
Comment on attachment 365 [details] [review]
Proposed patch for 2004-06-12-trunk

Requesting r= from alan... :)
Comment 8 Roland Mainz 2004-06-23 23:24:31 UTC
Created attachment 415 [details] [review]
Patch for checkin

Final patch for checkin, incl. ChangeLog entry (and the bogus copyright notice
has been removed from spooler.h).
Comment 9 Roland Mainz 2004-06-23 23:27:15 UTC
Patch checked-in...

/cvs/xorg/xc/ChangeLog,v  <--  ChangeLog
new revision: 1.71; previous revision: 1.70
/cvs/xorg/xc/programs/Xserver/Xprint/Init.c,v  <--  Init.c
new revision: 1.6; previous revision: 1.5
/cvs/xorg/xc/programs/Xserver/Xprint/spooler.c,v  <--  spooler.c
new revision: 1.3; previous revision: 1.2
Mailing the commit message to xorg-commit@pdx.freedesktop.org...

... marking bug as FIXED.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.