diff options
author | Daniel Drake <dsd@gentoo.org> | 2008-05-09 14:34:31 +0100 |
---|---|---|
committer | Daniel Drake <dsd@gentoo.org> | 2008-05-09 19:33:33 +0100 |
commit | fe4adcc99e30115204ab832ad3e0170c9aca7629 (patch) | |
tree | c439121d3e729bb87f239c4d5b0da205b741174d /examples/lsusb.c | |
parent | 5741bfe01a2481b8c3830c80edc3637bf62a7e16 (diff) | |
download | libusb-fe4adcc99e30115204ab832ad3e0170c9aca7629.tar.gz |
Rework configuration handling
libusb no longer caches descriptors in libusb_device but backends are
intended to be able to provide copies from memory. In the common linux
case we can use sysfs.
Diffstat (limited to 'examples/lsusb.c')
-rw-r--r-- | examples/lsusb.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/lsusb.c b/examples/lsusb.c index 509e0bd..5a83020 100644 --- a/examples/lsusb.c +++ b/examples/lsusb.c @@ -28,10 +28,15 @@ void print_devs(libusb_device **devs) int i = 0; while ((dev = devs[i++]) != NULL) { - const struct libusb_device_descriptor *desc = - libusb_get_device_descriptor(dev); + struct libusb_device_descriptor desc; + int r = libusb_get_device_descriptor(dev, &desc); + if (r < 0) { + fprintf(stderr, "failed to get device descriptor"); + return; + } + printf("%04x:%04x (bus %d, device %d)\n", - desc->idVendor, desc->idProduct, + desc.idVendor, desc.idProduct, libusb_get_bus_number(dev), libusb_get_device_address(dev)); } } |