commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9545 - gnuradio/trunk/usrp/host/lib/legacy


From: eb
Subject: [Commit-gnuradio] r9545 - gnuradio/trunk/usrp/host/lib/legacy
Date: Tue, 9 Sep 2008 09:19:01 -0600 (MDT)

Author: eb
Date: 2008-09-09 09:19:00 -0600 (Tue, 09 Sep 2008)
New Revision: 9545

Modified:
   gnuradio/trunk/usrp/host/lib/legacy/fusb_linux.cc
Log:
trial fix for ticket:288; merged eb/fusb 9543:9544 to trunk

Modified: gnuradio/trunk/usrp/host/lib/legacy/fusb_linux.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/fusb_linux.cc   2008-09-09 15:15:18 UTC 
(rev 9544)
+++ gnuradio/trunk/usrp/host/lib/legacy/fusb_linux.cc   2008-09-09 15:19:00 UTC 
(rev 9545)
@@ -246,7 +246,7 @@
  * If any transactions are reaped return true.
  *
  * If ok_to_block_p is true, then this will block until at least one
- * transaction completes.
+ * transaction completes or an unrecoverable error occurs.
  */
 bool
 fusb_devhandle_linux::_reap (bool ok_to_block_p)
@@ -290,7 +290,8 @@
 fusb_devhandle_linux::_wait_for_completion ()
 {
   while (!d_pending_rqsts.empty ())
-    _reap (true);
+    if (!_reap(true))
+      break;
 }
 // ------------------------------------------------------------------------
 //                          end point handle
@@ -410,7 +411,8 @@
     if (d_free_list.size () == (unsigned) d_nblocks)
       break;
 
-    d_devhandle->_reap(true);
+    if (!d_devhandle->_reap(true))
+      break;
   }
 
   d_started = false;
@@ -440,6 +442,8 @@
   while (n < nbytes){
 
     usbdevfs_urb *urb = get_write_work_in_progress();
+    if (!urb)
+      return -1;
     assert(urb->actual_length == 0);
     int m = std::min(nbytes - n, MAX_BLOCK_SIZE);
     urb->buffer = src;
@@ -474,6 +478,8 @@
   while (n < nbytes){
 
     usbdevfs_urb *urb = get_write_work_in_progress ();
+    if (!urb)
+      return -1;
     unsigned char *dst = (unsigned char *) urb->buffer;
     int m = std::min (nbytes - n, urb->buffer_length - urb->actual_length);
 
@@ -516,7 +522,8 @@
     // The free list is empty.  Tell the device handle to reap.
     // Anything it reaps for us will end up on our completed list.
 
-    d_devhandle->_reap (true);
+    if (!d_devhandle->_reap (true))
+      return 0;
   }
 }
 
@@ -606,19 +613,17 @@
   while (1){
 
     while ((urb = completed_list_get ()) == 0)
-      d_devhandle->_reap (true);
+      if (!d_devhandle->_reap (true))
+       return false;
 
     // check result of completed read
 
     if (urb->status != 0){
-      // We've got a problem.
-      // Report the problem and resubmit.
+      // We've got a problem. Report it and fail.
       fprintf (stderr, "fusb: (rd status %d) %s\n", urb->status, strerror 
(-urb->status));
       urb->actual_length = 0;
-      if (!submit_urb (urb))
-       return false;
-
-      continue;
+      free_list_add (urb);
+      return false;
     }
 
     // we've got a happy urb, full of data...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]