[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1003301407320.24576@pobox.suse.cz>
Date: Tue, 30 Mar 2010 14:10:03 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Adam Nielsen <a.nielsen@...kadi.net>
Cc: LKML Mailinglist <linux-kernel@...r.kernel.org>
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists