Re: device enumeration
Alan Stern <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
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. Alan Stern ------------------------------------------------------------------------- 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