View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-28-2008, 01:58 PM   #1
LQ Newbie
Registered: May 2008
Posts: 5

Rep: Reputation: 0
loading firmware on USB device with udev


I am trying to use udev to load the firmware into a usb device that I have. The device is a high speed analog to digital converter. I was given the rule and script from somebody (who is no longer around so I cannot ask him). In the rule the RUN command is issued(shown below)

1) how can I tell if the script is being called when udevruns ?

The path to the device varies when I connect the device :


When run udevtest it requires the path to the device

priceless:/home/jprice # ls /dev/bus/usb/003
001 016

priceless:/home/jprice # udevtest /dev/usb/bus/003
unable to open device '/dev/usb/bus/003'

I know one issue is figuring out why the device cannot be opened even
if the path is manually specified. Permission is not an issue. I run as root.

But the other issue is how can udev know what x and y are when it runs ?

(if I know what x and why are I can specify the full path to the device in the RUN command in the rule)

A) My rule file contains :

SUBSYSTEM=="usb", SYSFS{idVendor}=="1605", SYSFS{idProduct}=="8001", RUN+="/usr/share/usb/ --chmod --8001"

B)the script is

It looks like he exected $DEVICE to be set already be set but am not sure where. I think he may have thought it was set by udev.

#This script should work for all ACCES USB devices being produced at the time it was written.

echo performing operation: $1
echo performing on device: $DEVICE


#This script should work for all ACCES USB devices being produced at the time it was written.
#A special thanks go to David Mattes (mattes AT for providing a really simple version
#that this was built off of

echo performing operation: $1
echo performing on device: $DEVICE

if [ $1 == "--load" ]
case $2 in
"--8001") hexfile="/usr/share/usb/atod.hex";;
"--0010") hexfile="/usr/share/usb/atod.hex";;
"--0001") hexfile="/usr/share/usb/atod.hex";;
"--4001") hexfile="/usr/share/usb/atod.hex";;
"--0020") hexfile="/usr/share/usb/atod.hex";;
"--0040") hexfile="/usr/share/usb/atod.hex";;
"--0030") hexfile="/usr/share/usb/atod.hex";;
*) hexfile="invalid";;
echo $hexfile
echo "attempting to fxload firmware"
`/sbin/fxload -t fx2 -D $DEVICE -I $hexfile`

if [ $1 == "--chmod" ]
chmod 0666 $DEVICE

C) when I run udevmonitor I see :

UEVENT[1225215075.017604] add@/devices/pci0000:00/0000:00:02.1/usb3/3-2
UEVENT[1225215075.017766] add@/devices/pci0000:00/0000:00:02.1/usb3/3-2/usbdev3.15_ep00
UEVENT[1225215075.017787] add@/devices/pci0000:00/0000:00:02.1/usb3/3-2/3-2:1.0
UEVENT[1225215075.017806] add@/class/usb_device/usbdev3.15
UDEV [1225215075.070469] add@/devices/pci0000:00/0000:00:02.1/usb3/3-2
UDEV [1225215075.100957] add@/devices/pci0000:00/0000:00:02.1/usb3/3-2/usbdev3.15_ep00
UDEV [1225215075.179352] add@/devices/pci0000:00/0000:00:02.1/usb3/3-2/3-2:1.0
UDEV [1225215075.224303] add@/class/usb_device/usbdev3.15

Thank You for help

Old 10-29-2008, 07:49 AM   #2
Senior Member
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
So the manufacturer hasn't updated the driver to use the kernel's firmware loader feature?

Anyway, what names do you expect in 'DEVICE'? It is obviously an environment variable, but you need to set that somehow - for example, something like this inside your udev rule:



Old 11-09-2008, 11:50 PM   #3
LQ Newbie
Registered: May 2008
Posts: 8

Rep: Reputation: 0
thank you Pinniped , it works !

Thank You Pinniped !

Your suggestion solved it. I really appreciate it, and learned a bit about udev as well.

Just a small note :

I had to use $attr{busnum} $attr{devnum}

rather than $env(BUSNUM} $env{DEVNUM}

I am using : Redhat - Fedora release 9 (Sulphur)



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: Upgrade Plextor Firmware with UDEV and pxupdate How-to Thoreau LinuxAnswers Discussion 15 05-14-2008 01:10 PM
udev not called to remove open USB serial device tm007 Programming 3 09-24-2007 08:46 AM
Debian + IVTV 0.7 + udev = firmware issues bc8o8 Linux - Hardware 1 08-24-2006 08:09 PM
Upgrade Plextor Firmware with UDEV & pxupdate :How-to Thoreau Linux - Hardware 2 04-18-2005 04:20 AM
Loading firmware on boot ? lamiroy Linux - Software 1 03-24-2005 12:36 PM

All times are GMT -5. The time now is 10:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration