6

For example I have "HP 1020 LaserJet" local USB printer successfully installed on a CUPS.

It uses one connection.

If I get another HP 1020 LaserJet printer it wouldn't print, I am having to modify the printer and change it's connection. Why?

How can I avoid this?

I know that it's illogical to use the same type printer on the same computer, but that's my environment.

How to make CUPS to use the same Connection for all printers of the same type, model, manufacturer etc.?

Thank you!!!

EDIT:

I have found out that it's not possible through the configs or any other standard ways.

The only way is to find a nice workaround.

3
  • Unfortunately, I have no idea how to solve this, but here's what I suspect to be the problem: grep DeviceURI /etc/cups/printers.conf yields DeviceURI hp:/usb/HP_LaserJet_1020?serial=XXXXXXX. The serial probably is printer-specific (not model-specific); don't know if it works without... – sr_ Feb 19 '12 at 10:33
  • right, and the serials are different per each printer. There is also an UUID which is also unique but I think they are not printer specific - just random. – bakytn Feb 19 '12 at 10:59
  • I tried to omit serial parameter - no print :D – bakytn Feb 20 '12 at 4:41
4

The fix is in the UDEV rule.

Since it is not possible through standard ways.

You just create an UDEV rule which would detect printer adding and then run lpadmin -p PRINTERNAME -v CONNECTION?serial=

so printer would be automatically reconfigured to use another connection.

P.S: I would give 300 of points if someone gave me right direction. I hope I will get my 300 back now :D

0

I had the same problem on my raspberry pi while working on a Kiosk application. I found a possible solution, following the possible steps (the printer I am using is CUSTOM TG2460, in this case):

  1. Run lpinfo -v which returns the list of devices attached.
network https
file cups-brf:/
direct vnc:/
network ipp
network beh
network ipps
network socket
network lpd
network http
direct hp
direct usb://CUSTOM%20SPA/TG2460-H?serial=TG2460-H_NUM:_0
direct hpfax
network dnssd://HP%20LaserJet%20200%20color%20M251n%20(E9A2D9)._ipp._tcp.local/?uuid=564e4333-4230-3339-3439-a0d3c1e9a2d9
network dnssd://XEROX%20WorkCentre%203335%20(XRX9C934E79F15F)._printer._tcp.local/
network socket://192.168.10.12
network socket://192.168.10.123
network ipp://VodafonePS.local:631/ipp/print
network ipp://NPIE9A2D9.local:631/ipp/print
  1. Filter for the line containing the printer you want and extract the device URI with grep and cut.
lpinfo -v | grep usb://CUSTOM | cut -d ' ' -f 2
>>> usb://CUSTOM%20SPA/TG2460-H?serial=TG2460-H_NUM:_0
  1. Add the URI to the existing printer, updating the CUPS entry
lpadmin -p PRINTER_NAME -v usb://CUSTOM%20SPA/TG2460-H?serial=TG2460-H_NUM:_0

All can be summarized in this one liner:

lpadmin -p PRINTER_NAME -v $(lpinfo -v | grep usb://PRINTER_MODEL | cut -d ' ' -f 2)

I then run the command at each reboot. If a new printer is attached, the user must reboot the kiosk. I think you can easily bind this to a UDEV rule and run when something changes on the printer that you want to swap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.