There is such a problem that in the config, printers are assigned to / dev / usb / lp0 and / dev / usb / lp1, and they suddenly change ports. This happens due to the fact that in Thinstation printers are connected according to the principle “who was the first to stand up - that and sneakers”, i.e. which one first boots - in addition, and / dev / usb / lp0.
In short, correct.
Here is part of the configuration of Thinstation responsible for
printers :
PRINTER_0_DEVICE=/dev/usb/lp0 PRINTER_0_NAME=HP2055 PRINTER_0_TYPE=U PRINTER_1_DEVICE=/dev/usb/lp1 PRINTER_1_NAME=HP2015 PRINTER_1_TYPE=U
We cannot bind the printer to the node (/ dev / usb / lp *), but we can create a fixed symlink, help us with this
udev , but first let us know how our printers are identified.
')
When printers are connected to the client, we run the following commands in turn:
udevadm info -a -n /dev/usb/lp0 | grep ATTRS{product} udevadm info -a -n /dev/usb/lp1 | grep ATTRS{product}
And we are looking for a suitable identifier in the exhaust, in our case
ATTRS {product} .
Create the
12-printer- local.rules file in
packages / base / etc / udev / rules.d and write the rules that create a symlink to the node for the printer model:
KERNEL=="lp*", ATTRS{product}=="HP LaserJet 2055", SYMLINK+="usb/hp2055" KERNEL=="lp*", ATTRS{product}=="HP LaserJet 2015", SYMLINK+="usb/hp2015"
The config will have to be redone by specifying a simlink device:
PRINTER_0_DEVICE=/dev/usb/hp2055 PRINTER_0_NAME=HP2055 PRINTER_0_TYPE=U PRINTER_1_DEVICE=/dev/usb/hp2015 PRINTER_1_NAME=HP2015 PRINTER_1_TYPE=U
We rebuild the image and now the print, no matter what node the device received, will go to the right printer. The number of rules depends on the zoo of printers.
A couple more examples of use:
1) if you have several types of printers: a bunch of HP LaserJet ***, Canon *** and some fiscal FPrint ***, then you can use several rules:
KERNEL=="lp*", ATTRS{product}=="*HP LaserJet*", SYMLINK+="usb/hp" KERNEL=="lp*", ATTRS{product}=="*Canon*", SYMLINK+="usb/cnn" KERNEL=="lp*", ATTRS{product}=="*FPrint*", SYMLINK+="usb/fp"
2) you have a lot of any printers, and the second printer is everywhere any fiscal FPrint ***, i.e. if the attribute contains FPrint, then the symlink fprint, all others receive a symlink print .:
KERNEL=="lp*", ATTRS{product}!="*FPrint*", SYMLINK+="usb/print" KERNEL=="lp*", ATTRS{product}=="*FPrint*", SYMLINK+="usb/fprint"