Alan Stern ha scritto: >> What I have is a daemon that handles all the connected devices. It gets >> notified of the relevant (un)plug events, so it knows when a certain >> /proc/bus/usb/BUS/DEV exists. What I don't know how to handle is the >> "opening" of that device (even better verifying it's the right device, >> too), even in presence of many other similar devices. > 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?
> 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?). But the base question remains: how do I talk to that device? BYtE, Diego. ------------------------------------------------------------------------- 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