From: Hans de Goede Date: Thu, 16 May 2013 20:36:26 +0000 (+0200) Subject: listdevs: Also print portpath for non root hubs X-Git-Tag: upstream/1.0.21~460 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebac6ac1b30aea6e9190cce336eb75dc0f1c5ce7;p=platform%2Fupstream%2Flibusb.git listdevs: Also print portpath for non root hubs Signed-off-by: Hans de Goede --- diff --git a/examples/listdevs.c b/examples/listdevs.c index e3d7ef0..05b3998 100644 --- a/examples/listdevs.c +++ b/examples/listdevs.c @@ -24,7 +24,8 @@ static void print_devs(libusb_device **devs) { libusb_device *dev; - int i = 0; + int i = 0, j = 0; + uint8_t path[8]; while ((dev = devs[i++]) != NULL) { struct libusb_device_descriptor desc; @@ -34,9 +35,21 @@ static void print_devs(libusb_device **devs) return; } - printf("%04x:%04x (bus %d, device %d)\n", + printf("%04x:%04x (bus %d, device %d)", desc.idVendor, desc.idProduct, libusb_get_bus_number(dev), libusb_get_device_address(dev)); + + r = libusb_get_port_path(NULL, dev, path, sizeof(path)); + if (r > 0) + printf(" path: "); + j = 0; + while(j < r) { + printf("%d", path[j]); + j++; + if (j < r) + printf("."); + } + printf("\n"); } } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 3940d93..bc585fc 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10691 +#define LIBUSB_NANO 10692