All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jasem Mutlaq" <mutlaqja@ikarustech.com>
To: linux-hotplug@vger.kernel.org
Subject: RE: Loading firmware
Date: Wed, 15 Oct 2008 12:05:12 +0000	[thread overview]
Message-ID: <000901c92ebe$49975c10$dcc61430$@com> (raw)
In-Reply-To: <003c01c92d81$89978710$9cc69530$@com>

> SUBSYSTEM="usb", ACTION="add", ENV{DEVTYPE}="usb_device",
> NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="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):
> 
> SUBSYSTEM="usb", ACTION="add", ENV{DEVTYPE}="usb_device",
> ATTR{idVendor}="xxxx", ATTR{idProduct}="yyyy", RUN+="/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="usb_device" is not handled correctly. If I remove this condition, the rule is applied. I have one file 99-sbig.rules which has the following:

SUBSYSTEM="usb", ACTION="add", SYSFS{idVendor}="0d97", SYSFS{idProduct}="0001", ENV{DEVTYPE}="usb_device", \
RUN+="/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 the following when I plugged my USB cam:

---------------------------------
EVENT[1224070564.432382] add      /devices/pci0000:00/0000:00:07.2/usb1/1-1 (usb)
ACTION­d                                                                        
DEVPATH=/devices/pci0000:00/0000:00:07.2/usb1/1-1                                 
SUBSYSTEM=usb                                                                     
MAJOR\x189                                                                         
MINOR$                                                                          
DEVTYPE=usb_device                                                                
DEVICE=/proc/bus/usb/001/025                                                      
PRODUCTÙ7/1/1                                                                   
TYPE%5/255/255                                                                  
BUSNUM\01                                                                        
DEVNUM\x025                                                                        
SEQNUM\x1460                                                                       

UEVENT[1224070564.434702] add      /devices/pci0000:00/0000:00:07.2/usb1/1-1/usb_endpoint/usbdev1.25_ep00 (usb_endpoint)
ACTION­d                                                                                                              
DEVPATH=/devices/pci0000:00/0000:00:07.2/usb1/1-1/usb_endpoint/usbdev1.25_ep00                                          
SUBSYSTEM=usb_endpoint                                                                                                  
MAJOR%3                                                                                                               
MINOR=4                                                                                                                 
SEQNUM\x1461                                                                                                             

UEVENT[1224070564.435629] add      /devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0 (usb)
ACTION­d
DEVPATH=/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
DEVICE=/proc/bus/usb/001/025
PRODUCTÙ7/1/1
TYPE%5/255/255
INTERFACE%5/255/255
MODALIAS=usb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF
SEQNUM\x1462

