linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev: rules using multiple sysfs directories
@ 2005-04-28 19:41 James Macfarlane
  2005-04-28 20:28 ` Ian Pilcher
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: James Macfarlane @ 2005-04-28 19:41 UTC (permalink / raw)
  To: linux-hotplug

Hi 

I'm new to this list so excuse me if this is a daft question but I've 
trawled the archives to no avail.

I've got an example on my machine where it would be really useful if 
udev could look at sysfs params on multiple directory levels (see 
below). I know from the docs that it can't do this. As a relative udev 
newbie, could someone let me know why this is so ?

Many thanks,
James.

Example
-------
This seems to me to be a limitation in the following example: I often 
use a PS2 to USB keyboard/mouse adapter with my laptop so I can use an 
external keyboard and monitor. I want to generate a persistent name (so 
I can use a different keymap under X because it's different layout from 
the laptop's built-in keyboard). So, for the udev rule I need to 
identify it by SYSFS{product} or SYSFS{serial} or whatever. However, 
because the device contains two interfaces (keyboard and mouse), there 
are sub directories at this level in sysfs. So I need to be able to 
look at bInterfaceProtocol in those lower level directories as well, to 
tell if it's the keyboard or the mouse.

Ok, I could write a shell script, or just be sensible and admit that 
it's unlikely I'd ever get two USB keyboards connected to one machine 
and use bInterfaceClass and bInterfaceProtocol together.


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id\x105hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
@ 2005-04-28 20:28 ` Ian Pilcher
  2005-04-28 21:44 ` Kay Sievers
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Pilcher @ 2005-04-28 20:28 UTC (permalink / raw)
  To: linux-hotplug

I've got another example -- the AirPrime 5220 1xEVDO wireless modem for
which Greg K-H just whipped out a driver.  (Thanks Greg!)

This is a composite device with two serial ports:

Bus 004 Device 004: ID 0f3d:0112
Device Descriptor:
   bLength                18
   bDescriptorType         1
   bcdUSB               1.10
   bDeviceClass            0 (Defined at Interface level)
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0        16
   idVendor           0x0f3d
   idProduct          0x0112
   bcdDevice            0.01
   iManufacturer           1 AirPrime, Incorporated
   iProduct                2 AirPrime CDMA Wireless PC Card
   iSerial                 0
   bNumConfigurations      1
   Configuration Descriptor:
     bLength                 9
     bDescriptorType         2
     wTotalLength           62
     bNumInterfaces          2
     bConfigurationValue     1
     iConfiguration          0
     bmAttributes         0xc0
       Self Powered
     MaxPower              100mA
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           3
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass    255 Vendor Specific Subclass
       bInterfaceProtocol    255 Vendor Specific Protocol
       iInterface              4 Data Interface
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               none
           Usage Type               Data
         wMaxPacketSize     0x0010  bytes 16 once
         bInterval             128
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x8a  EP 10 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               none
           Usage Type               Data
         wMaxPacketSize     0x0040  bytes 64 once
         bInterval               0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x0b  EP 11 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               none
           Usage Type               Data
         wMaxPacketSize     0x0040  bytes 64 once
         bInterval               0
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       0
       bNumEndpoints           2
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass    255 Vendor Specific Subclass
       bInterfaceProtocol    255 Vendor Specific Protocol
       iInterface              4 Data Interface
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               none
           Usage Type               Data
         wMaxPacketSize     0x0040  bytes 64 once
         bInterval               0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x05  EP 5 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               none
           Usage Type               Data
         wMaxPacketSize     0x0040  bytes 64 once
         bInterval               0
   Language IDs: (length=4)
      0409 English(US)

The first port (bInterfaceNumber 0) is the CDMA modem port; the second
port (bInterfaceNumber 1) is the "control port" which is used for
diagnostic information, etc.  I would like to create persistent names
for these two ports (/dev/cdma_modem and /dev/cdma_ctl or something
similar).  Since idVendor and idProduct are a directory above
bInterfaceNumber, there doesn't appear to be any way to do this.

This seems like a significant limitation for USB composite devices.

-- 
====================================
Ian Pilcher                                        i.pilcher@comcast.net
====================================



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id\x105hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
  2005-04-28 20:28 ` Ian Pilcher
