[cups] Autoselect correct PPD on Mac OS X?

Julian Daniel jdaniel at smcdsb.on.ca
Thu Jun 23 19:21:35 PDT 2016


How does CUPS determine the correct PPD to use with the autoselect feature
in Mac OS X's Add Printer dialog box under Printers & Scanners in System
Preferences?

I have around 100 Xerox copiers at ~50 sites, all connected to a WAN.

If I connect directly with the printer by entering the IP address, the
correct PPD is selected pretty much every time with every version of Mac OS
X.

If I connect to a central CUPS server, which has the same printer correctly
defined with the proper PPD, things get very flaky. On Mac OS X 10.11, it
seems to just work. I have intermittent results with Mac OS X 10.6-10.10,
with some clients managing to get the correct PPD but most get "Generic
Postscript Printer".

I tried a packet capture, and it appears that the client first queries the
central print (CUPS) server, then talks directly to the printer itself. The
CUPS server provides all the necessary details required to set up the
printer on the client, but then the client asks the printer for ".ppd", and
the printer responds with a "no such file". I'm not sure whether this is
the reason, but then the client (Mac OS X 10.9.5 in this case) selects the
default Generic Postscript Printer PPD - even though the exact same PPD
returned in the IPP response from the CUPS server matches one installed on
the client already (this is the one that is autoselected when the client
connects directly to the printer).

I've listed the relevant four packets below, in case they help understand
what's happening:

Frame 1776: 161 bytes on wire (1288 bits), 161 bytes captured (1288 bits)
Ethernet II, Src: Apple_xx:xx:xx (Masked:xx:xx:xx), Dst: MySwitch_xx:xx:xx
(Masked:xx:xx:xx)
Internet Protocol Version 4, Src: 10.246.140.218, Dst: 10.199.10.73
Transmission Control Protocol, Src Port: 49228 (49228), Dst Port: 631
(631), Seq: 323, Ack: 1, Len: 95
[6 Reassembled TCP Segments (417 bytes): #1771(200), #1772(8), #1773(29),
#1774(37), #1775(48), #1776(95)]
Hypertext Transfer Protocol
    POST /printers/CEC295Q HTTP/1.1\r\n
    Content-Length: 217\r\n
    Content-Type: application/ipp\r\n
    Host: elemprtsrv01.smcdsb.mynet:631\r\n
    User-Agent: CUPS/1.7.2 (Darwin 13.4.0; x86_64) IPP/2.0\r\n
    Expect: 100-continue\r\n
    \r\n
    [Full request URI: http://elemprtsrv01.smcdsb.mynet:631/printers/CEC295Q
]
    [HTTP request 1/2]
    [Response in frame: 1784]
Internet Printing Protocol
    Version: 2.0
    Operation-id: Get-Printer-Attributes (0x000b)
    Request ID: 4
    Operation attributes
        attributes-charset: utf-8
        attributes-natural-language: en-us
        printer-uri: ipp://localhost/printers/CEC295Q
        requested-attributes: device-uri
    End of attributes

Frame 1784: 91 bytes on wire (728 bits), 91 bytes captured (728 bits)
Ethernet II, Src: MySwitch_xx:xx:xx (Masked:xx:xx:xx), Dst: Apple_xx:xx:xx
(Masked:xx:xx:xx)
Internet Protocol Version 4, Src: 10.199.10.73, Dst: 10.246.140.218
Transmission Control Protocol, Src Port: 631 (631), Dst Port: 49228
(49228), Seq: 1, Ack: 418, Len: 25
Hypertext Transfer Protocol
    HTTP/1.1 100 Continue\r\n
    \r\n
    [HTTP response 1/2]
    [Time since request: 0.002785000 seconds]
    [Request in frame: 1776]
    [Next response in frame: 1799]

Frame 1799: 1167 bytes on wire (9336 bits), 1167 bytes captured (9336 bits)
Ethernet II, Src: MySwitch_xx:xx:xx (Masked:xx:xx:xx), Dst: Apple_xx:xx:xx
(Masked:xx:xx:xx)
Internet Protocol Version 4, Src: 10.199.10.73, Dst: 10.246.140.218
Transmission Control Protocol, Src Port: 631 (631), Dst Port: 49228
(49228), Seq: 8066, Ack: 418, Len: 1101
[10 Reassembled TCP Segments (9141 bytes): #1786(200), #1788(1448),
#1789(169), #1790(1448), #1791(367), #1794(1448), #1795(1448), #1797(1448),
#1798(64), #1799(1101)]
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
    Date: Thu, 23 Jun 2016 15:44:32 GMT\r\n
    Server: CUPS/1.5\r\n
    Connection: Keep-Alive\r\n
    Keep-Alive: timeout=30\r\n
    Content-Language: en_US\r\n
    Content-Type: application/ipp\r\n
    Content-Length: 8941\r\n
    \r\n
    [HTTP response 2/2]
    [Prev request in frame: 1776]
    [Prev response in frame: 1784]
Internet Printing Protocol
    Version: 2.0
    Status-code: Successful (Successful-OK)
    Request ID: 4
    Operation attributes
        attributes-charset: utf-8
        attributes-natural-language: en-us
    Printer attributes
        marker-change-time: Jun 23, 2016 09:19:05 EDT
        printer-current-time: 07e006170f2c20002b0000
        printer-dns-sd-name: CEC-295 2nd Floor Copier Q @ ADM-073
Elementary Print Server
        printer-error-policy: retry-job
        printer-error-policy-supported: abort-job
        printer-icons: http://10.199.10.73:631/icons/CEC295Q.png
        printer-is-accepting-jobs: true
        printer-is-shared: true
        printer-more-info: http://10.199.10.73:631/printers/CEC295Q
        printer-op-policy: default
        printer-state: Idle
        printer-state-change-time: Jun 23, 2016 09:19:05 EDT
        printer-state-message: Ready to print.
        printer-state-reasons: none
        printer-type: 8433876
        printer-up-time: Jun 23, 2016 11:44:32 EDT
        printer-uri-supported: ipp://10.199.10.73:631/printers/CEC295Q
        queued-job-count: 0
        uri-authentication-supported: requesting-user-name
        uri-security-supported: none
        printer-name: CEC295Q
        printer-location: Outside Room 201
        printer-info: CEC-295 2nd Floor Copier Q
        printer-uuid: urn:uuid:01234567-abcd-abcd-abcd-0123456789ab
        job-quota-period: 0
        job-k-limit: 0
        job-page-limit: 0
        auth-info-required: none
        job-sheets-default: none
        device-uri: ipp://10.246.19.22/ipp/
        marker-colors: #000000
        marker-levels: 66
        marker-low-levels: 10
        marker-high-levels: 100
        marker-names: Toner Bottle CRU
        marker-types: toner
        document-format-supported: application/octet-stream
        copies-default: 1
        document-format-default: application/octet-stream
        job-hold-until-default: no-hold
        job-priority-default: 50
        number-up-default: 1
        notify-lease-duration-default: 86400
        notify-events-default: job-completed
        print-quality-default: 4
        color-supported: false
        pages-per-minute: 55
        print-quality-supported: 4
        printer-make-and-model: Xerox WorkCentre 5955, 3.80
        media-default: na_letter_8.5x11in
        media-col-default:
        media-supported: na_letter_8.5x11in
        media-source-supported: tray1
        media-type-supported: auto
        media-bottom-margin-supported: 529
        media-left-margin-supported: 529
        media-right-margin-supported: 529
        media-top-margin-supported: 529
        output-bin-supported: face-down
        output-bin-default: face-down
        output-mode-supported: monochrome
        output-mode-default: monochrome
        print-color-mode-supported: monochrome
        print-color-mode-default: monochrome
        printer-resolution-default: 000002580000025803
        printer-resolution-supported: 000002580000025803
        sides-supported: one-sided
        sides-default: two-sided-long-edge
        printer-commands: ReportStatus
        port-monitor: none
        port-monitor-supported: none
        finishings-supported: 3
        finishings-default: 3
        charset-configured: utf-8
        charset-supported: us-ascii
        compression-supported: none
        copies-supported: 000000010000270f
        cups-version: 1.5.4
        generated-natural-language-supported: en-us
        ipp-versions-supported: 1.0
        ippget-event-life: 15
        job-creation-attributes-supported: copies
        job-hold-until-supported: no-hold
        job-ids-supported: true
        job-k-octets-supported: 0000000005ca6e28
        job-priority-supported: 100
        job-settable-attributes-supported: copies
        job-sheets-supported: none
        jpeg-k-octets-supported: 0000000005ca6e28
        jpeg-x-dimension-supported: 000000000000ffff
        jpeg-y-dimension-supported: 000000010000ffff
        media-col-supported: media-bottom-margin
        multiple-document-handling-supported:
separate-documents-uncollated-copies
        multiple-document-jobs-supported: true
        multiple-operation-time-out: 300
        natural-language-configured: en-us
        notify-attributes-supported: printer-state-change-time
        notify-lease-duration-supported: 000000007fffffff
        notify-max-events-supported: 100
        notify-events-supported: job-completed
        notify-pull-method-supported: ippget
        notify-schemes-supported: mailto
        number-up-supported: 1
        operations-supported: 2
        orientation-requested-supported: 3
        page-ranges-supported: true
        pdf-k-octets-supported: 0000000005ca6e28
        pdf-versions-supported: adobe-1.2
        pdl-override-supported: attempted
        printer-op-policy-supported: authenticated
        printer-settable-attributes-supported: printer-info
        server-is-sharing-printers: true
        which-jobs-supported: completed
    End of attributes

Frame 1807: 223 bytes on wire (1784 bits), 223 bytes captured (1784 bits)
Ethernet II, Src: Apple_xx:xx:xx (Masked:xx:xx:xx), Dst: MySwitch_xx:xx:xx
(Masked:xx:xx:xx)
Internet Protocol Version 4, Src: 10.246.140.218, Dst: 10.246.19.22
Transmission Control Protocol, Src Port: 49229 (49229), Dst Port: 631
(631), Seq: 1, Ack: 1, Len: 157
Hypertext Transfer Protocol
    GET /ipp/.ppd HTTP/1.1\r\n
    Host: 10.246.19.22:631\r\n
    If-Modified-Since: Sun, 25 Jun 4461702 20:03:32 GMT\r\n
    User-Agent: CUPS/1.7.2 (Darwin 13.4.0; x86_64) IPP/2.0\r\n
    \r\n
    [Full request URI: http://10.246.19.22:631/ipp/.ppd]
    [HTTP request 1/1]
    [Response in frame: 1809]

Frame 1809: 446 bytes on wire (3568 bits), 446 bytes captured (3568 bits)
Ethernet II, Src: MySwitch_xx:xx:xx (Masked:xx:xx:xx), Dst: Apple_xx:xx:xx
(Masked:xx:xx:xx)
Internet Protocol Version 4, Src: 10.246.19.22, Dst: 10.246.140.218
Transmission Control Protocol, Src Port: 631 (631), Dst Port: 49229
(49229), Seq: 1, Ack: 158, Len: 380
Hypertext Transfer Protocol
    HTTP/1.1 404 Not Found\r\n
    Date: Thu, 23 Jun 2016 15:42:52 GMT\r\n
    Server: Apache\r\n
    X-Frame-Options: SAMEORIGIN\r\n
    Content-Length: 206\r\n
    Content-Type: text/html; charset=iso-8859-1\r\n
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.003537000 seconds]
    [Request in frame: 1807]
Line-based text data: text/html


I can't figure out how the Client's CUPS works out the PPD to use - I
noticed that the printer's Bonjour/DNS-SD output includes:

product=(Xerox WorkCentre 5955)
ty=Xerox WorkCentre 5955 v1


which matches the PPD on "product" but not on "ty[pe]" - here is the output
when shared from the CUPS server:

product=(Xerox WorkCentre 5955)
ty=Xerox WorkCentre 5955, 3.80


and that is exactly what's contained in the Product and Nickname lines in
the PPD, so they should be a match - why isn't the client seeing this:

*Manufacturer: "Xerox"
*ModelName: "Xerox WorkCentre 5955"
*ShortNickName: "Xerox WorkCentre 5955"
*Product: "(Xerox WorkCentre 5955)"
*NickName: "Xerox WorkCentre 5955, 3.80"


I've also created Wide Area Bonjour entries in DNS with exactly the same
data output by the server, however it seems that anything stated in my
entries is ignored by the client - it just queries the server and then the
printer itself, and only uses the _ipp._tcp (and cups and universal)
entries to find the server.

Can please you help me figure out what's missing, or how I can change my
config so that the client pays attention to the CUPS server and either
downloads the PPD from the server or uses a previously-installed version on
the local drive (/Library/Printers/PPD/Contents/Resources/)?

And why does it work some of the time, or only on specific OSes?

Julian Daniel
Simcoe Muskoka CDSB

-- 
This is a staff email account managed by Simcoe Muskoka Catholic District 
School Board.  This email and any files transmitted with it are 
confidential and intended solely for the use of the individual or entity to 
whom they are addressed. If you have received this email in error please 
notify the sender.



More information about the cups mailing list