Messages in this thread | | | Date | Tue, 30 Mar 2010 14:10:03 +0200 (CEST) | From | Jiri Kosina <> | Subject | Re: usbhid: How to wait for response after submitting report |
| |
On Sat, 27 Mar 2010, Adam Nielsen wrote:
> Thanks Jiri, it's probably because I still don't know what I'm doing :-) Can > you point me at any HID examples that show how to use a completion handler? > I'm afraid after hours of staring at HID code I'm still none the wiser as to > how this part of the system works. > > Basically I have a USB HID device, and it works by submitting a HID report, > then waiting until it replies with (I assume) another HID report. The > messages are all proprietary. I can send the reports fine, but half the time > I get garbage coming back, which I assume is because I'm not getting the > message quickly enough and processing whatever was in the buffer instead. > > If you're able to point me in the direction of an example showing how to set > up and use a completion handler, hopefully I can change my code to work like > that instead.
Well this is rather more USB-related question than HID related question, I'd say.
Basically you prepare URB, along with specifying which routine should be called by USB core as completion handler, and then submit the URB.
USB HID implementation is working like this (and zillions of other USB drivers which are in kernel do as well) -- just look at initialization of control URB in usbhid_start(), and the completion handler (for control URBs) in hid_ctrl().
-- Jiri Kosina SUSE Labs, Novell Inc.
| |