Multiple printers

Hi,
I have a router with OpenWRT 19.07 that I want to use as a print server to connect two printers.
I have installed and configured p910nd and both printers are working correctly. One (Brother DCP-7060D) in /dev/usb/lp0 with port 9100 and the other (Brother QL-570) in /dev/usb/lp1 with port 9101.
The problem comes when restarting the router, which sometimes recognizes them backwards and stops working. I found the following article:

but I can't get it to work. I don't know if I'm doing something wrong or if, being quite old, it no longer works in version 19.07.
Can someone tell me how I can solve this problem?

Thank you so much.

Can you upgrade OpenWrt to 23.05? 19.07 has been unsupported since 2022.

There are six steps in the article you linked. At which part did it not work?


It appears that the script is scraping the output of dmesg to figure out which printer is which. But dmesg messages are meant to be read by humans and not scripts, so if the format changes in any way it can break the script's logic.

That being said, there appears to be some serious typos here:

LP=`dmesg  grep -i "usblp.: USB Bidirectional printer dev .* if .* alt .* proto .* vid 0x$VID pid 0x$PID"  grep -io "lp[0-9]"  tail -n 1`

I'm pretty sure the author meant to use the pipe operator | between the four subcommands, like so:

LP=$(dmesg | grep -i "usblp.: USB Bidirectional printer dev .* if .* alt .* proto .* vid 0x$VID pid 0x$PID" | grep -io "lp[0-9]" | tail -n 1)

(Also note the use of $(command) instead of backticks, which is the preferred syntax for command substitution.)

Ok, I updated to 23.05.
The problem has to be in the script because before creating it the printers work correctly configured as:

/dev/usb/lp0 y /dev/usb/lp1

The problem is that this way there are times when it takes the ports upside down and I can no longer print. I can solve it by always turning on the printers in the same order, but I have to turn on the one on lp0 even if I only want to print on lp1...

I have created the script again with the indicated modification, but I can't get it to work either.
I have noticed that, in version 23.05 the DCP-7060D printer, although I change /dev/usb/lp0 to /dev/dcp7060d (as it is in the script) when restarting the router it automatically becomes /dev/usb/lp0 . It is as if it recognizes the printer that is connected.
The problem is that the same does not happen with the QL-570 printer...

I don't know where to go...