FS#9935 - hlplip - HP USB printer not detected after last udev update(s)
Attached to Project:
Arch Linux
Opened by David Spicer (azleifel) - Monday, 24 March 2008, 21:11 GMT
Last edited by Greg (dolby) - Monday, 21 July 2008, 22:47 GMT
Opened by David Spicer (azleifel) - Monday, 24 March 2008, 21:11 GMT
Last edited by Greg (dolby) - Monday, 21 July 2008, 22:47 GMT
|
Details
Description:
As a consequence of one or the other of the last two udev updates, 118-5 -> 118-7 or 118-7 -> 119-1, (sorry for the lack of precision but the last time I used my printer was a week ago) my HP Photosmart D6160 USB printer was no longer being detected, i.e. there was no device node in /dev/bus/usb. The first fix I tried, which was to edit /etc/udev/rules.d/55-hpmud.rules and change every instance of SYSFS to ATTRS in line with the udev changes information in readme-udev-arch.txt, worked. Additional info: * hplip 2.8.2-2 Steps to reproduce: Just trying to print. |
This task depends upon
Rule that matches my printer:
ATTR{idVendor}=="03f0", ATTR{idProduct}=="5611", OWNER="root", GROUP="lp", MODE="0666"
Here is what I do:
1. Turn on printer
2. Turn on computer
3. "ls -l /dev/bus/usb/002/..." returns "crw-rw-rw- 1 root lp 189, 150 (...)"
4. Turn off printer
5. Turn on printer.
6. "ls -l /dev/bus/usb/002/..." returns "crw-r--r-- 1 root root 189, 151 (...)"
7. Turn off printer
8. Change udev rule from:
ATTR{idVendor}=="03f0", ATTR{idProduct}=="5611", OWNER="root", GROUP="lp", MODE="0666"
To:
ATTR{idProduct}=="5611", OWNER="root", GROUP="lp", MODE="0666"
9. udevadm control --reload_rules
10. Turn on printer
11. "ls -l /dev/bus/usb/002/..." returns "crw-rw-rw- 1 root lp 189, 152 (...)"
I've checked out attributes with "udevinfo --attribute-walk --name=/dev/bus/usb/(...)" and ATTR{idVendor} is displayed correctly there.
Matching by other attributes like ATTR{idProduct}, ATTR{serial}, ATTR{product} works, only ATTR{idVendor} is broken (but it does work during bootup). Permissions for /dev/usbdev* are always set correctly, only permissions for /dev/bus/usb/* are affected.
In the end, just replacing SYSFS with ATTRS in the rules file and reloading with udevadm worked for me.
So:
- udev starts up (/etc/start_udev) ==> rule matches
- udev is running => matching by ATTR{idVendor} and SYSFS{idVendor} is broken, rule does not match
1. If printer is online during system boot, rule matches.
2. If printer is online during system boot, and I turn it off and on later, rule does not match anymore.
3. If printer is offline during system boot, and I turn it on later, rule does not match.
4. If printer is offline during system boot, and I turn it on later, and there is no ATTR{idVendor} in that rule, rule matches.
5. If printer is offline during system boot, and I execute /etc/start_udev later, turn on printer, rule matches and everything is ok, matching by ATTR{idVendor} works.
isn't it the cause of the problem because 55-hpmud.rules use SYSFS instead of ATTRS ?
i notice the problem because i couldn't print.
the permission on /dev/usbdev2.6 are correct
crw-rw-rw- 1 root lp
but they are wrong for /dev/bus/usb/002/006
crw-r--r-- 1 root root
when i change them to
crw-rw-r-- 1 root lp
the printer begin to print the jobs that were in the queue and that couldn't be printed because of the permission problem
i have a photosmart C3180
ATTRS{idVendor}=="03f0" ATTRS{idProduct}=="5611"
Eventually I tracked the problem to the printer device (under /dev/usb/00x/00y) having permissions set to 440 and owner set to root:root.
I peeked in /etc/udev/rules.d and found hpmud.rules. I was unable to get udev to set the right permissions until I replaced the whole rules file with:
ACTION=="add", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c202", GROUP:="lp", MODE:="0660"
Note that it still works with SYSFS, and that I used := instead of just = after GROUP and MODE. c202 is the id of my printer. HTH track down and solve the problem.
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
The -e option doesn't work with the klibc shell! Removing the '-e' (and rebuilding the initramfs) seems to solve the problem (at least with my camera and printer), i.e.:
echo '\000\000\000\000' > /proc/sys/kernel/hotplug
Maybe this error was masked in the past because start_udev was called again from /etc/rc.sysinit, which in the latest initscripts package is no longer the case.
But printf seems to work predictably, so that's a good suggestion. 'printf "\0\0\0\0\n"' outputs four null bytes followed by a newline (assuming that's what is wanted).
This was used for hotplugging before udev could do it or before the use of udev in 2.4 kernel.
i guess this is not needed now. but echo "" into it mgiht be enoguh
I see no reason to try to do complicated stuff like 4 zeros or null bytes.... unless there is a good reason for it. but i doubt.
About the original problem: Do we have the right (new) udev syntax in there now? SYSFS has been deprecated for quite a while in favor of ATTR and ATTRS.
it is a simple fix. (echo "") and i am using it for some time without any side effect.
but i see more and more people complaining about their printer not working ... and not knowing why.
May 25 19:14:01 darkstar udevd[1170]: lookup_user: specified user 'lp' unknown
May 25 19:14:02 darkstar udevd-event[1392]: node_symlink: rename(/dev/fb.udev-tmp, /dev/fb) failed: Is a directory
(I'd love to know why user 'lp' is unknown - she definitely exists!)