UDEV  [1224070564.443609] add      /devices/pci0000:00/0000:00:07.2/usb1/1-1/usb_endpoint/usbdev1.25_ep00 (
UDEV_LOG=7
ACTION­d
DEVPATH=/devices/pci0000:00/0000:00:07.2/usb1/1-1/usb_endpoint/usbdev1.25_ep00
SUBSYSTEM=usb_endpoint
MAJOR%3
MINOR=4
SEQNUM\x1461
UDEVD_EVENT=1
DEVNAME=/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=7
ACTION­d
DEVPATH=/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
DEVICE=/proc/bus/usb/001/025
PRODUCTÙ7/1/1
TYPE%5/255/255
INTERFACE%5/255/255
MODALIAS=usb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF
SEQNUM\x1462
UDEVD_EVENT=1
---------------------------------------------------------------------

If I remove the ENV{DEVTYPE}="usb_device" from the rule, I can use $env{DEVICE} 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 evaluates 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        
Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: configuration #1 chosen from 1 choice                          
Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: New USB device found, idVendor
97, idProduct\001            
Oct 15 14:36:04 linux-j3lx kernel: usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0       
Oct 15 14:36:04 linux-j3lx udevd[552]: msg_queue_insert: seq 1460 queued, 'add' 'usb'                      
Oct 15 14:36:04 linux-j3lx udevd[552]: udev_event_run: seq 1460 forked, pid [4658], 'add' 'usb', 0 seconds old                                                                                                        
Oct 15 14:36:04 linux-j3lx udevd[552]: msg_queue_insert: seq 1461 queued, 'add' 'usb_endpoint'             
Oct 15 14:36:04 linux-j3lx udevd[552]: msg_queue_insert: seq 1462 queued, 'add' 'usb'                      
Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_rules_get_name: rule applied, '1-1' becomes 'bus/usb/001/025'                                                                                                      
Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_db_get_device: no db file to read /dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:07.2\x2fusb1\x2f1-1: No such file or directory                                
Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_node_add: creating device node '/dev/bus/usb/001/025', major\x189, minor$, mode\x0660, uid=0, gid=0                                                                
Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_node_mknod: atomically replace '/dev/bus/usb/001/025'   
Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_node_mknod: mknod(/dev/bus/usb/001/025.udev-tmp, 020660, 189, 24) failed: Operation not permitted                                                                  
Oct 15 14:36:04 linux-j3lx udevd-event[4658]: udev_event_run: seq 1460 finished with -1                    
Oct 15 14:36:04 linux-j3lx udevd[552]: udev_done: seq 1460, pid [4658] exit with 1, 0 seconds old          
Oct 15 14:36:04 linux-j3lx udevd[552]: udev_event_run: seq 1461 forked, pid [4659], 'add' 'usb_endpoint', 0 seconds old                                                                                               
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'                                                                                           
Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_db_get_device: no db file to read /dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:07.2\x2fusb1\x2f1-1\x2fusb_endpoint\x2fusbdev1.25_ep00: No such file or directory                                                                                                        
Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_node_add: creating device node '/dev/usbdev1.25_ep00', major%3, minor=4, mode\x0660, uid=0, gid=0                                                                 
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'              
Oct 15 14:36:04 linux-j3lx udevd-event[4660]: run_program: '/sbin/modprobe usb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF'                                                                                             
Oct 15 14:36:04 linux-j3lx udevd-event[4659]: pass_env_to_socket: passed 272 bytes to socket '/org/freedesktop/hal/udev_event',                                                                                       
Oct 15 14:36:04 linux-j3lx udevd-event[4659]: pass_env_to_socket: passed 272 bytes to socket '@/org/kernel/udev/monitor',                                                                                             
Oct 15 14:36:04 linux-j3lx udevd-event[4659]: udev_event_run: seq 1461 finished with 0                     
Oct 15 14:36:04 linux-j3lx udevd[552]: udev_event_run: seq 1462 forked, pid [4660], 'add' 'usb', 0 seconds old                                                                                                        
Oct 15 14:36:04 linux-j3lx udevd[552]: udev_done: seq 1461, pid [4659] exit with 0, 0 seconds old          
Oct 15 14:36:04 linux-j3lx udevd-event[4660]: run_program: '/sbin/modprobe' (stderr) 'FATAL: Module usb:v0D97p0001d0001dcFFdscFFdpFFicFFiscFFipFF not found.'                                                         
Oct 15 14:36:04 linux-j3lx udevd-event[4660]: run_program: '/sbin/modprobe' returned with status 1         
Oct 15 14:36:04 linux-j3lx udevd-event[4660]: pass_env_to_socket: passed 335 bytes to socket '/org/freedesktop/hal/udev_event',                                                                                       
Oct 15 14:36:04 linux-j3lx udevd-event[4660]: pass_env_to_socket: passed 335 bytes to socket '@/org/kernel/udev/monitor',                                                                                             
Oct 15 14:36:04 linux-j3lx udevd-event[4660]: udev_event_run: seq 1462 finished with 0                     
Oct 15 14:36:04 linux-j3lx udevd[552]: udev_done: seq 1462, pid [4660] exit with 0, 0 seconds old   

---------------------------------------------------------------------------------------------------------

Notice that despite the default rule in 50-udev-default.rules (NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}"), the log says:

udev_rules_get_name: no node name set, will use kernel name 'usbdev1.25_ep00'

Btw, I get the same results in Fedora 9 and openSUSE 11, so it doesn't appear to be distro-specific.

Any insights appreciated!

Cheers,
Jasem



  parent reply	other threads:[~2008-10-15 12:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13 22:17 Loading firmware Jasem Mutlaq
2008-10-14  0:18 ` Dan Nicholson
2008-10-14 13:16 ` Jasem Mutlaq
2008-10-14 14:33 ` Kay Sievers
2008-10-14 17:24 ` Jasem Mutlaq
2008-10-14 17:46 ` Kay Sievers
2008-10-14 18:08 ` Dan Nicholson
2008-10-15 12:05 ` Jasem Mutlaq [this message]
2008-10-15 12:32 ` Kay Sievers
2008-10-15 12:44 ` Jasem Mutlaq
2008-10-15 13:22 ` Kay Sievers
2008-10-15 13:59 ` Jasem Mutlaq

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000901c92ebe$49975c10$dcc61430$@com' \
    --to=mutlaqja@ikarustech.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.