Hi,
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 accessloader.sh script from somebody (who is no longer around so I cannot ask him). In the rule the RUN command is issued(shown below)
- how can I tell if the script is being called when udevruns ?
The path to the device varies when I connect the device :
/dev/bus/usb/00x/00y
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/accesloader.sh --chmod --8001"
B)the script accesloader.sh 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.
#!/bin/sh
#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
#!/bin/sh
#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 nixnux.org) for providing a really simple version
#that this was built off of
echo performing operation: $1
echo performing on device: $DEVICE
if $1 == “–load” ]
then
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”;;
esac
echo $hexfile
echo “attempting to fxload firmware”
/sbin/fxload -t fx2 -D $DEVICE -I $hexfile
fi
if $1 == “–chmod” ]
then
chmod 0666 $DEVICE
fi
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