On Mon, 26 Feb 2007, Diego Zuccato wrote: > > I see. You want to know the BUS and DEV values, given the sysfs pathname. > Nope. Using hotplug, I *HAVE* BUS and DEV. But how do I start talking to > that device? > 'usb_open' expects a 'struct usb_device', but the only way I see to have > it is using 'usb_find_busses()', then 'usb_find_devices()' and then walk > the tree at 'usb_busses' looking for the desired device. Isn't there a > simpler way?
You're asking about the inner workings of libusb, not of the kernel. I don't know a lot about libusb; you should ask the people who maintain it. (BTW, I don't see what this question has to do with multiple similar devices. You would face the same issue even if you wanted to talk with only one device.) > > Let's take a simple example. Right now I have a USB device with this > > sysfs path: /sys/devices/pci0000:00/0000:00:07.2/usb1/1-1/. You can get > > the BUS value directly from the last component of the path; it is the > > number before the '-' character (in this case, bus 1). > > The DEV value can be found by reading the devnum file in that sysfs > > directory. For instance, on my machine: > > $ cat /sys/devices/pci0000:00/0000:00:07.2/usb1/1-1/devnum > > 2 > > So DEV is 2. > Quite interesting (this way I could bypass hotplug, right?). I don't think so. If you ignored hotplug, how would you know when a new device was plugged in? > But the base question remains: how do I talk to that device? Look at the manual and the implementation of libusb to see how it really works. Alan Stern ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Linux-usb-users@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users