@ 2005-04-28 21:44 ` Kay Sievers
  2005-04-29  0:59 ` James Macfarlane
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2005-04-28 21:44 UTC (permalink / raw)
  To: linux-hotplug

On Thu, 2005-04-28 at 20:41 +0100, James Macfarlane wrote:

> I've got an example on my machine where it would be really useful if 
> udev could look at sysfs params on multiple directory levels (see 
> below). I know from the docs that it can't do this. As a relative udev 
> newbie, could someone let me know why this is so ?

How does:
  tree /sys/...
of this device look like?

What does:
  udevinfo -a -p /sys/xxx...
print for this device?

I never tried this, but:
  SYSFS{product/value}
may work to go into subdirs?

Kay



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id\x105hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
  2005-04-28 20:28 ` Ian Pilcher
  2005-04-28 21:44 ` Kay Sievers
@ 2005-04-29  0:59 ` James Macfarlane
  2005-04-29 12:55 ` Ian Pilcher
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Macfarlane @ 2005-04-29  0:59 UTC (permalink / raw)
  To: linux-hotplug

On Thursday 28 April 2005 22:44, Kay Sievers wrote:
> How does:
>   tree /sys/...
> of this device look like?
>
> What does:
>   udevinfo -a -p /sys/xxx...
> print for this device?

See at the bottom of this message.

> I never tried this, but:
>   SYSFS{product/value}
> may work to go into subdirs?

Not sure exactly you mean, in terms of syntax. I've just tried  
SYSFS{1.0/bInterfaceProtocol}  but it didn't seem to work. 

udevinfo says: "Only attributes within one device section may be used 
together in one rule, to match the device for which the node will be 
created."  - that seems to indicate it won't work. 

I've had a brief delve into the source and it looks unlikely to work 
either. It appears to search for attribute names in a pre-existing 
list, and everything between the curly braces counts as the attribute 
name (btw, I'm looking at ver 056, which is what my distro (debian 
testing) uses). So adding '/' is probably not going to work.

It walks the tree and breaks out of the loop once all the key-value 
pairs are matched, but it does all the SYSFS pairs in one loop. So 
unless all the SYSFS attributes are matched at one level, then the 
whole rule fails to match.


Cheers,
James.


Trees
-----


/sys/class/input/
[...]
|-- event2
|   |-- dev
|   |-- device 
-> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/2-1.2:1.0
|   `-- driver -> ../../../bus/usb/drivers/usbhid
|-- event3
|   |-- dev
|   |-- device 
-> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/2-1.2:1.1
|   `-- driver -> ../../../bus/usb/drivers/usbhid

and:
/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/
|-- 2-1.2:1.0
|   |-- bAlternateSetting
|   |-- bInterfaceClass
|   |-- bInterfaceNumber
|   |-- bInterfaceProtocol
|   |-- bInterfaceSubClass
|   |-- bNumEndpoints
|   |-- detach_state
|   |-- driver -> ../../../../../../../bus/usb/drivers/usbhid
|   `-- power
|       `-- state
|-- 2-1.2:1.1
|   |-- bAlternateSetting
|   |-- bInterfaceClass
|   |-- bInterfaceNumber
|   |-- bInterfaceProtocol
|   |-- bInterfaceSubClass
|   |-- bNumEndpoints
|   |-- detach_state
|   |-- driver -> ../../../../../../../bus/usb/drivers/usbhid
|   `-- power
|       `-- state
|-- bConfigurationValue
|-- bDeviceClass
|-- bDeviceProtocol
|-- bDeviceSubClass
|-- bMaxPower
|-- bNumConfigurations
|-- bNumInterfaces
|-- bcdDevice
|-- bmAttributes
|-- configuration
|-- detach_state
|-- devnum
|-- driver -> ../../../../../../bus/usb/drivers/usb
|-- idProduct
|-- idVendor
|-- manufacturer
|-- maxchild
|-- power
|   `-- state
|-- product
|-- speed
`-- version

