Hi All,
I try convert TP-MR3220v2 into usb printers server.
it had limited flash so extroot is necessary.
i have two printer epson L1800 and epson L310. Both on usb.
So the setup:
router - 4 port usb hub - flaskdisk + L1800 + L310
the system boot up and detect both /dev/usb/lp0 and /dev/usb/lp1
p910nd work fine too
BUT the lp0 or lp1 will not always match the correct printer
I find a partial solution from :
https://www.qualityology.com/tech/add-multiple-usb-printers-to-openwrt-firmware-router-via-p910nd-using-hotplug/
WARNING! the script on that page have error. it seem when the author put it on the web, the "pipe sign" or "|" got filter out
I edit it :
#!/bin/sh
# process USB and parallel printers only
if [ "$INTERFACE" = "7/1/1" ] || [ "$INTERFACE" = "7/1/2" ]
then
# set -x
DEV="none"
# Brother HL2140
if [ "$PRODUCT" = "4f9/33/100" ]
then
VID="04f9"
PID="0033"
DEV="hl2140"
fi
# Zebra LP2442
if [ "$PRODUCT" = "1645/6/100" ]
then
VID="1645"
PID="0006"
DEV="lp2442"
fi
if [ "$DEV" != "none" ]
then
if [ "$ACTION" = "add" ] || [ "$ACTION" = "bind" ]
then
# search for last printer assignment using dmesg
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`
if [ "$LP" != "" ]
then
echo $LP >/var/run/$DEV.lp
ln -s /dev/usb/$LP /dev/$DEV
fi
fi
if [ "$ACTION" = "remove" ]
then
# LP = `cat /var/run/$DEV.lp`
rm /var/run/$DEV.lp
rm /dev/$DEV
fi
fi
fi
Doing "hot" plugging and unplugging both printer... the script does it task.
but went the router reboot... "coldplug" parsing (which i read being run by procd) did not happen for usb
in OpenWRT HotPlug user guide, at the bottom part of the page, mention coldplug for openwrt 18.0
does it mean only 18.x and above can do coldplug?
thank you for your help...