Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: robf355 on August 09, 2017, 12:12:56 PM

Title: usb printers swapping ports
Post by: robf355 on August 09, 2017, 12:12:56 PM
Hi
I have two shared printers both on usb ports:
epsonwf7610    epson a3 printer    usb/lp1
okic5750    OKI Laser Printer    usb/lp0

I haven't used the epson for a few weeks so it hasn't been turned on, this morning I turned on the epson first then the oki, and found that the usb ports had been swapped round, resulting in a very long print out of postscript data on the epson!
I thought that once a device was allocated a usb port linux would always give it the same device name, but they seem to be allocated first come first served, which causes problems with the samba allocation. Does anyone know if there is a way to stop this happening.

Regards
Rob
Title: Re: usb printers swapping ports
Post by: robf355 on August 09, 2017, 02:13:48 PM
update:
I managed to add a persistant port name using a udev rule:
ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", ATTRS{manufacturer}=="OKI DATA CORP", ATTRS{idProduct}=="019a", ATTRS{serial}=="AE98021826", SYMLINK+="usb/lpoki"

ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", ATTRS{manufacturer}=="EPSON", ATTRS{idProduct}=="08b9", ATTRS{serial}=="533948593033373505", SYMLINK+="usb/lpepson"

But could someone tell me where I edit the printer port allocation for sme, the add printer window only offers me first and second usb printers, i.e it isn't looking at all the devices in dev/usb
Title: Re: usb printers swapping ports
Post by: Jean-Philippe Pialasse on August 15, 2017, 08:21:53 PM
Hi
I have two shared printers both on usb ports:
epsonwf7610    epson a3 printer    usb/lp1
okic5750    OKI Laser Printer    usb/lp0

I haven't used the epson for a few weeks so it hasn't been turned on, this morning I turned on the epson first then the oki, and found that the usb ports had been swapped round, resulting in a very long print out of postscript data on the epson!
I thought that once a device was allocated a usb port linux would always give it the same device name, but they seem to be allocated first come first served, which causes problems with the samba allocation. Does anyone know if there is a way to stop this happening.

Regards
Rob

well this sound to me like a bug you just hit, either because this behaviour is new to SME9, either because nobody has configured more than 1 usb printer and or never switch them off...



update:
I managed to add a persistant port name using a udev rule:
ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", ATTRS{manufacturer}=="OKI DATA CORP", ATTRS{idProduct}=="019a", ATTRS{serial}=="AE98021826", SYMLINK+="usb/lpoki"

ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", ATTRS{manufacturer}=="EPSON", ATTRS{idProduct}=="08b9", ATTRS{serial}=="533948593033373505", SYMLINK+="usb/lpepson"

But could someone tell me where I edit the printer port allocation for sme, the add printer window only offers me first and second usb printers, i.e it isn't looking at all the devices in dev/usb

this is a nice workaround, and this would allow also to improve the option to only set 2 or less usb printers as currently. this would also need a bu as NFR.

The web interface does not allow to put something else than first or second usb printer which is converted to usb/lp1 or usb/lp2. As a NFR we could change the dropdown box that offers only 2 usb options, with usb, which would lead to another page where you can enter the manufacturer and serial of the printer and would simply create a usb/$name link (where name is the okic5750 or epsonwf7610 in your case).


However, for your immediate use, you could try to edit the database :
Code: [Select]
db accounts setprop epsonwf7610 Location usb/lpepson
db accounts setprop okic5750 Location usb/lpoki
expand-template /etc/printcap

my guess is that it should do it.