udevinfo output
---------------

device '/sys/class/input/event2' has major:minor 13:66
  looking at class device '/sys/class/input/event2':
    SUBSYSTEM="input"
    SYSFS{dev}="13:66"

follow the class device's "device"
  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/2-1.2:1.0':
    BUS="usb"
    ID="2-1.2:1.0"
    DRIVER="usbhid"
    SYSFS{bAlternateSetting}=" 0"
    SYSFS{bInterfaceClass}="03"
    SYSFS{bInterfaceNumber}="00"
    SYSFS{bInterfaceProtocol}="01"
    SYSFS{bInterfaceSubClass}="01"
    SYSFS{bNumEndpoints}="01"
    SYSFS{detach_state}="0"

  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2':
    BUS="usb"
    ID="2-1.2"
    DRIVER="usb"
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="00"
    SYSFS{bDeviceProtocol}="00"
    SYSFS{bDeviceSubClass}="00"
    SYSFS{bMaxPower}="100mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 2"
    SYSFS{bcdDevice}="0001"
    SYSFS{bmAttributes}="a0"
    SYSFS{configuration}="USB to PS2 Adaptor  v1.12"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="7"
    SYSFS{idProduct}="0001"
    SYSFS{idVendor}="0518"
    SYSFS{manufacturer}="Composite USB PS2 Converter"
    SYSFS{maxchild}="0"
    SYSFS{product}="USB to PS2 Adaptor  v1.12"
    SYSFS{speed}="1.5"
    SYSFS{version}=" 1.10"

  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1':
    BUS="usb"
    ID="2-1"
    DRIVER="usb"
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="09"
    SYSFS{bDeviceProtocol}="01"
    SYSFS{bDeviceSubClass}="00"
    SYSFS{bMaxPower}="100mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 1"
    SYSFS{bcdDevice}="0100"
    SYSFS{bmAttributes}="e0"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="2"
    SYSFS{idProduct}="0058"
    SYSFS{idVendor}="0409"
    SYSFS{manufacturer}="NEC Corporation"
    SYSFS{maxchild}="4"
    SYSFS{product}="USB2.0 Hub Controller"
    SYSFS{speed}="480"
    SYSFS{version}=" 2.00"

  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2':
    BUS="usb"
    ID="usb2"
    DRIVER="usb"
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="09"
    SYSFS{bDeviceProtocol}="01"
    SYSFS{bDeviceSubClass}="00"
    SYSFS{bMaxPower}="  0mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 1"
    SYSFS{bcdDevice}="0206"
    SYSFS{bmAttributes}="e0"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="1"
    SYSFS{idProduct}="0000"
    SYSFS{idVendor}="0000"
    SYSFS{manufacturer}="Linux 2.6.10blackrock20041231 ehci_hcd"
    SYSFS{maxchild}="6"
    SYSFS{product}="Intel Corp. 82801DB/DBM (ICH4/ICH4-M) USB 2.0 EHCI 
Controller"
    SYSFS{serial}="0000:00:1d.7"
    SYSFS{speed}="480"
    SYSFS{version}=" 2.00"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7':
    BUS="pci"
    ID="0000:00:1d.7"
    DRIVER="ehci_hcd"
    SYSFS{class}="0x0c0320"
    SYSFS{detach_state}="0"
    SYSFS{device}="0x24cd"
    SYSFS{irq}="11"
    SYSFS{local_cpus}="1"
    SYSFS{subsystem_device}="0x0001"
    SYSFS{subsystem_vendor}="0x1179"
    SYSFS{vendor}="0x8086"

  looking at the device chain at '/sys/devices/pci0000:00':
    BUS=""
    ID="pci0000:00"
    DRIVER="unknown"
    SYSFS{detach_state}="0"




-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id\x105hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
                   ` (2 preceding siblings ...)
  2005-04-29  0:59 ` James Macfarlane
@ 2005-04-29 12:55 ` Ian Pilcher
  2005-04-29 17:13 ` James Macfarlane
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Pilcher @ 2005-04-29 12:55 UTC (permalink / raw)
  To: linux-hotplug

