public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Nielsen <a.nielsen@shikadi.net>
To: Jiri Kosina <jkosina@suse.cz>
Cc: LKML Mailinglist <linux-kernel@vger.kernel.org>
Subject: Re: usbhid: How to wait for response after submitting report
Date: Sat, 27 Mar 2010 21:52:23 +1000	[thread overview]
Message-ID: <4BADF177.1070201@shikadi.net> (raw)
In-Reply-To: <alpine.LNX.2.00.1003151706330.18642@pobox.suse.cz>

>> I'm working on a USB HID driver, but my driver seems to be receiving bad data.
>>  I think it's because usbhid_submit_report is non-blocking and I'm not
>> correctly waiting for a response.  I'm not sure though, because none of the
>> existing usbhid drivers seem to work in this way.
>>
>> Could someone please let me know if I'm going about this the right way?
> 
> I am afraid you'll have to explain in more detail what exactly you are 
> tying to achieve, and why the way the current HID code does it (i.e. URB 
> gets submitted, completion handler is called when completed) doesn't work 
> for you.

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.

Many thanks,
Adam.

  reply	other threads:[~2010-03-27 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-13  3:10 usbhid: How to wait for response after submitting report Adam Nielsen
2010-03-15 16:07 ` Jiri Kosina
2010-03-27 11:52   ` Adam Nielsen [this message]
2010-03-30 12:10     ` Jiri Kosina
2010-03-30 12:21       ` Adam Nielsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BADF177.1070201@shikadi.net \
    --to=a.nielsen@shikadi.net \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox