2

When we want to add a printer to mac, we go to "Printers and Scanners" in system preferences. There we click on "+" button and click on "Add Printer or Scanner". In new dialog with title "Add", we see a list of printers.

When we select one of the printer: printer-x, we see status: "Gathering printer information...". And its driver is automatically selected. How is Mac gathering printer information? What is this whole process of adding a printer in details? Is there any tutorial/article that can help? I have tried google search, could not find something of good interest yet.

I want to debug a situation where Mac is choosing driver for a printer sometime and sometimes it does not (for the same printer). Expected driver to see there is AirPrint. The printer is being added from a print server. So, want to have a look at what is happening in the background.

2

After carefully looking at the DNSCache and Network:

More details on dns-sd.org however in short, for everything to work correctly, following four DNS Records for each printer are needed on client side in case of airprint/secure airprint:

  • PTR record of type _universal._sub._ipp/ipps._tcp (lets call it universal): needed only if printer is airprint compatible (see dns-sd.org)

  • PTR record of type _ipp/ipps._tcp (lets call it ipps)

  • SRV record

  • TXT record

SRV record tells about the service related data (server/port etc.) and TXT record tells about the printer capabilities.

On Mac, "ipps" and "universal" records are queried by different processes (printtool and PKBrowserServic respectively). From observation: Queries of "universal" records by PKBrowserServic are more frequent than queries of "ipps" records by printtool. So, in a scenario: it has universal records but not ipps, it won't identify the driver.

To answer the original question: when a printer is selected, it queries for SRV and TXT record (based on universal or ipps records which are in cache already, thats how we see the printer in the list). If printer/print server is not available or if ipps record is missing, mac won't be able to do 'Auto Select' for the driver.

This problem can be fixed in multicast by self-querying both universal and ipps before TTL of the records expire so that the caches of all mac clients are updated.

In case of unicast, mac has high TTL of universal/ipps records, so it might take some time for ipps record to be updated in the cache in a new network but in few minutes (max 10 mins from observation), it has both ipps and universal and the issue does not exist anymore. Another way to handle it quickly is to clear cache (sierra: killall -HUP mDNSResponder)

0

If the printer supports IPP or IPPS (the Internet Printing Protocol), macOS sends an IPP query to the print device to ask for all the features it supports.

Based on the device's response, it sets up the print queue (by auto-generating a PPD file, PostScript Printer Description) so that the available job options are listed in the user interface of the print dialog.

You can simulate this query and see the respective responses by printers with the help of two command line programs which you can start from the terminal: ippfind and ipptool.

First, run ippfind

ippfind [ENTER]

This will return a list of all IPP-capable print devices (or shared CUPS print queues) in the LAN and WLAN you are connected to. The list will include the IPP device URI which can be used to address the print device.

Second, run ipptool

Now you can use the IPP device URI found in the previous step to send a Get-Printer-Attributes query to the print device or print queue:

ipptool -t -v                 \
    <IPP-DEVICE-URI>          \
    get-printer-attributes.test

You can now see the response for the query in your terminal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .