Commit 2a840a25564059da3f1f8ceed7bd94622dd6b01f
1 parent
9e490f23
renomage
Showing
1 changed file
with
0 additions
and
32 deletions
Show diff stats
test_params.c deleted
@@ -1,32 +0,0 @@ | @@ -1,32 +0,0 @@ | ||
1 | -#include <libusb-1.0/libusb.h> | ||
2 | -#include <stdio.h> | ||
3 | -#include <stdlib.h> | ||
4 | - | ||
5 | -int main(){ | ||
6 | - // init | ||
7 | - libusb_context *context; | ||
8 | - int status = libusb_init(&context); | ||
9 | - if(status != 0){perror("libusb_init"); exit(-1);} | ||
10 | - | ||
11 | - // devices list | ||
12 | - libusb_device **devices; | ||
13 | - ssize_t devices_count = libusb_get_device_list(context, &devices); | ||
14 | - if(devices_count < 0){perror("libusb_get_device_list");exit(-1);} | ||
15 | - for(int i=0; i<devices_count; i++){ | ||
16 | - libusb_device *device = devices[i]; | ||
17 | - | ||
18 | - struct libusb_device_descriptor desc; | ||
19 | - int status = libusb_get_device_descriptor(device, &desc); | ||
20 | - if(status != 0) continue; | ||
21 | - | ||
22 | - uint8_t bus = libusb_get_bus_number(device); | ||
23 | - uint8_t address = libusb_get_device_address(device); | ||
24 | - | ||
25 | - printf("Device Found @ (Bus:Address) %d:%d\n", bus, address); | ||
26 | - printf("Vendor ID 0x0%x\n", desc.idVendor); | ||
27 | - printf("Product ID 0x0%x\n", desc.idProduct); | ||
28 | - } | ||
29 | - libusb_free_device_list(devices, 1); | ||
30 | - | ||
31 | - libusb_exit(context); | ||
32 | -} |