Re: USB interrupt URB programming question

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Fri, 16 Feb 2007, Sven Anders wrote:

> Some idea I had myself.
> Is it possible to use a mix? My idea is as follows:
> 
> Variant 1:
>  If the completion handler decides, that there is no finger on the touchpad
>  any more, it does not call usb_submit_urb() again. The completion handler
>  stops. Via an kernel timer I will call the completion handler to test, if
>  there is a finger on the touchpad again. If so, I will restart the interrupt
>  handler and will call usb_submit_urb() until I have no finger on the pad
>  again.

That will work.  (Except that a kernel timer routine can't call the 
completion handler.  It will have to resubmit the interrupt URB.)

> Variant 2:
>  If the is no finger on the touchpad, I will make the interval longer until
>  I have a finger on the pad again...
> 
> For variant 2 I want to know, if it is sufficent to set the 'interval'
> variable in the urb struct to a new value or do I have to call a function?!

You don't have to call a function; setting the "interval" field is all you 
need to do.

However, you cannot do it in a completion handler.  If the completion 
handler tries to change urb->interval and then calls usb_submit_urb(), it 
won't work.  Either urb->interval will get changed back to its old value 
or else usb_submit_urb() will return an error.

Also you should bear in mind that host controller drivers have upper 
limits for the interval.  For example with uhci-hcd, urb->interval cannot 
be larger than 128 (and I'm planning to reduce the upper limit to 32).

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[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.