On Tue, Oct 18, 2005 at 06:00:36PM -0700, B Cap wrote: > Hi, > > I need to update some software that programatically determines what devices > are present on a Linux system, to now support USB devices. I've travelled > or started down three paths so far...
What devices do you need to find, and why do you need them? > The current design/implementation identifies devices via /sys/devices, then > matches up based on the info found there, the appropriate file in /dev for > SCSI and IDE devices to communicate with them. I have had little success > determining how USB devices are represented in /sys or /dev. eg. naming > conventions, info available, operations available, etc. All usb devices can be found in /sys/bus/usb/devices But remember, not all USB devices show up as a /dev node. Or some have multiple /dev nodes. In short, there is no one-to-one matching at all (with the exception of the usbfs-through-dev option that is there, but that's another story...) > - Should I be able to continue to use the existing design/implementation > based on /sys & /dev with minimal changes? I have no idea what you design/implementation is, and what it is for. > - Where might I find a good description of the representation of USB > devices in /sys and /dev? Becides the above? Did you look at the book, Linux Device Drivers, third edition, which is online for free if you don't want to buy it? > - Is there USB information present in /sys and /dev that will enable me to > know I'm looking at the same device in both places? Yes, you can figure that out from /sys as that is what is used to create the /dev entry. > We did find and glance at the documentation and implementation of the > 'lsusb' command, but it appears to be based on /proc. Who is "we"? libusb uses usbfs, which happens to be mounted on /proc/bus/usb/ but it has nothing to do with /proc. > Should I make use of /proc? My (beginner) understanding was that this > was the type of information that is being migrated from /proc to /sys. > I'm not sure if that's linked to newer kernels or not... You can use usbfs, that's fine. > I have now found, but have not had a chance to read in detail, the Linux > USB Guide, that seems to indicate there is a specific Linux-USB subsystem. That would be a good place to start :) > - Is use of it the best way to discover and communicate with USB devices? > In other words, do I have to change the design/implementation of this > software to make use of it? What software? > - If I use it in conjunction with the original design/implementation, is > there potential overlap in what will be "discovered" in /sys/devices and > what the Linux-USB subsystem provides? Again, what design/implementation? > - Likewise, if I use it, should/must it be used instead of a /dev file to > communicate with the device? Can I determine which /dev file represents > what appears in the Linux-USB subsystem? Yes you can. Look at the links in sysfs. Hope this helps, greg k-h ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
