On Fri, 26 May 2006, Paul Giblock wrote:

> I've been working on my kernel module and everything have been coming
> along nicely.  There is one issue with my device.  If I send two urbs
> to the device without enough wait between the calls then the device
> doesn't respond with status messages anymore.  Is there a kernel
> mechinism available to handle this sort of issue? Note,  I cannot
> always predict two sequential calls. For example, the user may ioctl()
> two times without enough delay.

There isn't really anything suitable.  All URBs for a given device don't
funnel through a single place until fairly deep in usbcore and the host
controller drivers, and neither is a good location for driver-specific
things like inter-URB delays.

Perhaps it will be good enough to limit the timing between URBs generated
by your driver.  URBs coming from somewhere else won't be your
responsibility.

If you want to be really clever, you can keep track of the status messages 
and reset the device if they no longer arrive as expected.

> What would be ideal to to place all these requests on a queue where
> they will be executed in order with no less then TIME_INTERVAL between
> calls.  It would be great if identical requests could be collapsed
> into one.
> 
> I am new to kernel hacking so I don't know if I should be looking into
> waitqueues, workqueues, if I need to make my own data structure, or if
> there is a better way around this problem.

The best approach depends on the context.  If things happen periodically 
(driven by a timer, for example) the simplest approach is to wait for the 
next period if the delay since the previous URB isn't long enough yet.  If 
things happen in a process context you can use msleep().  And so on...

Alan Stern



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to