Index: emcore/trunk/tools/emcorefs/usb.c |
— | — | @@ -26,9 +26,9 @@ |
27 | 27 | #include "util.h"
|
28 | 28 | #include "usb.h"
|
29 | 29 |
|
30 | | -libusb_context *usb_ctx = NULL;
|
31 | | -libusb_device_handle *usb_handle = NULL;
|
32 | | -uint8_t usb_iface_num = 0;
|
| 30 | +libusb_context *usb_ctx;
|
| 31 | +libusb_device_handle *usb_handle;
|
| 32 | +uint8_t usb_iface_num;
|
33 | 33 |
|
34 | 34 | int32_t usb_init(void) {
|
35 | 35 | int32_t res;
|
— | — | @@ -53,9 +53,10 @@ |
54 | 54 |
|
55 | 55 | int32_t usb_find(uint16_t vendor_id, uint16_t product_id, uint8_t *reattach) {
|
56 | 56 | libusb_device **devs, *dev = NULL;
|
57 | | - ssize_t devs_cnt, i, j, k, l;
|
| 57 | + ssize_t devs_cnt, i;
|
| 58 | + uint8_t found = 0, j, k;
|
| 59 | + int l;
|
58 | 60 | int32_t res;
|
59 | | - uint8_t found = 0;
|
60 | 61 | struct libusb_device_descriptor dev_desc;
|
61 | 62 | struct libusb_config_descriptor *cfg_desc;
|
62 | 63 | const struct libusb_interface *iface;
|
— | — | @@ -72,18 +73,18 @@ |
73 | 74 | }
|
74 | 75 |
|
75 | 76 | #ifdef DEBUG
|
76 | | - fprintf(stderr, "Found %Zd USB devices!\n", devs_cnt);
|
| 77 | + fprintf(stderr, "Found %zd USB devices!\n", devs_cnt);
|
77 | 78 | #endif
|
78 | 79 | for (i = 0; i < devs_cnt; ++i) {
|
79 | 80 | dev = devs[i];
|
80 | 81 | #ifdef DEBUG
|
81 | | - fprintf(stderr, "Getting device descriptor of USB device %d...\n", i);
|
| 82 | + fprintf(stderr, "Getting device descriptor of USB device %zd...\n", i);
|
82 | 83 | #endif
|
83 | 84 | res = libusb_get_device_descriptor(dev, &dev_desc);
|
84 | 85 |
|
85 | 86 | if (res != LIBUSB_SUCCESS) {
|
86 | 87 | #ifdef DEBUG
|
87 | | - fprintf(stderr, "Unable to get device descriptor of device %d!\n", i);
|
| 88 | + fprintf(stderr, "Unable to get device descriptor of device %zd!\n", i);
|
88 | 89 | #endif
|
89 | 90 | continue;
|
90 | 91 | }
|
— | — | @@ -108,12 +109,12 @@ |
109 | 110 | }
|
110 | 111 |
|
111 | 112 | #ifdef DEBUG
|
112 | | - fprintf(stderr, "Found %Zd configs...\n", dev_desc.bNumConfigurations);
|
| 113 | + fprintf(stderr, "Found %u configs...\n", dev_desc.bNumConfigurations);
|
113 | 114 | #endif
|
114 | 115 |
|
115 | 116 | for (j = 0; j < dev_desc.bNumConfigurations; ++j) {
|
116 | 117 | #ifdef DEBUG
|
117 | | - fprintf(stderr, "Getting config descriptor %Zd of device...\n", j);
|
| 118 | + fprintf(stderr, "Getting config descriptor %u of device...\n", j);
|
118 | 119 | #endif
|
119 | 120 |
|
120 | 121 | res = libusb_get_config_descriptor(dev, j, &cfg_desc);
|
— | — | @@ -155,7 +156,7 @@ |
156 | 157 | }
|
157 | 158 |
|
158 | 159 | #ifdef DEBUG
|
159 | | - fprintf(stderr, "emCORE Debugger interface at %Zd\n", iface_desc->bInterfaceNumber);
|
| 160 | + fprintf(stderr, "emCORE Debugger interface at %u\n", iface_desc->bInterfaceNumber);
|
160 | 161 | #endif
|
161 | 162 |
|
162 | 163 | usb_iface_num = iface_desc->bInterfaceNumber;
|