Re: device enumeration

"Joe Halpin" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On 10/5/07, Alan Stern <[email protected]> wrote:
> On Fri, 5 Oct 2007, Joe Halpin wrote:
>
> > > For example, just get the target of the /sys/block/sda/device symbolic
> > > link.  Right now on my system I have:
> > >
> > > $ ls -l /sys/block/sda/device
> > > lrwxrwxrwx 1 root root 0 Oct  5 11:13 /sys/block/sda/device ->
> > > ../../devices/pci0000:00/0000:00:1d.7/usb8/8-4/8-4:1.0/host0/target0:0:0/0:0:0:0/
> > >
> > > Depending on your hardware arrangement, one of the path components at
> > > or near the "usbN" part (usb8 above, or 8-4) should tell you which
> > > device you're looking at.
> >
> > The problem is that the internal flash gets a different address
> > depending on whether or not a usb key is plugged in. For example,
> > here's what I get when the board is booted with no key in the external
> > port:
> >
> > # ls -l /sys/block/sda/device
> > lrwxrwxrwx    1 root     0               0 Oct 23 18:31
> > /sys/block/sda/device ->
> > ../../devices/platform/ehci_platform.4523/usb1/1-1/1-1.2/1-1.2:1.0/host0/target0:0:0/0:0:0:0
>
> Okay, that's the internal flash.
>
> > This is what happens when the board is booted with a key in the external port:
> > # ls -l /sys/block/sda/device
> > lrwxrwxrwx    1 root     0               0 Oct 23 18:13
> > /sys/block/sda/device ->
> > ../../devices/platform/ehci_platform.4523/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0
>
> And now that's the external key, right?  Since the flash would move to
> sdb.
>
> So now you have an easy way of telling them apart.  If you see "1-1.2"
> in the symlink path for sda, then you know sda refers to the internal
> flash.  And if you see "1-1.1" in the path, then you know sda refers to
> the external key.
>
> > So, we're looking to see if we can get udev installed. In the meantime
> > I'm checking sys for the model of the internal flash in
> > /sys/bus/scsi/drivers/sd/*/model. As you say, it's not hard, but I
> > don't like it because we have to depend on the model name of the flash
> > not changing.
>
> Using the path as described above gives the information you want, in
> terms of port numbers.  These don't depend on model names or anything
> like that, just on how the components are hooked together.

Yes, you're right. I'm trying to hard I guess. Thanks

Joe

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.