[ale] USB port identification

Phil Turmel philip at turmel.org
Thu Nov 19 13:01:04 EST 2015


On 11/19/2015 11:00 AM, Chris Fowler wrote:
> 
> 
> ------------------------------------------------------------------------
> 
>     *From: *"Jim Kinney" <jkinney at jimkinney.us>
>     *To: *"Atlanta Linux Enthusiasts" <ale at ale.org>
>     *Sent: *Thursday, November 19, 2015 10:26:17 AM
>     *Subject: *Re: [ale] USB port identification
> 
>     I was under the impression that udev rules could also be used with
>     the device ID. That way you detect what was plugged in and then run
>     whatever's needed on that port. Need to know the ID in advance or
>     use a broad category from the text strings.
> 
> 
> That works if the device ID does not change.  
> 
> At boot we are 004.  Unplug and plug back in we are now 005.

Y'all are talking past each other.  '004' and '005' are device numbers,
not device IDs.

lsusb can provide details on a device based on its bus & device
*numbers* using the '-s' qualifier.  Or it can pick out devices based on
the manufacturer's *IDs* using the '-d' qualifier.  They have no
relationship to each other.

Chris, you've already said the serial devices are all the same, so IDs
won't help.  That eliminates the easy matching tools in udev.  You'll
need to play with 'udevadm info -a /sys/....' to look for matching
strings that will help you uniquely identify the ports.  The data does
exist -- see the output of 'lsusb -t'.  The tree-view will also help you
figure out the path you need to use with udevadm.

Include an ATTRS{} check for the parent controller at the pci level,
too, to make sure you match in the correct tree.

Phil



More information about the Ale mailing list