[libhid-discuss] Need API for identifying the port no to which the usb device is connected

Peter Stuge stuge-libhid at cdy.org
Tue Jun 24 05:29:24 UTC 2008


On Tue, Jun 24, 2008 at 10:22:53AM +0530, shivaprasad javali wrote:
> The location being printed there is the busnumber/devicefilename.
> While this might be useful for me I am looking for a way for me to
> get the port no of the usb device. When I look at the file
> /proc/bus/usb/devices I get a port no field for each usb device
> there. Thats the port no I want to know about my USB device. Is
> there any way to get that port no.

See thread on libusb list.

You could of course parse /proc/bus/usb/devices, but it is preferred
to look your device up in the /sys/bus/usb/devices/ directory. The
link for your device has encoded in it the port number it is
connected to.


//Peter



More information about the libhid-discuss mailing list