Re: question about usb_submit_urb

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Wed, 14 Nov 2007, jidong xiao wrote:

> Hi,
>   I don't understand two points in usb_submit_urb(), can anybody
> kindly explain it, thank you.
> 
>     338         switch (temp) {
>     339         case PIPE_ISOCHRONOUS:
>     340         case PIPE_INTERRUPT:
>     341                 /* too small? */
>     342                 if (urb->interval <= 0)
>     343                         return -EINVAL;
>     344                 /* too big? */
>     345                 switch (dev->speed) {
>     346                 case USB_SPEED_HIGH:    /* units are microframes */
>     347                         // NOTE usb handles 2^15
>     348                         if (urb->interval > (1024 * 8))
>     349                                 urb->interval = 1024 * 8;
>     350                         temp = 1024 * 8;
>     351                         break;
>     352                 case USB_SPEED_FULL:    /* units are frames/msec */
>     353                 case USB_SPEED_LOW:
>     354                         if (temp == PIPE_INTERRUPT) {
>     355                                 if (urb->interval > 255)
>     356                                         return -EINVAL;
>     357                                 // NOTE ohci only handles up to 32
>     358                                 temp = 128;
>     359                         } else {
>     360                                 if (urb->interval > 1024)
>     361                                         urb->interval = 1024;
>     362                                 // NOTE usb and ohci handle up to 2^15
>     363                                 temp = 1024;
>     364                         }
>     365                         break;
>     366                 default:
>     367                         return -EINVAL;
>     368                 }
>     369                 /* power of two? */
>     370                 while (temp > urb->interval)
>     371                         temp >>= 1;
>     372                 urb->interval = temp;
>     373         }
> 
> 1. line 348, line 349, for high speed device, if urb->interval is
> greater than 1024*8, set it to 1024*8, why?(Consider usb handles 2^15,
> but 1024*8 is only 2^13.)
> 2. line 360, line 361, for full/low speed device, if pipe is
> isochronous, and if urb->interval is greater than 1024, set it to
> 1024, why?

The host controller drivers don't support intervals longer than 1 
second.  So anything longer than that gets decreased.

Alan Stern


-------------------------------------------------------------------------
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.