* Re: How can I specify a specific 'sub-device' of a device for udev
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
@ 2004-03-01 12:36 ` Kay Sievers
2004-03-01 16:23 ` Jonathan Steinert
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2004-03-01 12:36 UTC (permalink / raw)
To: linux-hotplug
On Mon, 2004-03-01 at 07:08, Jonathan Steinert wrote:
> Morning everybody,
>
> I'm trying to find how I can write a rule which allows me to say "The
> usb-serial bus interface inside the usb device with a sysfs serial of
> "304087" should be named "foo"
>
> I'll paste my udevinfo output for the device in question (A Belkin USB
> to serial dongle) at the bottom, but I am running into a similar issue
> with my Griffin Powermate.
>
> The rule I came up with, which does not work nor seem correct in the
> first place is:
>
> BUS="usb-serial", SYSFS{serial}="304087", NAME="foo"
Yes, the rule is incorrect. It's not on the same device.
> Since this does not work, I am asuming that the sysfs attributes to not
> trickle down a driver chain for matching in more specific devices.
It walks down, just like udevinfo does. But you can only match
attributes of _one_ device not combine attributes from different devices
on the chain.
> This does leave me puzzled about two things:
>
> 1) Why does udev have a flag to crawl up the sysfs tree (Asuming my
> observations of udev are correct) but no flag to show the attributes of
> only the device I specify? or only 'n' layers down for that matter?
Do you really need this? Why?
> 2) How can I write a rule to match the usb-serial interface of a usb
> device with a particular serial number?
> looking at the device chain at
> '/sys/devices/pci0000:00/0000:00:1d.2/usb2/2-1':
> BUS="usb"
...
> SYSFS{serial}="304087"
Your serial number belongs the "usb"-device and not the virtual
"usb-serial"-device. A match for the "hardware" behind your serial
device should work fine:
BUS="usb", SYSFS{serial}="304087", NAME="foo"
If you really need to match this particular device interface, you may
use its bus-id:
BUS="usb", ID="2-1:1.0", NAME="foo"
hope that helps,
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
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] 8+ messages in thread* Re: How can I specify a specific 'sub-device' of a device for udev
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
2004-03-01 12:36 ` How can I specify a specific 'sub-device' of a device for udev Kay Sievers
@ 2004-03-01 16:23 ` Jonathan Steinert
2004-03-01 17:00 ` Kay Sievers
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jonathan Steinert @ 2004-03-01 16:23 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On Mon, 2004-03-01 at 07:08, Jonathan Steinert wrote:
>
>This does leave me puzzled about two things:
>>
>> 1) Why does udev have a flag to crawl up the sysfs tree (Asuming my
>> observations of udev are correct) but no flag to show the attributes of
>> only the device I specify? or only 'n' layers down for that matter?
> Do you really need this? Why?
That's not quite what I intended with the question. My observation is
that udevinfo shows you all the attributes as you walk up the tree, but
udev has no way to match attributes as you walk up the tree.
I'm not sure if this is intended to confuse people, but it most
certainly makes me think that there should be a way to match attributes
as you walk up the tree with udev, otherwise why does it show it to you?
>
>
>>2) How can I write a rule to match the usb-serial interface of a usb
>>device with a particular serial number?
>
>
>> looking at the device chain at
>>'/sys/devices/pci0000:00/0000:00:1d.2/usb2/2-1':
>> BUS="usb"
>
> ...
>
>> SYSFS{serial}="304087"
>
>
> Your serial number belongs the "usb"-device and not the virtual
> "usb-serial"-device. A match for the "hardware" behind your serial
> device should work fine:
>
> BUS="usb", SYSFS{serial}="304087", NAME="foo"
Sure, but matching this usb device does not yield me a tty.
>
> If you really need to match this particular device interface, you may
> use its bus-id:
>
> BUS="usb", ID="2-1:1.0", NAME="foo"
The bus ID is dependant on the order it was plugged into the device
chain, so this is kinda useless for detecting a particular device or
particular kind of device. Plus this is once again a usb device, not a
usb-serial device, and as such will not yield me a tty.
>
>
> hope that helps,
> Kay
>
It does help me to know that there is no (current) way to make udev do
this, however now I'd like to ask for ways to match the usb-serial
device which is on an interface of this particular usb device. This is
ultimately the problem I am trying to solve.
Thanks much,
Jonathan Steinert
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
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] 8+ messages in thread* Re: How can I specify a specific 'sub-device' of a device for udev
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
2004-03-01 12:36 ` How can I specify a specific 'sub-device' of a device for udev Kay Sievers
2004-03-01 16:23 ` Jonathan Steinert
@ 2004-03-01 17:00 ` Kay Sievers
2004-03-01 23:56 ` Jonathan Steinert
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2004-03-01 17:00 UTC (permalink / raw)
To: linux-hotplug
On Mon, 2004-03-01 at 17:23, Jonathan Steinert wrote:
> Kay Sievers wrote:
> > On Mon, 2004-03-01 at 07:08, Jonathan Steinert wrote:
> >
> >This does leave me puzzled about two things:
> >>
> >> 1) Why does udev have a flag to crawl up the sysfs tree (Asuming my
> >> observations of udev are correct) but no flag to show the attributes of
> >> only the device I specify? or only 'n' layers down for that matter?
> > Do you really need this? Why?
>
> That's not quite what I intended with the question. My observation is
> that udevinfo shows you all the attributes as you walk up the tree, but
> udev has no way to match attributes as you walk up the tree.
>
> I'm not sure if this is intended to confuse people, but it most
> certainly makes me think that there should be a way to match attributes
> as you walk up the tree with udev, otherwise why does it show it to you?
udevinfo prints all attributes in sections, you can select and combine
any attribute within _one_ section, thats why we print it all.
Unfortunally, I see this doesn't solve your problem.
could you please send a:
tree /sys/devices/pci0000:00/0000:00:1d.2/usb2/2-1
I want to have a look if we can do something for you :)
thanks,
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
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] 8+ messages in thread* Re: How can I specify a specific 'sub-device' of a device for udev
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
` (2 preceding siblings ...)
2004-03-01 17:00 ` Kay Sievers
@ 2004-03-01 23:56 ` Jonathan Steinert
2004-03-02 0:37 ` How can I specify a specific 'sub-device' of a device for udev naming? Kay Sievers
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jonathan Steinert @ 2004-03-01 23:56 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
>On Mon, 2004-03-01 at 17:23, Jonathan Steinert wrote:
>
>
>>Kay Sievers wrote:
>>
>>
>>>On Mon, 2004-03-01 at 07:08, Jonathan Steinert wrote:
>>>
>>>
>>>
>> >This does leave me puzzled about two things:
>> >>
>> >> 1) Why does udev have a flag to crawl up the sysfs tree (Asuming my
>> >> observations of udev are correct) but no flag to show the attributes of
>> >> only the device I specify? or only 'n' layers down for that matter?
>> > Do you really need this? Why?
>>
>>That's not quite what I intended with the question. My observation is
>>that udevinfo shows you all the attributes as you walk up the tree, but
>>udev has no way to match attributes as you walk up the tree.
>>
>>I'm not sure if this is intended to confuse people, but it most
>>certainly makes me think that there should be a way to match attributes
>>as you walk up the tree with udev, otherwise why does it show it to you?
>>
>>
>
>udevinfo prints all attributes in sections, you can select and combine
>any attribute within _one_ section, thats why we print it all.
>Unfortunally, I see this doesn't solve your problem.
>
>could you please send a:
>
>tree /sys/devices/pci0000:00/0000:00:1d.2/usb2/2-1
>
>I want to have a look if we can do something for you :)
>
>thanks,
>Kay
>
>
>
Sure thing, here you go...
root@yuumi:/sys/devices/pci0000:00/0000:00:1d.2/usb2/2-1# tree .
.
|-- 2-1:1.0
| |-- bAlternateSetting
| |-- bInterfaceClass
| |-- bInterfaceNumber
| |-- bInterfaceProtocol
| |-- bInterfaceSubClass
| |-- bNumEndpoints
| |-- detach_state
| |-- iInterface
| |-- power
| | `-- state
| `-- ttyUSB0
| |-- detach_state
| `-- power
| `-- state
|-- bConfigurationValue
|-- bDeviceClass
|-- bDeviceProtocol
|-- bDeviceSubClass
|-- bMaxPower
|-- bNumConfigurations
|-- bNumInterfaces
|-- bcdDevice
|-- bmAttributes
|-- detach_state
|-- idProduct
|-- idVendor
|-- manufacturer
|-- power
| `-- state
|-- product
|-- serial
`-- speed
5 directories, 28 files
Thanks for taking the time to look, and help
--Jonathan Steinert
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
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] 8+ messages in thread* Re: How can I specify a specific 'sub-device' of a device for udev naming?
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
` (3 preceding siblings ...)
2004-03-01 23:56 ` Jonathan Steinert
@ 2004-03-02 0:37 ` Kay Sievers
2004-03-04 7:19 ` How can I specify a specific 'sub-device' of a device for udev Jonathan Steinert
2004-03-04 19:53 ` How can I specify a specific 'sub-device' of a device for udev naming? Greg KH
6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2004-03-02 0:37 UTC (permalink / raw)
To: linux-hotplug
On Mon, Mar 01, 2004 at 10:23:40AM -0600, Jonathan Steinert wrote:
> Kay Sievers wrote:
> >On Mon, 2004-03-01 at 07:08, Jonathan Steinert wrote:
> >
> >>2) How can I write a rule to match the usb-serial interface of a usb
> >>device with a particular serial number?
> >
> >
> >> looking at the device chain at
> >>'/sys/devices/pci0000:00/0000:00:1d.2/usb2/2-1':
> >> BUS="usb"
> >
> >...
> >
> >> SYSFS{serial}="304087"
> >
> >
> >Your serial number belongs the "usb"-device and not the virtual
> >"usb-serial"-device. A match for the "hardware" behind your serial
> >device should work fine:
> >
> > BUS="usb", SYSFS{serial}="304087", NAME="foo"
>
> Sure, but matching this usb device does not yield me a tty.
What do you get instead?
I took a look on your 'tree' and it has only one interface.
So, if you match with the SYSFS{serial}="304087" there should still
the tty be created.
Matching any device along the chain of your "node-device" with a rule,
will still create only the "node-device", nothing else.
Maybe I'm a bit confused and if I get the subject completly wrong
please tell me :)
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
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] 8+ messages in thread* Re: How can I specify a specific 'sub-device' of a device for udev
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
` (4 preceding siblings ...)
2004-03-02 0:37 ` How can I specify a specific 'sub-device' of a device for udev naming? Kay Sievers
@ 2004-03-04 7:19 ` Jonathan Steinert
2004-03-04 19:53 ` How can I specify a specific 'sub-device' of a device for udev naming? Greg KH
6 siblings, 0 replies; 8+ messages in thread
From: Jonathan Steinert @ 2004-03-04 7:19 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
>On Mon, Mar 01, 2004 at 10:23:40AM -0600, Jonathan Steinert wrote:
>
>
>>Sure, but matching this usb device does not yield me a tty.
>>
>>
>
>What do you get instead?
>
>I took a look on your 'tree' and it has only one interface.
>So, if you match with the SYSFS{serial}="304087" there should still
>the tty be created.
>Matching any device along the chain of your "node-device" with a rule,
>will still create only the "node-device", nothing else.
>
>Maybe I'm a bit confused and if I get the subject completly wrong
>please tell me :)
>
>Kay
>
>
Right, I'll admit defeat there... I asumed the wrong things about udev
and ended up burning myself on that one.
However, I'd like to ask... since you (I think) asume that each physical
device maps to only one node; What will happen when someone wants to
name multiple devices based on an attribute higher in the than the
unique branch?
The first example I came up with is my Griffin iMic (a usb sound card
dongle) which creates multiple device nodes. The trouble is that I think
ALSA is supposed to handle this situation and not udev.
The next best example I can think of would be naming USB devices based
on which hub they are plugged in to. The hub must be identified by some
sort of serial number or other attribute, but then there may be more
than one device plugged into that hub.
I'm just throwing this question out to see how it could be solved, so I
can't give you specific attributes till I build the system I want this for.
Thanks a ton for helping me out with the usb-serial device too.
--Jonathan Steinert
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
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] 8+ messages in thread* Re: How can I specify a specific 'sub-device' of a device for udev naming?
2004-03-01 6:08 How can I specify a specific 'sub-device' of a device for udev naming? Jonathan Steinert
` (5 preceding siblings ...)
2004-03-04 7:19 ` How can I specify a specific 'sub-device' of a device for udev Jonathan Steinert
@ 2004-03-04 19:53 ` Greg KH
6 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2004-03-04 19:53 UTC (permalink / raw)
To: linux-hotplug
On Thu, Mar 04, 2004 at 01:19:04AM -0600, Jonathan Steinert wrote:
>
> However, I'd like to ask... since you (I think) asume that each physical
> device maps to only one node; What will happen when someone wants to
> name multiple devices based on an attribute higher in the than the
> unique branch?
Well, it's a bit hard if you want to do that, isn't it :)
usb to serial devices have the same "issue", as well as many other types
of devices. The trick is in coming up with a unique name rule for those
kinds of devices.
> The first example I came up with is my Griffin iMic (a usb sound card
> dongle) which creates multiple device nodes. The trouble is that I think
> ALSA is supposed to handle this situation and not udev.
>
> The next best example I can think of would be naming USB devices based
> on which hub they are plugged in to. The hub must be identified by some
> sort of serial number or other attribute, but then there may be more
> than one device plugged into that hub.
Well, you can always go on the position of the usb device (plugged into
which port of which hub.) But again, you are back to the "multiple
virtual devices per physical device" issue.
We are a whole lot better off than before, when we could never even
determine this information. It's up to the individual driver writers to
help expose unique information for their devices that can help out in
creating "good enough" rules.
> I'm just throwing this question out to see how it could be solved, so I
> can't give you specific attributes till I build the system I want this for.
There is no "general" solution for this. It's going to be a individual
one as every system ends up being different.
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
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] 8+ messages in thread