Fix timeouts, add debug
authorAndrew Andrianov <andrew@ncrmnt.org>
Mon, 5 Oct 2015 15:58:22 +0000 (18:58 +0300)
committerAndrew Andrianov <andrew@ncrmnt.org>
Mon, 5 Oct 2015 15:58:22 +0000 (18:58 +0300)
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
cp2103.c
pl2303.c
usb.c

index 72ef5be..f158d9d 100644 (file)
--- a/cp2103.c
+++ b/cp2103.c
@@ -91,7 +91,7 @@ void gpio_write_reg(libusb_device_handle *h, uint16_t reg)
                reg,              // wIndex
                0,             // pointer to destination buffer
                0,  // wLength
                reg,              // wIndex
                0,             // pointer to destination buffer
                0,  // wLength
-               6000
+               1000
                );
        handle_error(bytes);
 }
                );
        handle_error(bytes);
 }
index c6c4d69..fb17c19 100644 (file)
--- a/pl2303.c
+++ b/pl2303.c
@@ -50,7 +50,7 @@ char gpio_read_reg(libusb_device_handle *h)
                0,              // wIndex
                &buf,             // pointer to destination buffer
                1,  // wLength
                0,              // wIndex
                &buf,             // pointer to destination buffer
                1,  // wLength
-               100
+               1000
                );
        handle_error(bytes);
        return buf;
                );
        handle_error(bytes);
        return buf;
@@ -66,7 +66,7 @@ void gpio_write_reg(libusb_device_handle *h, unsigned char reg)
                reg,              // wIndex
                0,             // pointer to destination buffer
                0,  // wLength
                reg,              // wIndex
                0,             // pointer to destination buffer
                0,  // wLength
-               6000
+               1000
                );
        handle_error(bytes);
        
                );
        handle_error(bytes);
        
diff --git a/usb.c b/usb.c
index 64b2fe6..905df10 100644 (file)
--- a/usb.c
+++ b/usb.c
@@ -72,6 +72,7 @@ void check_handle(libusb_device_handle **h, int vid, int pid, const char* manuf,
        if (*h)
                return;
        libusb_init(NULL);
        if (*h)
                return;
        libusb_init(NULL);
+       libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_WARNING);
        *h = ncusb_find_and_open(NULL, vid, pid, manuf, product, serial);
        if (!(*h)) {
                fprintf(stderr, "No PL2303 USB device %04x:%04x found ;(\n", vid, pid);
        *h = ncusb_find_and_open(NULL, vid, pid, manuf, product, serial);
        if (!(*h)) {
                fprintf(stderr, "No PL2303 USB device %04x:%04x found ;(\n", vid, pid);