Skip to content

Commit

Permalink
update timer to take into account ms
Browse files Browse the repository at this point in the history
  • Loading branch information
jlegault committed Nov 23, 2021
1 parent 4f82156 commit 5d3fef6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion qdl_src/firehose.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static int firehose_read(struct qdl_device *qdl, int timeout_ms,
timeradd(&now, &delta, &timeout);

for (;;) {
n = qdl_read(qdl, buf, sizeof(buf), 100);
n = qdl_read(qdl, buf, sizeof(buf), timeout_ms);
if (n < 0) {
gettimeofday(&now, NULL);
if (timercmp(&now, &timeout, <))
Expand Down
6 changes: 3 additions & 3 deletions qdl_src/qdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void usb_open(struct qdl_device *qdl) {
int qdl_read(struct qdl_device *qdl, void *buf, size_t len, unsigned int timeout) {

int transferred,
ret = libusb_bulk_transfer(qdl->handle, qdl->in_ep, buf, len, &transferred, timeout);
ret = libusb_bulk_transfer(qdl->handle, qdl->in_ep, buf, len, &transferred, timeout / 1000);
return ret ? ret : transferred;
}

Expand All @@ -252,7 +252,7 @@ int qdl_write(struct qdl_device *qdl, const void *buf, size_t len, unsigned int
unsigned char *data = (unsigned char *) buf;
while (size > 0) {
int xfer = (size > qdl->out_maxpktsize) ? qdl->out_maxpktsize : size;
ret = libusb_bulk_transfer(qdl->handle, qdl->out_ep, data, xfer, &transferred, timeout);
ret = libusb_bulk_transfer(qdl->handle, qdl->out_ep, data, xfer, &transferred, timeout / 1000);
if (ret) {
err(1, "libusb_bulk_transfer error");
}
Expand All @@ -262,7 +262,7 @@ int qdl_write(struct qdl_device *qdl, const void *buf, size_t len, unsigned int
}

if (len % qdl->out_maxpktsize == 0) {
ret = libusb_bulk_transfer(qdl->handle, qdl->out_ep, NULL, 0, &transferred, timeout);
ret = libusb_bulk_transfer(qdl->handle, qdl->out_ep, NULL, 0, &transferred, timeout / 1000);
if (ret) {
err(1, "libusb_bulk_transfer error");
}
Expand Down

0 comments on commit 5d3fef6

Please sign in to comment.