Skip to contentSkip to conversation

DEVNAME not set when executing udev rule

DISCUSSION Stefan Conrad 2 participants 2 messages Sep 3, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to initialise a MidiSport USB interface with a udev rule that triggers fxload to upload the firmware:

ACTION="add", SUBSYSTEM="usb", DEVPATH="/*.0", ENV{PRODUCT}="763/1001/*", RUN+="/sbin/fxload -v -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport2x2.ihx -D $env{DEVNAME}"

The problem:
DEVNAME is not set in the environment.
Only DEVICE is set with the 'wrong' device file name under /proc/bus/usb
which is deprecated and thus not useful.

System: Suse 11.1 Linux 2.6.27.29-0.1-default #1 SMP 2009-08-15 17:53:59 +0200 i686 athlon i386 GNU/Linux
udev Version: 128

What can I do to pass a valid device file name to fxload to upload the firmware?

Thanks,

Stefan

#1 lore raw
Quoted 4 lines · Stefan Conrad

I am trying to initialise a MidiSport USB interface with a udev rule that triggers fxload to upload the firmware:

ACTION="add", SUBSYSTEM="usb", DEVPATH="/*.0",

Better use KERNEL="*.0". Matching on the DEVPATH is in most cases wrong.

Quoted 6 lines

ENV{PRODUCT}="763/1001/*", RUN+="/sbin/fxload -v -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport2x2.ihx -D $env{DEVNAME}"

The problem:
DEVNAME is not set in the environment.

The rule matches on USB devices _and_ interfaces and runs several times. You better limit it to the device only with:
ENV{DEVTYPE}="usb_device".

Quoted 2 lines

Only DEVICE is set with the 'wrong' device file name under /proc/bus/usb  which is deprecated and thus not useful.

There is a known timing problem with the usb device nodes, and this should fix it:
http://git.kernel.org/?p=linux/kernel/git/gregkh/patches.git;a=blob;f=driver-core/driver-core-add-new-device-to-bus-s-list-before-probing.patch;hb=HEAD

Kay