Bug 197267 - devd no longer matches kernel/ugen events
Summary: devd no longer matches kernel/ugen events
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-02 08:25 UTC by Vladimir
Modified: 2015-02-04 20:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2015-02-02 08:25:10 UTC
When I connect my USB printer an event appears something like 
ugen1.2 <Hewlett Packard> at usbus 1
Unfortunately I can not process any matches with this event. 
In system log it appears like kernel event, but devd does not want to process this event in any way I've try. 
I think it can be processed when ulpt driver is compiled and used, but i don't realy need it, because printer is working flawlessly without ulpt

Actually I am trying to implement firmware download in to the printer that looked like this in devd.conf

# firmware for HP Laserjet 1020 printer
attach 100 {
	 device-name "ulpt[0-9]+";
        match "vendor" "0x03f0";
        match "product" "0x2b17";
        action "cat /usr/local/share/foo2zjs/firmware/sihp1020.dl > /dev/$device-name";
       
};  

new implementaion should be 
 
# firmware for HP Laserjet 1020 printer
attach 100 {
	 device-name "ugen[0-9]+";
        match "vendor" "0x03f0";
        match "product" "0x2b17";
        action "cat /usr/local/share/foo2zjs/firmware/sihp1020.dl > /dev/usb/1.2.1";
       
};  

I've googled a lot and tried different methods also, no one works. I need to download firmware to the printer every time it connected / turned on
Comment 1 Vladimir 2015-02-02 16:57:08 UTC
Finally got it working.
I don't know but вумв restart does not have effect, reboot is required.
# hp
#   hp1020
notify 100 {
	match "system"		"USB";
	match "subsystem"	"DEVICE";
	match "type"		"ATTACH";
	match "vendor"		"0x03f0";
	match "product"		"0x2b17";
	action "cat /usr/local/share/foo2zjs/firmware/sihp1020.dl > /dev/usb/1.2.1";
};
Comment 2 Hans Petter Selasky freebsd_committer 2015-02-04 20:36:19 UTC
Hi,

Maybe using "dd if=XXX of=XXX bs=512" is better. What is the maxpacket size of the endpoint in question?

--HPS
Comment 3 Hans Petter Selasky freebsd_committer 2015-02-04 20:43:03 UTC
Hi,

I see in your action you hardcode the USB device. Use $cdev instead, and substitute the last digit!

action "dd if=/usr/local/share/foo2zjs/firmware/sihp1020.dl of=/dev/usb/1.2.1";

/dev/usb/1.2.1 can be obtained like this in the devd config file:

realpath /dev/$cdev | sed -e "s/\.0/.1/g"

Address 1.0 does not exist, so the last .0 will always be matched.

--HPS