[linux-usb-devel] Using actual_length for error checks on bulk and isoc urbs?

Alan Stern stern at rowland.harvard.edu
Mon Nov 21 10:13:40 EST 2005


On Sun, 20 Nov 2005, Stanislaw Gruszka wrote:

> Hi
> 
> Usbatm need code to check correctness of both bulk and isoc 
> urb. Now urb->status is used howewer it seems uhci driver 
> set negative urb->status if error occurs on at least one frame, 
> even if all others are ok. (This is problem for eagle ADSL usb
> modems in isoc mode, as modem produce lot frames with 
> -EILSEQ error mixed with valid packets)
> 
> So my question is if urb->actual_length can be used for 
> check error on both isoc and bulk urbs whitout using 
> conditionals for distinguish pipes, for example:
> 
> if (likely(urb->actual_length > 0))  {
> 	/* we have good bulk urb or at least one good isoc frame */
> 	...
> } else 
> 	print_error(urb->status);
> 
> I think this code will work if:
> 1) for isoc urb: urb->actual_length is equal sum actual_length of all frames
> 2) if error occurs on urb/frame - actual_length is equal 0
> 
> Is 1) and 2) true?

With uhci-hcd 1) is true.

I don't understand 2).  If an error occurs in a bulk or iso URB,
urb->actual_length may still be larger than 0.  If an error occurs in an
iso frame, urb->frame_desc[i].actual_length may still be larger than 0 and
urb->frame_desc[i].status may still be 0 (since iso errors often are
undetectable).  Does that answer your question?

Alan Stern




More information about the Usbatm mailing list