From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jasem Mutlaq" Date: Wed, 15 Oct 2008 12:05:12 +0000 Subject: RE: Loading firmware Message-Id: <000901c92ebe$49975c10$dcc61430$@com> List-Id: References: <003c01c92d81$89978710$9cc69530$@com> In-Reply-To: <003c01c92d81$89978710$9cc69530$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org > SUBSYSTEM=3D"usb", ACTION=3D"add", ENV{DEVTYPE}=3D"usb_device", > NAME=3D"bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE=3D"0644" Yes, this is exactly what I have in 50-udev-default.rules. > I suspect you'll end up with something like this (make sure it runs > somewhere after the above rule that sets the name): >=20 > SUBSYSTEM=3D"usb", ACTION=3D"add", ENV{DEVTYPE}=3D"usb_device", > ATTR{idVendor}=3D"xxxx", ATTR{idProduct}=3D"yyyy", RUN+=3D"/sbin/fxload -I > /lib/firmware/foo.hex -D $env{DEVNAME}" I tried that, and now the rule wouldn't even apply. It seems that DEVTYPE= =3D"usb_device" is not handled correctly. If I remove this condition, the r= ule is applied. I have one file 99-sbig.rules which has the following: SUBSYSTEM=3D"usb", ACTION=3D"add", SYSFS{idVendor}=3D"0d97", SYSFS{idProduc= t}=3D"0001", ENV{DEVTYPE}=3D"usb_device", \ RUN+=3D"/sbin/fxload -I /lib/firmware/sbigucam.hex -D $env{DEVNAME}" I don't understand why DEVTYPE is not caught, I ran udev monitor and got th= e following when I plugged my USB cam: --------------------------------- EVENT[1224070564.432382] add /devices/pci0000:00/0000:00:07.2/usb1/1-1= (usb) ACTION=ADd = =20 DEVPATH=3D/devices/pci0000:00/0000:00:07.2/usb1/1-1 = =20 SUBSYSTEM=3Dusb = =20 MAJOR=189 = =20 MINOR$ = =20 DEVTYPE=3Dusb_device = =20 DEVICE=3D/proc/bus/usb/001/025 = =20 PRODUCT=D97/1/1 = =20 TYPE%5/255/255 = =20 BUSNUM=001 = =20 DEVNUM=025 = =20 SEQNUM=1460 = =20 UEVENT[1224070564.434702] add /devices/pci0000:00/0000:00:07.2/usb1/1-= 1/usb_endpoint/usbdev1.25_ep00 (usb_endpoint) ACTION=ADd = =20 DEVPATH=3D/devices/pci0000:00/0000:00:07.2/usb1/1-1/usb_endpoint/usbdev1.25= _ep00 =20 SUBSYSTEM=3Dusb_endpoint = =20 MAJOR%3 = =20 MINOR=3D4 = =20 SEQNUM=1461 = =20 UEVENT[1224070564.435629] add /devices/pci0000:00/0000:00:07.2/usb1/1-= 1/1-1:1.0 (usb) ACTION=ADd DEVPATH=3D/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0 SUBSYSTEM=3Dusb DEVTYPE=3Dusb_interface DEVICE=3D/proc/bus/usb/001/025 PRODUCT=D97/1/1 TYPE%5/255/255 INTERFACE%5/255/255 MODALIAS=3Dusb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF SEQNUM=1462 UDEV [1224070564.443609] add /devices/pci0000:00/0000:00:07.2/usb1/1-= 1/usb_endpoint/usbdev1.25_ep00 ( UDEV_LOG=3D7 ACTION=ADd DEVPATH=3D/devices/pci0000:00/0000:00:07.2/usb1/1-1/usb_endpoint/usbdev1.25= _ep00 SUBSYSTEM=3Dusb_endpoint MAJOR%3 MINOR=3D4 SEQNUM=1461 UDEVD_EVENT=3D1 DEVNAME=3D/dev/usbdev1.25_ep00 UDEV [1224070564.462839] add /devices/pci0000:00/0000:00:07.2/usb1/1-= 1/1-1:1.0 (usb) UDEV_LOG=3D7 ACTION=ADd DEVPATH=3D/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0 SUBSYSTEM=3Dusb DEVTYPE=3Dusb_interface DEVICE=3D/proc/bus/usb/001/025 PRODUCT=D97/1/1 TYPE%5/255/255 INTERFACE%5/255/255 MODALIAS=3Dusb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF SEQNUM=1462 UDEVD_EVENT=3D1 --------------------------------------------------------------------- If I remove the ENV{DEVTYPE}=3D"usb_device" from the rule, I can use $env{D= EVICE} since it's the closest thing to what I need, albeit it's under /proc= and that doesn't work, I need /dev/bus/usb/XXX/YYY. Of course, DEVNAME eva= luates to /dev/usbdev1.25_ep00 which is useless. At any rate, here is what I get in /var/log/messages ---------------------------------------------------------------------- Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: new full speed USB device using= uhci_hcd and address 25 =20 Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: configuration #1 chosen from 1 = choice =20 Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: New USB device found, idVendor 97, idProduct=0001 =20 Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: New USB device strings: Mfr=3D0= , Product=3D0, SerialNumber=3D0 =20 Oct 15 14:36:04 linux-j3lx udevd[552]: msg_queue_insert: seq 1460 queued, '= add' 'usb' =20 Oct 15 14:36:04 linux-j3lx udevd[552]: udev_event_run: seq 1460 forked, pid= [4658], 'add' 'usb', 0 seconds old = =20 Oct 15 14:36:04 linux-j3lx udevd[552]: msg_queue_insert: seq 1461 queued, '= add' 'usb_endpoint' =20 Oct 15 14:36:04 linux-j3lx udevd[552]: msg_queue_insert: seq 1462 queued, '= add' 'usb' =20 Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_rules_get_name: rule app= lied, '1-1' becomes 'bus/usb/001/025' = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_db_get_device: no db fil= e to read /dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:07.2\x2fusb1\x= 2f1-1: No such file or directory =20 Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_node_add: creating devic= e node '/dev/bus/usb/001/025', major=189, minor$, mode=0660, uid=3D0, gid= =3D0 =20 Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_node_mknod: atomically r= eplace '/dev/bus/usb/001/025' =20 Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_node_mknod: mknod(/dev/b= us/usb/001/025.udev-tmp, 020660, 189, 24) failed: Operation not permitted = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_event_run: seq 1460 fini= shed with -1 =20 Oct 15 14:36:04 linux-j3lx udevd[552]: udev_done: seq 1460, pid [4658] exit= with 1, 0 seconds old =20 Oct 15 14:36:04 linux-j3lx udevd[552]: udev_event_run: seq 1461 forked, pid= [4659], 'add' 'usb_endpoint', 0 seconds old = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_rules_get_name: no node = name set, will use kernel name 'usbdev1.25_ep00' = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_db_get_device: no db fil= e to read /dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:07.2\x2fusb1\x= 2f1-1\x2fusb_endpoint\x2fusbdev1.25_ep00: No such file or directory = = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_node_add: creating devic= e node '/dev/usbdev1.25_ep00', major%3, minor=3D4, mode=0660, uid=3D0, gid= =3D0 =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: name_index: creating index: '= /dev/.udev/names/usbdev1.25_ep00/\x2fdevices\x2fpci0000:00\x2f0000:00:07..2= \x2fusb1\x2f1-1\x2fusb_endpoint\x2fusbdev1.25_ep00' =20 Oct 15 14:36:04 linux-j3lx udevd-event[4660]: run_program: '/sbin/modprobe = usb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF' = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: pass_env_to_socket: passed 27= 2 bytes to socket '/org/freedesktop/hal/udev_event', = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: pass_env_to_socket: passed 27= 2 bytes to socket '@/org/kernel/udev/monitor', = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_event_run: seq 1461 fini= shed with 0 =20 Oct 15 14:36:04 linux-j3lx udevd[552]: udev_event_run: seq 1462 forked, pid= [4660], 'add' 'usb', 0 seconds old = =20 Oct 15 14:36:04 linux-j3lx udevd[552]: udev_done: seq 1461, pid [4659] exit= with 0, 0 seconds old =20 Oct 15 14:36:04 linux-j3lx udevd-event[4660]: run_program: '/sbin/modprobe'= (stderr) 'FATAL: Module usb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF not = found.' =20 Oct 15 14:36:04 linux-j3lx udevd-event[4660]: run_program: '/sbin/modprobe'= returned with status 1 =20 Oct 15 14:36:04 linux-j3lx udevd-event[4660]: pass_env_to_socket: passed 33= 5 bytes to socket '/org/freedesktop/hal/udev_event', = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4660]: pass_env_to_socket: passed 33= 5 bytes to socket '@/org/kernel/udev/monitor', = =20 Oct 15 14:36:04 linux-j3lx udevd-event[4660]: udev_event_run: seq 1462 fini= shed with 0 =20 Oct 15 14:36:04 linux-j3lx udevd[552]: udev_done: seq 1462, pid [4660] exit= with 0, 0 seconds old =20 ---------------------------------------------------------------------------= ------------------------------ Notice that despite the default rule in 50-udev-default.rules (NAME=3D"bus/= usb/$env{BUSNUM}/$env{DEVNUM}"), the log says: udev_rules_get_name: no node name set, will use kernel name 'usbdev1.25_ep0= 0' Btw, I get the same results in Fedora 9 and openSUSE 11, so it doesn't appe= ar to be distro-specific. Any insights appreciated! Cheers, Jasem