aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-08-04 14:22:37 -0400
committerJosh Blum <josh@joshknows.com>2012-08-04 14:22:37 -0400
commit3f69288e820c91f10927a00d7c7d66dd488492a7 (patch)
treec37425138f19b97bbba57f42bd6f56c786730b35 /host/lib/transport
parent1435a43ff10020746b4ad1c3a8d21058ef36aa31 (diff)
parentd18fc6f0f1fe934cd8684171d966561a36fb134c (diff)
downloaduhd-3f69288e820c91f10927a00d7c7d66dd488492a7.tar.gz
uhd-3f69288e820c91f10927a00d7c7d66dd488492a7.tar.bz2
uhd-3f69288e820c91f10927a00d7c7d66dd488492a7.zip
Merge branch 'master' into next
Diffstat (limited to 'host/lib/transport')
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index c13384eec..28bff9709 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2012 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -177,6 +177,23 @@ public:
_handle->claim_interface(recv_interface);
_handle->claim_interface(send_interface);
+ //flush the buffers out of the recv endpoint
+ //limit the flushing to at most one second
+ for (size_t i = 0; i < 100; i++)
+ {
+ unsigned char buff[512];
+ int transfered = 0;
+ const int status = libusb_bulk_transfer(
+ _handle->get(), // dev_handle
+ (recv_endpoint & 0x7f) | 0x80, // endpoint
+ static_cast<unsigned char *>(buff),
+ sizeof(buff),
+ &transfered, //bytes xfered
+ 10 //timeout ms
+ );
+ if (status == LIBUSB_ERROR_TIMEOUT) break;
+ }
+
//allocate libusb transfer structs and managed receive buffers
for (size_t i = 0; i < get_num_recv_frames(); i++){