Getting PPD info from iPrint (unsuccesful)

[Warning]Warning

This section is all about a failed attempt. It may contain useful information though.

A remote queue configured as 'Local Raw Printer' in CUPS makes it possible to send documents to that queue, but programs that can adjust their output to match printer capabilities cannot get all the information they need about the printer. (In fact, they hardly get any more than that it exists.) If we could get the PPD of the printer, we could improve on this situation.

From wiresharking iprntcmd commands on Lucid, where iPrint still works, it looks like iPrint clients get the PPD sent to them over IPP after posting a request with client-print-support-files-query and user-role set to special but guessable values in tags of type octetString. (Look up what to sniff for in RfC 2911, and practical hints in the IPP Implementer's Guide) Unfortunately, CUPS 1.5 doesn't support type octetString, but CUPS 1.6 does.

[Warning]Warning

This paragraph is pointless, because the newer ipptool isn't in the package. I'm leaving it here for reference.

CUPS 1.6 is avaliable from Arnulf Heimsbakk's PPA, so we add it and istall the new cups:


apprentice@pc:~$ sudo apt-add-repository ppa:arnulf-heimsbakk/work
You are about to add the following PPA to your system:
 Packages containing important patches for my work environment.
 More info: https://launchpad.net/~arnulf-heimsbakk/+archive/work
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring tmp/tmpwFnp8s/secring.gpg' created
gpg: keyring tmp/tmpwFnp8s/pubring.gpg' created
gpg: requesting key A1C014B2 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpwFnp8s/trustdb.gpg: trustdb created
gpg: key A1C014B2: public key "Launchpad PPA for Arnulf Heimsbakk" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
apprentice@pc:~$ sudo apt-get update
apprentice@pc:~$ sudo apt-get dist-upgrade -y

If all else fails, check out the source. I'm showing the complete list of commands I used here, because building failed, but I got enough built to have ipptool...

apprentice@pc:~$ svn co http://svn.cups.org/public/cups/trunk/ cups-trunk
apprentice@pc:~$ cd cups-trunk/
apprentice@pc:~/cups-trunk$ cd test/
apprentice@pc:~/cups-trunk/test$ make ipptool  #this fails because no Makefile
apprentice@pc:~/cups-trunk/test$ cd ..
apprentice@pc:~/cups-trunk$ autoconf
apprentice@pc:~/cups-trunk$ ./configure 
apprentice@pc:~/cups-trunk$ cd test
apprentice@pc:~/cups-trunk/test$ make ipptool   #This fails because no ../cups/libcups.so.2
apprentice@pc:~/cups-trunk/test$ cd ../cups/
apprentice@pc:~/cups-trunk/cups$ make libcups.so.2   # this fails because unused-result and -Wall is used
apprentice@pc:~/cups-trunk/cups$ cd ..
apprentice@pc:~/cups-trunk$ export CFLAGS="-Wno-unused-result"
apprentice@pc:~/cups-trunk$ ./configure
apprentice@pc:~/cups-trunk$ make  #fails, we need -Wno-shadow too
apprentice@pc:~/cups-trunk$ export CFLAGS="-Wno-unused-result -Wno-shadow"
apprentice@pc:~/cups-trunk$ ./configure && make
apprentice@pc:~/cups-trunk$ cd cups/
apprentice@pc:~/cups-trunk/cups$ make libcups.so.2  #Nothing to be done
apprentice@pc:~/cups-trunk/cups$ cd ../test
apprentice@pc:~/cups-trunk/test$ make ipptool
apprentice@pc:~/cups-trunk/test$ ls ipptool
ipptool

So now we can try the command, the static version, which happens to be compiled as well. We prefer it because we can be sure it uses the latest libraries. We

apprentice@pc:~/cups-trunk/test$ ./ipptool-static -IX ipp://iprint05.id.rug.nl/ipp/PRN104208 ~/ppdtry.ipp

When run with ppdtry.ipp:


{
  # The name of the test
  NAME "Printer State Inquiry"

  OPERATION Get-Printer-Attributes
  GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en-us
  ATTR uri printer-uri $uri
  ATTR name requesting-user-name $user
  ATTR octetString client-print-support-files-filter 'uri-scheme=ipp< os-type=linux-2.4< cpu-type=x86-32< natural-language=en-us< compression=deflate<'
  ATTR keyword requested-attributes
       printer-state,printer-state-reasons,printer-is-accepting-jobs,queued-job-count,printer-location,printer-info,printer-make-and-model,direct-print-enabled,gateway-command,allow-driver-update,iprint-client-config-info,client-print-support-files-supported

  STATUS successful-ok
  EXPECT client-print-support-files-supported OF-TYPE octetString
  DISPLAY client-print-support-files-supported
}
{
  NAME "Check Accepting Jobs"

  OPERATION Get-Printer-Attributes
  GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en-us
  ATTR uri printer-uri $uri
  ATTR name requesting-user-name $user
  ATTR keyword requested-attributes
       printer-is-accepting-jobs

  STATUS successful-ok
  EXPECT printer-is-accepting-jobs OF-TYPE boolean
  DISPLAY printer-is-accepting-jobs
}
{
  NAME "Hopefully Get PPD"

  OPERATION Get-Printer-Attributes
  GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en-us
  ATTR uri printer-uri $uri
  ATTR name requesting-user-name $user
  ATTR octetString client-print-support-files-query 'id=3&inf=ipp://iprint01.prn.mydomain.com/ids/driver_linux-2.4_x86-32_en/Ricoh%20Aficio%20MP%203351%20PXL&name=Ricoh Aficio MP 3351 PXL&time=1285677628&profile-name=&profile-time=0&profile-driver-version='
  ATTR octetString user-role 'id=3&inf=ipp://iprint01.prn.mydomain.com/ids/driver_linux-2.4_x86-32_en/Ricoh%20Aficio%20MP%203351%20PXL&name=Ricoh Aficio MP 3351 PXL&time=1285677628&profile-name=&profile-time=0&profile-driver-version='

  STATUS successful-ok
  EXPECT client-print-support-files-supported OF-TYPE octetString
}

      

the result is no PPD incoming, and the conversation looking wildly different from an actual iPrint conversation in WireShark.

I conclude that getting at the PPD this way is not feasible within a couple of days. I also suspect that using curl would take at least as long.