Re: [Linux-usb-users] USB: Non zero status

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Thu, 23 Aug 2007, Martin Bachem wrote:

> Martin Bachem wrote:
> > Meanwhile I received another peace of information:
> > It might happen that at a tx iso completetion with -EXDEV error,
> > resubmitting the URB fails with -EFBIG (too much ISO frames requested).
> > I suppose this is an effect of the same problem. Anyway, as soon I got
> > the messagelog of the start_frames when getting -EXDEV, I tell you.
> 
> Supplement:
> This situation a bit different. Here all ISO packets failed with -EXDEV
> within that URB. I treat this this like no Error by resubmitting the
> URB, but this leads to a complete -EXDEV again and again. When finally a
> submit_urb() failed with -EFBIG, the endpoints is no longer served by
> the driver.
> 
> At all of my previous reports I got the -EXDEV only partially in 3 of 8
> packets within a single URB and no problem with resubmitting...

I think there's no choice but to change the way uhci-hcd allocates Iso 
URBs to frames.  Try this patch, and make sure you always set the 
URB_ISO_ASAP flag on all your URBs.

Alan Stern



Index: usb-2.6/drivers/usb/host/uhci-q.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/uhci-q.c
+++ usb-2.6/drivers/usb/host/uhci-q.c
@@ -1271,7 +1271,8 @@ static int uhci_submit_isochronous(struc
 	} else if (qh->period != urb->interval) {
 		return -EINVAL;		/* Can't change the period */
 
-	} else {	/* Pick up where the last URB leaves off */
+	} else {
+		/* Find the next unused frame */
 		if (list_empty(&qh->queue)) {
 			frame = qh->iso_frame;
 		} else {
@@ -1283,10 +1284,18 @@ static int uhci_submit_isochronous(struc
 					lurb->number_of_packets *
 					lurb->interval;
 		}
-		if (urb->transfer_flags & URB_ISO_ASAP)
-			urb->start_frame = frame;
-		else if (urb->start_frame != frame)
-			return -EINVAL;
+		if (urb->transfer_flags & URB_ISO_ASAP) {
+			/* Skip some frames if necessary to insure
+			 * the start frame is in the future.
+			 */
+			uhci_get_current_frame_number(uhci);
+			if (uhci_frame_before_eq(frame, uhci->frame_number)) {
+				frame = uhci->frame_number + 1;
+				frame += ((qh->phase - frame) &
+					(qh->period - 1));
+			}
+		}	/* Otherwise pick up where the last URB leaves off */
+		urb->start_frame = frame;
 	}
 
 	/* Make sure we won't have to go too far into the future */


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.