James Macfarlane wrote:
  > I've had a brief delve into the source and it looks unlikely to work
> either. It appears to search for attribute names in a pre-existing 
> list, and everything between the curly braces counts as the attribute 
> name (btw, I'm looking at ver 056, which is what my distro (debian 
> testing) uses). So adding '/' is probably not going to work.
> 
> It walks the tree and breaks out of the loop once all the key-value 
> pairs are matched, but it does all the SYSFS pairs in one loop. So 
> unless all the SYSFS attributes are matched at one level, then the 
> whole rule fails to match.

Out of curiosity, what file/line # is this at?

TIA.

-- 
====================================
Ian Pilcher                                        i.pilcher@comcast.net
====================================



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id\x105hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
                   ` (3 preceding siblings ...)
  2005-04-29 12:55 ` Ian Pilcher
@ 2005-04-29 17:13 ` James Macfarlane
  2005-04-29 18:15 ` Kay Sievers
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Macfarlane @ 2005-04-29 17:13 UTC (permalink / raw)
  To: linux-hotplug

On Friday 29 April 2005 13:55, Ian Pilcher wrote:
> Out of curiosity, what file/line # is this at?

udev_rules.c, around line 623 onwards

James.


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
                   ` (4 preceding siblings ...)
  2005-04-29 17:13 ` James Macfarlane
