You are not logged in.

#1 2012-03-15 15:53:33

masutu
Member
Registered: 2010-01-30
Posts: 40

udev: confusion about identifier ATTRS{idProduct}

Hi,

i'm confused about how exactly udev identifies a device, imho the idProduct identifier is (in this specific case) inconsistent.

Short story:

'lsusb' and 'udeadm info' indentify the devices idProduct as "1002", but to get udev rules working i have to use ATTRS{idProduct}=="1001" though.

Long story:

I have this usb-to-midi device (midisport 2x2), which needs to load firmware to work (midisport-firmware). This is the udev rule to load the firmware:

#/etc/udev/rules.d/42-midisport-firmware.rules
# MidiSport 2x2
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0763", ATTRS{idProduct}=="1001", RUN+="/sbin/fxload -s /usr/share/usb/maudio/MidiSportLoader.ihx -I /usr/share/usb/maudio/MidiSport2x2.ihx -D %N"
...

This rule ("idProduct=1001") works!
Changing "idProduct" to "1002" does not work.
However, here's the output of

~# lsusb
...
Bus 003 Device 007: ID 0763:1002 Midiman MidiSport 2x2
...

and

~# udevadm info -a -p /sys/bus/usb/devices/usb3/3-2/
...
  looking at device '/bus/usb/devices/usb3/3-2':
    KERNEL=="3-2"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{configuration}==""
    ATTR{bNumInterfaces}==" 1"
    ATTR{bConfigurationValue}=="1"
    ATTR{bmAttributes}=="a0"
    ATTR{bMaxPower}=="  0mA"
    ATTR{urbnum}=="13"
    ATTR{idVendor}=="0763"
    ATTR{idProduct}=="1002"
    ATTR{bcdDevice}=="0121"
    ATTR{bDeviceClass}=="00"
    ATTR{bDeviceSubClass}=="00"
    ATTR{bDeviceProtocol}=="00"
    ATTR{bNumConfigurations}=="1"
    ATTR{bMaxPacketSize0}=="64"
    ATTR{speed}=="12"
    ATTR{busnum}=="3"
    ATTR{devnum}=="7"
    ATTR{devpath}=="2"
    ATTR{version}==" 1.00"
    ATTR{maxchild}=="0"
    ATTR{quirks}=="0x0"
    ATTR{avoid_reset_quirk}=="0"
    ATTR{authorized}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb3':
    KERNELS=="usb3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="145"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0001"
    ATTRS{bcdDevice}=="0302"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="3"
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="2"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 3.2.9-1-ARCH uhci_hcd"
    ATTRS{product}=="UHCI Host Controller"
    ATTRS{serial}=="0000:00:1a.0"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0':
    KERNELS=="0000:00:1a.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="uhci_hcd"
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2937"
    ATTRS{subsystem_vendor}=="0x17aa"
    ATTRS{subsystem_device}=="0x20f0"
    ATTRS{class}=="0x0c0300"
    ATTRS{irq}=="16"
    ATTRS{local_cpus}=="ff"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

which both indicate, the correct idProduct would be "1002"!?

The midisport box is the only device where this inconsistence appears, all other usb-devices (hdds, sticks, sound card, dvb-t stick, mp3 player) get identified as expected.
I want to know, if anybody can explain this/ if anybody has had similar experiences!

Offline

#2 2012-03-15 16:14:54

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: udev: confusion about identifier ATTRS{idProduct}

Looking at the udevadm info output, it shows ATTR{idproduct}=="1002" and ATTRS{idproduct}=="0001" and your rule uses ATTRS{idproduct}=="1001".

Have you tried with just ATTR{idproduct}=="1002" (note no S)? Looking at the output of info, I would still not expect ATTRS{idproduct}=="1001" to work, but udev's changed a fair bit in the last few years and the old bible for rules is way out of date.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#3 2012-03-15 16:37:54

masutu
Member
Registered: 2010-01-30
Posts: 40

Re: udev: confusion about identifier ATTRS{idProduct}

Thanks for your quick answer, but that didn't work either. Summary:

Not working:
ATTR{idproduct}=="1002"
or
ATTRS{idproduct}=="1002"

Working:
ATTR{idproduct}=="1001"
or
ATTRS{idproduct}=="1001"

Meh, confusing...

Offline

#4 2012-03-15 17:28:45

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: udev: confusion about identifier ATTRS{idProduct}

Yeah, can't see an obvious reason. Might be worth taking upstream to udev directly though.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

Board footer

Powered by FluxBB