login
Header Space

 
 

USB Driver -- Interrupt Polling -- A Little Help Please

October 9, 2008 - 7:44pm
Submitted by GarryHamilton on October 9, 2008 - 7:44pm.
Linux

I'm writing a Linux driver for a set of proprietary USB 2.0 devices.

It is our desire to keep the driver code in user space.

I'm using Daniel Drake's libusb 1.0 (actually 0.9.3 beta) to drive a variety of gadgets. I, myself, am fairly new to USB, so this is the deep end.

All code (including the library) is in ANSI C, compiled using gcc under Kubuntu 7.1 on a stock Dell desktop.

The driver detects all buses and devices. Driver is able to obtain vendor and product ID values and strings. Driver is able to open the devices and claim interfaces. Driver is able to send commands and queries to the device and obtain data from the device.

However.

These devices require interrupt polling as a keep-alive.

In exploring the USB core code for the Linux kernel driver, I find that there is a function that fills interrupt URB structures with various values including an "interval" value used to determine polling repetition.

Submitting the interrupt URB does not seem to cause this polling within libusb 1.0, and this would be, I imagine, because libusb does not implement any internal threading.

It seems this polling is left as an exercise for my driver.

What I need is some guidance from someone who has implemented interrupt polling for USB 2.0 and can provide some direction in mechanizing this polling.

(BTW, the callbacks are working, as I can force them to fire through timeouts.)

So, anyone?

Thanx in advance.

~~ Garry

speck-geostationary