@ 2005-04-29 18:15 ` Kay Sievers
  2005-04-29 20:09 ` Greg KH
  2005-04-30  0:44 ` Ian Pilcher
  7 siblings, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2005-04-29 18:15 UTC (permalink / raw)
  To: linux-hotplug

On Fri, 2005-04-29 at 01:59 +0100, James Macfarlane wrote:
> On Thursday 28 April 2005 22:44, Kay Sievers wrote:
> > How does:
> >   tree /sys/...
> > of this device look like?
> >
> > What does:
> >   udevinfo -a -p /sys/xxx...
> > print for this device?
> 
> See at the bottom of this message.
> 
> > I never tried this, but:
> >   SYSFS{product/value}
> > may work to go into subdirs?
> 
> Not sure exactly you mean, in terms of syntax. I've just tried  
> SYSFS{1.0/bInterfaceProtocol}  but it didn't seem to work. 
> 
> udevinfo says: "Only attributes within one device section may be used 
> together in one rule, to match the device for which the node will be 
> created."  - that seems to indicate it won't work. 

Yes that is right, but you can specify a path as attribute.
Example:

  [root@pim udev]# tree /sys/block/hda/
  /sys/block/hda/
  |-- dev
  |-- hda1
  |   |-- dev
  |   |-- size
  |   |-- start
  |   `-- stat
  |-- queue
  |   |-- iosched
  |   |   |-- antic_expire
  |   |   |-- est_time
  |   |   |-- read_batch_expire
  |   |   |-- read_expire
  |   |   |-- write_batch_expire
  |   |   `-- write_expire
  |   |-- max_hw_sectors_kb
  |   |-- max_sectors_kb
  |   |-- nr_requests
  |   |-- read_ahead_kb
  |   `-- scheduler
  |-- range
  |-- removable
  |-- size
  `-- stat

This matches:
  KERNEL="hda", SYSFS{queue/iosched/est_time}="*", SYSFS{removable}="*", NAME="test"

> I've had a brief delve into the source and it looks unlikely to work 
> either. It appears to search for attribute names in a pre-existing 
> list, and everything between the curly braces counts as the attribute 
> name (btw, I'm looking at ver 056, which is what my distro (debian 
> testing) uses). So adding '/' is probably not going to work.

Only in the way mentioned above, as a path.

> It walks the tree and breaks out of the loop once all the key-value 
> pairs are matched, but it does all the SYSFS pairs in one loop. So 
> unless all the SYSFS attributes are matched at one level, then the 
> whole rule fails to match.

Right.

But in your case, it may be the easiest to write a PROGRAM-script to
catch your device...

Good luck,
Kay



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
                   ` (5 preceding siblings ...)
  2005-04-29 18:15 ` Kay Sievers
@ 2005-04-29 20:09 ` Greg KH
  2005-04-30  0:44 ` Ian Pilcher
  7 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2005-04-29 20:09 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Apr 28, 2005 at 03:28:31PM -0500, Ian Pilcher wrote:
> I've got another example -- the AirPrime 5220 1xEVDO wireless modem for
> which Greg K-H just whipped out a driver.  (Thanks Greg!)
> 
> This is a composite device with two serial ports:
> 
> Bus 004 Device 004: ID 0f3d:0112
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.10
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        16
>   idVendor           0x0f3d
>   idProduct          0x0112
>   bcdDevice            0.01
>   iManufacturer           1 AirPrime, Incorporated
>   iProduct                2 AirPrime CDMA Wireless PC Card
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           62
>     bNumInterfaces          2
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xc0
>       Self Powered
>     MaxPower              100mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           3
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass    255 Vendor Specific Subclass
>       bInterfaceProtocol    255 Vendor Specific Protocol
>       iInterface              4 Data Interface
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               none
>           Usage Type               Data
>         wMaxPacketSize     0x0010  bytes 16 once
>         bInterval             128
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x8a  EP 10 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               none
>           Usage Type               Data
>         wMaxPacketSize     0x0040  bytes 64 once
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x0b  EP 11 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               none
>           Usage Type               Data
>         wMaxPacketSize     0x0040  bytes 64 once
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass    255 Vendor Specific Subclass
>       bInterfaceProtocol    255 Vendor Specific Protocol
>       iInterface              4 Data Interface
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               none
>           Usage Type               Data
>         wMaxPacketSize     0x0040  bytes 64 once
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x05  EP 5 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               none
>           Usage Type               Data
>         wMaxPacketSize     0x0040  bytes 64 once
>         bInterval               0
>   Language IDs: (length=4)
>      0409 English(US)
> 
> The first port (bInterfaceNumber 0) is the CDMA modem port; the second
> port (bInterfaceNumber 1) is the "control port" which is used for
> diagnostic information, etc.  I would like to create persistent names
> for these two ports (/dev/cdma_modem and /dev/cdma_ctl or something
> similar).  Since idVendor and idProduct are a directory above
> bInterfaceNumber, there doesn't appear to be any way to do this.

You can do this, as you get two different hotplug events.  This is
because usb drivers bind to the USB inteface, not the main device
itself.

> This seems like a significant limitation for USB composite devices.

No, all USB devices work like this.

I'll try to make a udev rule that would work for this, can you send me
the output of udevinfo for this:
	udevinfo -a /sys/class/tty/ttyUSB0
	udevinfo -a /sys/class/tty/ttyUSB1

thanks,

greg k-h


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: udev: rules using multiple sysfs directories
  2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
                   ` (6 preceding siblings ...)
  2005-04-29 20:09 ` Greg KH
@ 2005-04-30  0:44 ` Ian Pilcher
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Pilcher @ 2005-04-30  0:44 UTC (permalink / raw)
  To: linux-hotplug

Greg KH wrote:
> On Thu, Apr 28, 2005 at 03:28:31PM -0500, Ian Pilcher wrote:
> 
>>This seems like a significant limitation for USB composite devices.
> 
> 
> No, all USB devices work like this.

If I'm correct about what can't be done, there's no way to write a rule
which identifies a device by vendor, product, and interface.  It's
possible to do vendor and product, so the limitation only affects
composite devices.

> 
> I'll try to make a udev rule that would work for this, can you send me
> the output of udevinfo for this:
> 	udevinfo -a /sys/class/tty/ttyUSB0
> 	udevinfo -a /sys/class/tty/ttyUSB1


ttyUSB0 (the modem):

   looking at class device '/sys/class/tty/ttyUSB0':
     SYSFS{dev}="188:0"

