Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: third_party/libusb/src/examples/listdevs.c

Issue 19713005: Update libusb 1.0.9 to libusbx 1.0.16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/libusb/src/examples/listdevs.c
diff --git a/third_party/libusb/src/examples/listdevs.c b/third_party/libusb/src/examples/listdevs.c
index 6ab891725a36424a7f59d5a8ff2c20a7deaec858..31ad26ea268187d3b34af3f77b9ed3e02c212f93 100644
--- a/third_party/libusb/src/examples/listdevs.c
+++ b/third_party/libusb/src/examples/listdevs.c
@@ -1,6 +1,6 @@
/*
- * libusb example program to list devices on the bus
- * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
+ * libusbx example program to list devices on the bus
+ * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,14 +18,14 @@
*/
#include <stdio.h>
-#include <sys/types.h>
-#include <libusb.h>
+#include "libusb.h"
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;
@@ -35,9 +35,17 @@ 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_numbers(dev, path, sizeof(path));
+ if (r > 0) {
+ printf(" path: %d", path[0]);
+ for (j = 1; j < r; j++)
+ printf(".%d", path[j]);
+ }
+ printf("\n");
}
}
@@ -61,4 +69,3 @@ int main(void)
libusb_exit(NULL);
return 0;
}
-

Powered by Google App Engine
This is Rietveld 408576698