diff options
author | Benjamin Dobell <benjamin.dobell+github@glassechidna.com.au> | 2010-12-04 14:43:30 +0100 |
---|---|---|
committer | Benjamin Dobell <benjamin.dobell+github@glassechidna.com.au> | 2010-12-04 14:43:30 +0100 |
commit | 7675cd8a8714406193c28331c9956699ff7d4226 (patch) | |
tree | e2a3c6d3b607211d7f9f15e7568a283919fa2f25 /Heimdall/libusb-1.0/examples/lsusb.c | |
parent | Removed the "Heimdall" folder and moved its contents to the root directory. (diff) | |
download | Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.tar Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.tar.gz Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.tar.bz2 Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.tar.lz Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.tar.xz Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.tar.zst Heimdall-7675cd8a8714406193c28331c9956699ff7d4226.zip |
Diffstat (limited to 'Heimdall/libusb-1.0/examples/lsusb.c')
-rw-r--r-- | Heimdall/libusb-1.0/examples/lsusb.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/Heimdall/libusb-1.0/examples/lsusb.c b/Heimdall/libusb-1.0/examples/lsusb.c deleted file mode 100644 index e36e0c1..0000000 --- a/Heimdall/libusb-1.0/examples/lsusb.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * libusb example program to list devices on the bus - * Copyright (C) 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 - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <sys/types.h> - -#include "libusb.h" - -static void print_devs(libusb_device **devs) -{ - libusb_device *dev; - int i = 0; - - while ((dev = devs[i++]) != NULL) { - 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, - libusb_get_bus_number(dev), libusb_get_device_address(dev)); - } -} - -int main(void) -{ - libusb_device **devs; - int r; - ssize_t cnt; - - r = libusb_init(NULL); - if (r < 0) - return r; - - cnt = libusb_get_device_list(NULL, &devs); - if (cnt < 0) - return (int) cnt; - - print_devs(devs); - libusb_free_device_list(devs, 1); - - libusb_exit(NULL); - return 0; -} - |