follow the class device's "device"
   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4/4-1/4-1:1.0/ttyUSB0':
     BUS="usb-serial"
     ID="ttyUSB0"
     SYSFS{detach_state}="0"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4/4-1/4-1:1.0':
     BUS="usb"
     ID="4-1:1.0"
     SYSFS{bAlternateSetting}=" 0"
     SYSFS{bInterfaceClass}="ff"
     SYSFS{bInterfaceNumber}="00"
     SYSFS{bInterfaceProtocol}="ff"
     SYSFS{bInterfaceSubClass}="ff"
     SYSFS{bNumEndpoints}="03"
     SYSFS{detach_state}="0"
     SYSFS{iInterface}="04"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4/4-1':
     BUS="usb"
     ID="4-1"
     SYSFS{bConfigurationValue}="1"
     SYSFS{bDeviceClass}="00"
     SYSFS{bDeviceProtocol}="00"
     SYSFS{bDeviceSubClass}="00"
     SYSFS{bMaxPower}="100mA"
     SYSFS{bNumConfigurations}="1"
     SYSFS{bNumInterfaces}=" 2"
     SYSFS{bcdDevice}="0001"
     SYSFS{bmAttributes}="c0"
     SYSFS{detach_state}="0"
     SYSFS{devnum}="4"
     SYSFS{idProduct}="0112"
     SYSFS{idVendor}="0f3d"
     SYSFS{manufacturer}="AirPrime, Incorporated"
     SYSFS{maxchild}="0"
     SYSFS{product}="AirPrime CDMA Wireless PC Card"
     SYSFS{speed}="12"
     SYSFS{version}=" 1.10"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4':
     BUS="usb"
     ID="usb4"
     SYSFS{bConfigurationValue}="1"
     SYSFS{bDeviceClass}="09"
     SYSFS{bDeviceProtocol}="00"
     SYSFS{bDeviceSubClass}="00"
     SYSFS{bMaxPower}="  0mA"
     SYSFS{bNumConfigurations}="1"
     SYSFS{bNumInterfaces}=" 1"
     SYSFS{bcdDevice}="0206"
     SYSFS{bmAttributes}="c0"
     SYSFS{detach_state}="0"
     SYSFS{devnum}="1"
     SYSFS{idProduct}="0000"
     SYSFS{idVendor}="0000"
     SYSFS{manufacturer}="Linux 2.6.9-5.EL.root.evdo ohci_hcd"
     SYSFS{maxchild}="2"
     SYSFS{product}="OHCI Host Controller"
     SYSFS{serial}="0000:03:00.0"
     SYSFS{speed}="12"
     SYSFS{version}=" 1.10"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0':
     BUS="pci"
     ID="0000:03:00.0"
     SYSFS{class}="0x0c0310"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x5802"
     SYSFS{irq}="11"
     SYSFS{subsystem_device}="0x5802"
     SYSFS{subsystem_vendor}="0x11c1"
     SYSFS{vendor}="0x11c1"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0':
     BUS="pci"
     ID="0000:02:00.0"
     SYSFS{class}="0x060700"
     SYSFS{detach_state}="0"
     SYSFS{device}="0xac55"
     SYSFS{irq}="11"
     SYSFS{subsystem_device}="0x0512"
     SYSFS{subsystem_vendor}="0x1014"
     SYSFS{vendor}="0x104c"

   looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0':
     BUS="pci"
     ID="0000:00:1e.0"
     SYSFS{class}="0x060400"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x2448"
     SYSFS{irq}="0"
     SYSFS{subsystem_device}="0x0000"
     SYSFS{subsystem_vendor}="0x0000"
     SYSFS{vendor}="0x8086"

   looking at the device chain at '/sys/devices/pci0000:00':
     BUS=""
     ID="pci0000:00"
     SYSFS{detach_state}="0"


ttyUSB1 (the "control port"):

   looking at class device '/sys/class/tty/ttyUSB1':
     SYSFS{dev}="188:1"

