non-blocking reap and fusb default buffer size change
authorttsou <ttsou@vt.edu>
Tue, 25 Aug 2009 22:46:14 +0000 (18:46 -0400)
committerttsou <ttsou@vt.edu>
Tue, 15 Sep 2009 22:06:27 +0000 (18:06 -0400)
usrp/host/lib/fusb_libusb1.cc
usrp/host/lib/fusb_sysconfig_libusb1.cc

index 0559022bbed5b862ca272096028eb929807e9353..6f1fc913f5816fd7a59c78872d662f9162900726 100644 (file)
@@ -268,8 +268,18 @@ bool
 fusb_devhandle_libusb1::_reap (bool ok_to_block_p)
 {
   int ret;
+  struct timeval tv;
 
-  if ((ret = libusb_handle_events(d_ctx)) < 0) {
+  if (ok_to_block_p) {
+    tv.tv_sec = 2;
+    tv.tv_usec =  0;
+  }
+  else {
+    tv.tv_sec = 0;
+    tv.tv_usec =  0;
+  }
+  if ((ret = libusb_handle_events_timeout(d_ctx, &tv)) < 0) {
     fprintf (stderr, "fusb::_reap libusb_handle_events()\n");
     return false;
   }
@@ -281,11 +291,6 @@ void
 fusb_devhandle_libusb1::_wait_for_completion ()
 {
 
-  int ret;
-  struct timeval tv;
-  tv.tv_sec = 1;
-  tv.tv_usec =  0;
-
   while (!d_pending_rqsts.empty ()) 
     if (!_reap(true)) 
       break; 
index c82bfe9a166b34f6068ff4830c20fd05fa529793..a005f540d242dfa4bb97f9e6dc5e6a2b94595f75 100644 (file)
@@ -25,7 +25,7 @@
 
 static const int MAX_BLOCK_SIZE = 16 * 1024;           // hard limit
 static const int DEFAULT_BLOCK_SIZE =   4 * 1024;
-static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB
+static const int FUSB_BUFFER_SIZE = 1 * (1L << 20);    // 1 MB
 
 struct libusb_context;