listdevs: Also print portpath for non root hubs
authorHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 20:36:26 +0000 (22:36 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 20:36:26 +0000 (22:36 +0200)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
examples/listdevs.c
libusb/version_nano.h

index e3d7ef0..05b3998 100644 (file)
@@ -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");
        }
 }
 
index 3940d93..bc585fc 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10691
+#define LIBUSB_NANO 10692