follow the class device's "device"
   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4/4-1/4-1:1.1/ttyUSB1':
     BUS="usb-serial"
     ID="ttyUSB1"
     SYSFS{detach_state}="0"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4/4-1/4-1:1.1':
     BUS="usb"
     ID="4-1:1.1"
     SYSFS{bAlternateSetting}=" 0"
     SYSFS{bInterfaceClass}="ff"
     SYSFS{bInterfaceNumber}="01"
     SYSFS{bInterfaceProtocol}="ff"
     SYSFS{bInterfaceSubClass}="ff"
     SYSFS{bNumEndpoints}="02"
     SYSFS{detach_state}="0"
     SYSFS{iInterface}="04"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4/4-1':
     BUS="usb"
     ID="4-1"
     SYSFS{bConfigurationValue}="1"
     SYSFS{bDeviceClass}="00"
     SYSFS{bDeviceProtocol}="00"
     SYSFS{bDeviceSubClass}="00"
     SYSFS{bMaxPower}="100mA"
     SYSFS{bNumConfigurations}="1"
     SYSFS{bNumInterfaces}=" 2"
     SYSFS{bcdDevice}="0001"
     SYSFS{bmAttributes}="c0"
     SYSFS{detach_state}="0"
     SYSFS{devnum}="4"
     SYSFS{idProduct}="0112"
     SYSFS{idVendor}="0f3d"
     SYSFS{manufacturer}="AirPrime, Incorporated"
     SYSFS{maxchild}="0"
     SYSFS{product}="AirPrime CDMA Wireless PC Card"
     SYSFS{speed}="12"
     SYSFS{version}=" 1.10"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0/usb4':
     BUS="usb"
     ID="usb4"
     SYSFS{bConfigurationValue}="1"
     SYSFS{bDeviceClass}="09"
     SYSFS{bDeviceProtocol}="00"
     SYSFS{bDeviceSubClass}="00"
     SYSFS{bMaxPower}="  0mA"
     SYSFS{bNumConfigurations}="1"
     SYSFS{bNumInterfaces}=" 1"
     SYSFS{bcdDevice}="0206"
     SYSFS{bmAttributes}="c0"
     SYSFS{detach_state}="0"
     SYSFS{devnum}="1"
     SYSFS{idProduct}="0000"
     SYSFS{idVendor}="0000"
     SYSFS{manufacturer}="Linux 2.6.9-5.EL.root.evdo ohci_hcd"
     SYSFS{maxchild}="2"
     SYSFS{product}="OHCI Host Controller"
     SYSFS{serial}="0000:03:00.0"
     SYSFS{speed}="12"
     SYSFS{version}=" 1.10"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0/0000:03:00.0':
     BUS="pci"
     ID="0000:03:00.0"
     SYSFS{class}="0x0c0310"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x5802"
     SYSFS{irq}="11"
     SYSFS{subsystem_device}="0x5802"
     SYSFS{subsystem_vendor}="0x11c1"
     SYSFS{vendor}="0x11c1"

   looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0':
     BUS="pci"
     ID="0000:02:00.0"
     SYSFS{class}="0x060700"
     SYSFS{detach_state}="0"
     SYSFS{device}="0xac55"
     SYSFS{irq}="11"
     SYSFS{subsystem_device}="0x0512"
     SYSFS{subsystem_vendor}="0x1014"
     SYSFS{vendor}="0x104c"

   looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0':
     BUS="pci"
     ID="0000:00:1e.0"
     SYSFS{class}="0x060400"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x2448"
     SYSFS{irq}="0"
     SYSFS{subsystem_device}="0x0000"
     SYSFS{subsystem_vendor}="0x0000"
     SYSFS{vendor}="0x8086"

   looking at the device chain at '/sys/devices/pci0000:00':
     BUS=""
     ID="pci0000:00"
     SYSFS{detach_state}="0"

Thanks!

-- 
====================================
Ian Pilcher                                        i.pilcher@comcast.net
====================================



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-04-30  0:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
2005-04-28 20:28 ` Ian Pilcher
2005-04-28 21:44 ` Kay Sievers
2005-04-29  0:59 ` James Macfarlane
2005-04-29 12:55 ` Ian Pilcher
2005-04-29 17:13 ` James Macfarlane
2005-04-29 18:15 ` Kay Sievers
2005-04-29 20:09 ` Greg KH
2005-04-30  0:44 ` Ian Pilcher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).