You are not logged in.
I need the system to do
# modprobe usblp && sleep 5 && modprobe -r usblp
automatically when I turn on HP laserjet 1018. How can I do it?
Offline
Why? I have HP LaserJet 1018 and it works fine without doing this (I've blacklisted usblp module in /etc/rc.conf).
Offline
Well, I have
MODULES=(fuse !usblp)
in rc.conf and I need to do that command when I turn on the printer and the PC is already running. Otherwise it won't print.
Offline
The answer to the question is with udev rules. However, there should be a solution to your problem rather than the workaround with usblp. I seem to remember the same problem, with a LaserJet 1005 (which I think is very similar to the 1018), around the time of a major CUPS upgrade. The issue was with permissions on /dev/bus/usb/XXX/XXX, which needed 0664 permissions and root:lp ownership. The following saved as /etc/udev/rules.d/10-printer.rules solved it for me:
SUBSYSTEMS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1317", GROUP:="lp", MODE:="0664"
Offline
OK, so I added this to /etc/udev/rules.d/11-hplj10xx.rules and now it looks like this:
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="0517", RUN+="/sbin/foo2zjs-loadfw 1000 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="1317", RUN+="/sbin/foo2zjs-loadfw 1005 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4117", RUN+="/sbin/foo2zjs-loadfw 1018 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="2b17", RUN+="/sbin/foo2zjs-loadfw 1020 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="3d17", RUN+="/sbin/foo2zjs-loadfw P1005 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="3e17", RUN+="/sbin/foo2zjs-loadfw P1006 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4817", RUN+="/sbin/foo2zjs-loadfw P1007 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4917", RUN+="/sbin/foo2zjs-loadfw P1008 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="3f17", RUN+="/sbin/foo2zjs-loadfw P1505 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4017", RUN+="/sbin/foo2zjs-loadfw P1505n $tempnode"
SUBSYSTEMS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1317", GROUP:="lp", MODE:="0664"
but when I turn on the printer, it doesn't do what it should do... Is there anything else I should do?
Last edited by Mr. Alex (2010-12-04 20:48:56)
Offline
You are a member of the lp group?
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Yep.
$ groups
disk lp wheel log network video audio optical storage users lpadmin
Offline
It appears you are using the idProduct of the 1005 model. From that the rest of the file it appears that you should use SYSFS{idProduct}=="4117" for the HP LaserJet 1018. You can double check the product id by using 'lsusb' with the printer plugged in, the printer entry will have be "ID 03f0:xxxx", where xxxx is the product id.
Last edited by kwirkie (2010-12-09 22:15:31)
Offline
Yes, the id is correct.
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 03f0:4117 Hewlett-Packard LaserJet 1018
...
The file now looks like
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="0517", RUN+="/sbin/foo2zjs-loadfw 1000 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="1317", RUN+="/sbin/foo2zjs-loadfw 1005 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4117", RUN+="/sbin/foo2zjs-loadfw 1018 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="2b17", RUN+="/sbin/foo2zjs-loadfw 1020 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="3d17", RUN+="/sbin/foo2zjs-loadfw P1005 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="3e17", RUN+="/sbin/foo2zjs-loadfw P1006 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4817", RUN+="/sbin/foo2zjs-loadfw P1007 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4917", RUN+="/sbin/foo2zjs-loadfw P1008 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="3f17", RUN+="/sbin/foo2zjs-loadfw P1505 $tempnode"
ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
ATTRS{idProduct}=="4017", RUN+="/sbin/foo2zjs-loadfw P1505n $tempnode"
SUBSYSTEMS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="4117", GROUP:="lp", MODE:="0664"
Then I rebooted the PC and now the printer still doesn't work without that command in the first post.
Last edited by Mr. Alex (2010-12-12 20:52:07)
Offline
Maybe put that rule into a separate lower-numbered file, so that the permissions are changed before the foo2zjs-loadfw command is called?
Offline
What file should it be?
Offline
/etc/udev/rules.d/10-hp1018.rules, for example - the file are processed in numerical order
Offline
# ls -l /etc/udev/rules.d/10-hp1018.rules
-rw-rw-rw- 1 root root 95 Dec 17 00:31 /etc/udev/rules.d/10-hp1018.rules
# cat /etc/udev/rules.d/10-hp1018.rules
SUBSYSTEMS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="4117", GROUP:="lp", MODE:="0664"
Is this correct?
And it doesn't help... Still the printer doesn't print after turning it on.
Offline