[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

CUPS - how to match autodetected printers to physical ones



If you don't want to read the background information, the question is:

How is one *supposed* to figure out which autodetected printer is the
correct one, apart from trial and error?

==========================================================================

Today I had to print something at work (on site).  This happens roughly
once a year.

There is one physical printer in my work area.  That I know of.  However,
the network is much larger than my single work area.  It spans many
floors of many buildings.

So, when I got there, I logged into my Debian 11 box, and ran "lpstat -t"
to see if I already had a default printer set up.  I did not.  However,
lpstat -t gave me a list of several autodetected printers.

"Aha," I thought.  "All I have to do is figure out which one of the
autodetected printers on this list has the same IP address as the printer
that I can see and touch over there."

Unfortunately, I was not able to find ANY way to determine the IP
addresses of the autodetected printers that were presented to me.
I tried a few Google searches, but almost all of the results I got were
ass-backwards.  They kept trying to teach me how to learn the IP address
of my printer.  (The other search results simply didn't work.)

But I already KNEW the IP address of the printer.  It's on a piece of
paper that's attached to the front of the printer.  I could ping the IP
address.  I could look up the IP address in /usr/sbin/arp and get the
MAC address of the printer too.  I even had an entry in *my* DNS subdomain
that mapped a name to this IP address.

None of that helped me in any way.

Next, I Googled the port number for the CUPS web interface, because for
some reason "grep cups /etc/services" gives nothing.  (Turns out it's 631.
I can never remember it, because I only have to deal with it once every
year or two or three.)

I went into the CUPS web interface, and tried to get *it* to tell me
the IP addresses of the autodetected printers that it clearly knows about.

I could not find anything in the CUPS web interface that would show me
an IP address for a single printer.

Some of the printers had three hex bytes in their names, like
"Canon_LBP712Cdn_db_c0_d3_".

"Perhaps," I thought, "these hex digits are the right-hand side of a MAC
address."

Unfortunately, no, none of the hex digits on the ends of these printer
names matched any part of the MAC address of the printer.  I have no
idea *what* they are.

"Perhaps," I thought, "this printer name is an entry in one of the
corporate DNS domains."

Unfortunately, no, I could not find Canon_LBP712Cdn_db_c0_d3_ with or
without the trailing _ in either of the two corporate DNS domains that
I know of.

So the next thing I tried was matching the printer's brand and model
against the names in the list, to see which one was the closest match.
According to the piece of paper on the front of the printer, it was
a Canon LBP 712 Cdn printer.  So, naturally, I thought that the
autodetected printer named Canon_LBP712Cdn_db_c0_d3_ might be the
right one.

So I sent a test page to it.

Nothing happened, that I could see.  Certainly no paper emerged from the
physical printer.

One of the light-buttons on top of the printer was lit up.  Sticking my
head into the cabinet so that I could see what the hell the button labels
said, it turns out the printer was in energy saving mode.  I found some
buttons and pressed them and eventually got it into "ready mode", or
whatever it's called.

Still, nothing happened.

I sent a second test page to it.

And still, nothing happened.

At this point I was starting to get really frustrated.  I kept searching
Google and typing random commands and clicking random things in the CUPS
web interface, trying to figure out HOW TO FIGURE OUT which printer is
which.

Nothing worked.  There was NO WAY to tell which printer was which!

There is simply no way, discoverable by me, that I can tell CUPS "Hey, I
have the IP address of a printer that you should already know about.
Tell me which printer that you already know about has this IP address."

I even tried ADDING a new printer to CUPS, using the IP address.  I
have no idea how to do this, so I clicked random shit trying to make it
work.  I selected "ipp" because it sounded like the least-frills
option.  It said that I had to construct a URL for my printer, and it
gave many examples, like ipp://hostname/port1 and so on, but it did not
tell me HOW TO FIGURE OUT what URL I should give.

So I gave it ipp://10.76.172.100 and tried to print a test page to it.

It didn't work.  No paper came out of the printer.

It kept saying the job was being processed, and that it was "connecting
to printer" (or "connected"?).  It kept giving me a larger and larger
page count for the single test page.  After it told me the page count
was 300-something, I canceled the job.

At this point, I had completely run out of ideas.  All I was left with
was TRIAL AND ERROR.

Since the autodetected printer whose name precisely matched the physical
printer's brand and model didn't work, I went with the printer that
was the second closest match.  I sent a test page to it.

THAT one worked.  A piece of paper emerged from the printer, with ink
markings on it.  They looked reasonably correct.

So I told CUPS to make this printer the system default, and printed
the single-page document I needed to print, and left.

After I left, I pondered whether I could have determined which printer
it was by disconnecting the network cable from it, waiting a bit, and
seeing which printer showed up as "not working" in the CUPS list.  But
I didn't try that, and it sounds a bit risky.

After all this, I have two final comments:

1) To whomever received two surprise printer test pages: sorry.
2) I FUCKING HATE PRINTERS!

And I have one question:

How is one *supposed* to figure out which autodetected printer is the
correct one, apart from trial and error?


Reply to: