[ale] udev rules for USB

Chris Fowler cfowler at outpostsentinel.com
Thu Nov 21 17:41:20 EST 2013


I'm writing a udev rule that I want to run only when something is 
plugged into a USB port

*ACTION!="add", GOTO="end01"

BUS=="usb",RUN+="/lib/libexec/usb-load %b %s{idVendor} %s{idProduct}", 
$attr{idVendor}, $s{idProduct}

SUBSYSTEM!="net", BUS!="usb", GOTO="end01"

SYSFS{idProduct}=="9700", SYSFS{idVendor}=="0fe6",
KERNEL=="*", RUN+="/sbin/modprobe dm9601"

LABEL="end01"
*

My goal is to load the necessary modules on this system.  The problem is 
that the perl script 'usb-load' is not executed.   I can easily remove 
the BUS=="usb" part and have it run on all devices and it can look at 
devpath to see USB.  The problem is that this would be cpu intensive.   
I want it to execute whenever a usb-serial, usb-modem, or usb-storage 
device is attached.   In some cases the kernel does not know that a 
certain vId and pId is attached to a driver and I have to load it 
myself.  You see that example where I am having to load the dm9601 
driver for a usb-net device.   I see the same for usb-storage.  Some USB 
sticks the kernel loads usb-storage for some it does not know to. If I 
capture the vId and pId I can then look it up and load up the correct one.

Chris





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131121/a83be14f/attachment.html>


More information about the Ale mailing list