Fedora Linux Support Community & Resources Center
  #1  
Old 14th November 2007, 11:05 PM
duni
Guest
 
Posts: n/a
strange udev behavior - cannot properly RUN+= within the udev environment

I will summarize quickly and then describe in details:
Summary:
On boot when the printer is turned on udev uploads the firmware and printing is fine. In the started linux environment I can manually upload the firmware and printing is fine. When the printer is restarted udev uploads the firmware, the printer indicates that, but I can't print - in /var/log/messages I get -"error -110 reading printer status".

With all details:
I use a HP1018 printer with a properly yum-installed foo2zjs driver and manually downloaded firmware copied in "/usr/share/foo2zjs/firmware/sihp1018.dl".
The firmware has to be loaded on printer start (before printing) with
cat /usr/share/foo2zjs/firmware/sihp1018.dl > /dev/usb/lp0
and it all works great after this step. In order to automate the process I load the firmware with udev rule:
/etc/udev/rules.d/51-hp1018-firmware.rules
Code:
# udev rule for uploading the HP1018 firmware
# the ATTR{dev}=="180:0" should be enough in order not to confuse the HP1018 with some other HP printer
# Note that the KERNEL and NAME keys haven't been used, because in this way 50-udev.rules performs its rules on lp0, usb/lp0, par0, etc. and the 51-hp1018-firmware.rules is used as well) 

SUBSYSTEM=="usb", ATTR{dev}=="180:0", RUN+="/usr/bin/hp1018-load-firmware"
and the script /usr/bin/hp1018-load-firmware
Code:
LIMIT=9
for printer in /sys/class/usb/lp* ; do
        output=$(udevinfo -a -p $printer | grep 'ATTR{dev}=="180:0"') 
        if [ ! -z "$output" ]; then
                devpath="/dev${printer:10}"
                echo "found HP1018 on $devpath, uploading firmware"
                cat /usr/share/foo2zjs/firmware/sihp1018.dl > $devpath
        fi
done
exit
The rule detects the printer every time - on startup and after that. I can clearly see that, because when a firmware is loaded, the printer "reinitializes" - performing its mechanical startup routines.
And I end up like that:
-> If I don't use the rule and run the script manually after I've started the printer everything is ok. I can start/restart the printer and manually execute the script every time - it's ok.
-> If the printer is started and I reboot/boot up the computer with the udev rule activated, the firmware is being uploaded and when fedora starts printing is ok.
(Note that in the both cases above if a previous firmware was loaded it's being overwritten and there is no problem with that)
-> if I start/restart the printer with fedora already running and I use the udev rule the firmware is being loaded but I can't print -> in /var/log/messages I get "usblp error -110 reading printer status" but CUPS marks all jobs as completed. I can't upload the firmware manually - although /dev/usb/lp0 isn't used by any process, when I "cat..." the firmware the terminal "freezes" with no error message, I have to Ctrl+C to get back.
(Note that if I comment only the "cat /usr/share/foo2zjs/firmware/sihp1018.dl > $devpath" line in the script, restart the printer and execute it manually "cat /usr/share/foo2zjs/firmware/sihp1018.dl > /dev/usb/lp0" everything is fine again!)

So my question is: What could provoke this weird udev behavior, and is there something about udev rules in runtime that I'm missing?

Last edited by duni; 14th November 2007 at 11:07 PM.
Reply With Quote
  #2  
Old 26th November 2007, 10:57 PM
yyovkov Offline
Registered User
 
Join Date: Sep 2005
Posts: 8
on fedora 8 ...

Hi duni,
I am running Fedora 8 and I try to setup HPLJ1018 in your way, but I have some troubles. When I restart the printer (switch off and switch on) udev failed to execute "/usr/bin/hp1018-load-firmware" script.
Do you have any idea?

Here is (atached: udev-debug.txt) a debug messages from udevd when I am starting up the printer. I hope you can give me an idea.
Attached Files
File Type: txt udev-debug.txt (17.2 KB, 109 views)
Reply With Quote
Reply

Tags
behavior, environment, properly, run, strange, udev

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange SELinux errors on udev-event egurski Security and Privacy 7 15th June 2007 03:14 AM
Odd udev behavior in FC5 juergen.fiedler Hardware & Laptops 1 14th June 2006 10:20 PM
Odd udev behavior in FC5 juergen.fiedler Hardware & Laptops 0 14th June 2006 10:17 PM
udev for fc4 WhyTea Using Fedora 0 8th September 2005 12:07 AM


Current GMT-time: 16:51 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat