Re: [Linux-usb-users] USB bus unique ID

2007-12-04 Thread Alan Stern
On Tue, 4 Dec 2007, Alessio Sangalli wrote:

> Hi, do you know a way to read a unique ID for a USB bus? I would like to
> assign a given USB port to some application; I now
> read /sys/bus/usb/devices/usb* but it seems the bus* links can be
> assigned to different entities from a boot to another.
> 
> Is there some kind of unique bus ID inside /sys/bus/usb/devices/usb* so
> that I can safely assign the given bus to the application?
> 
> Am I confused enough :) ??

There is an "almost" unique bus ID you can use, given by the target of
the usbN symbolic link.  It doesn't change unless you alter the
hardware in your PC.

For example, on my system the usb1 bus currently corresponds to:

$ ls -l /sys/bus/usb/devices/usb1
lrwxrwxrwx 1 root root 0 Dec  4 14:16 /sys/bus/usb/devices/usb1 -> 
../../../devices/pci:00/:00:1d.0/usb1/

Now that bus's label may change from one boot to another, sometimes 
usb1, sometimes usb5, and so on.  But whatever the label is, that bus 
will always be associated with "devices/pci:00/:00:1d.0/".

You can get at the same information in reverse.  Now that I know the
path, it's enough to do this:

$ echo /sys/devices/pci:00/:00:1d.0/usb*
/sys/devices/pci:00/:00:1d.0/usb1 
/sys/devices/pci:00/:00:1d.0/usb_host:usb_host1

This says that right now, that particular bus is labelled "usb1".

Alan Stern


-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users


[Linux-usb-users] USB bus unique ID

2007-12-04 Thread Alessio Sangalli
Hi, do you know a way to read a unique ID for a USB bus? I would like to
assign a given USB port to some application; I now
read /sys/bus/usb/devices/usb* but it seems the bus* links can be
assigned to different entities from a boot to another.

Is there some kind of unique bus ID inside /sys/bus/usb/devices/usb* so
that I can safely assign the given bus to the application?

Am I confused enough :) ??

Thank you
Alessio Sangalli




-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users