Re: device enumeration

"Joe Halpin" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On 10/5/07, Joe Halpin <[email protected]> wrote:
> On 10/5/07, Alan Stern <[email protected]> wrote:
> > On Fri, 5 Oct 2007, jhalpin wrote:
> >
> > > Is there a way to specify the order in which devices are detected on bootup?
> > > It doesn't look like it to me, but I'm not sure I understand the code well
> > > enough to say.
> >
> > It is not possible.
> >
> > > We have a board running linux 2.6, which always seems to discover an
> > > external usb key first if one is there. This gets assigned to /dev/sda1, and
> > > the internal usb flash gets assigned to /dev/sdb1.
> > >
> > > However, if a key isn't plugged in, the internal flash gets assigned to
> > > /dev/sda1. Our software needs a way to tell which device file is associated
> > > with the internal flash.
> > >
> > > I can root around in /sys and get an answer, but I'm hoping there's a better
> > > way. Incidentally, this board does not run udev, so that's not an option
> > > unfortunately.
> >
> > Filesystem labels?
> >
> > If you want the answer without examining the contents of the storage
> > devices then looking through /sys is the only way to do it.  That's
> > what udev does.  It doesn't have to be hard.
> >
> > 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
>
>
> 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
>
>
> 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.
>
> 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.