Commit 17fb268e authored by Henrik Nordstrom's avatar Henrik Nordstrom
Browse files

fel: Increase timeout to 60 seconds instead of splitting bulk transfers

parent 114aabc6
...@@ -47,14 +47,13 @@ static const int AW_USB_WRITE = 0x12; ...@@ -47,14 +47,13 @@ static const int AW_USB_WRITE = 0x12;
static const int AW_USB_FEL_BULK_EP_OUT=0x01; static const int AW_USB_FEL_BULK_EP_OUT=0x01;
static const int AW_USB_FEL_BULK_EP_IN=0x82; static const int AW_USB_FEL_BULK_EP_IN=0x82;
static const int AW_USB_MAX_BULK_SEND=64*1024; // 64KB per bulk request static int timeout = 60000;
void usb_bulk_send(libusb_device_handle *usb, int ep, const void *data, int length) void usb_bulk_send(libusb_device_handle *usb, int ep, const void *data, int length)
{ {
int rc, sent; int rc, sent;
while (length > 0) { while (length > 0) {
int len = length < AW_USB_MAX_BULK_SEND ? length : AW_USB_MAX_BULK_SEND; rc = libusb_bulk_transfer(usb, ep, (void *)data, length, &sent, timeout);
rc = libusb_bulk_transfer(usb, ep, (void *)data, len, &sent, 1000);
if (rc != 0) { if (rc != 0) {
errno = EIO; errno = EIO;
perror("usb send"); perror("usb send");
...@@ -69,7 +68,7 @@ void usb_bulk_recv(libusb_device_handle *usb, int ep, void *data, int length) ...@@ -69,7 +68,7 @@ void usb_bulk_recv(libusb_device_handle *usb, int ep, void *data, int length)
{ {
int rc, recv; int rc, recv;
while (length > 0) { while (length > 0) {
rc = libusb_bulk_transfer(usb, ep, data, length, &recv, 1000); rc = libusb_bulk_transfer(usb, ep, data, length, &recv, timeout);
if (rc != 0) { if (rc != 0) {
errno = EIO; errno = EIO;
perror("usb recv"); perror("usb recv");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment