public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* hid class and USB access
@ 2008-11-08 23:31 Adam Nielsen
  0 siblings, 0 replies; only message in thread
From: Adam Nielsen @ 2008-11-08 23:31 UTC (permalink / raw)
  To: LKML Mailinglist; +Cc: Jiri Slaby

Hi again,

Okay, hopefully one last question.  When writing a hid driver, what's 
the best way of accessing the USB device?  Are there custom hid 
functions you should use instead of the standard USB functions?  I don't 
want to tread on the toes of the hid class driver.

There is a usbhid_submit_report() which seems to send a control message 
to the device which works well, but my device sends interrupt messages 
in response to control messages, and I'm not sure of the best way of 
receiving these.  For example, from usbmon:

3059935847 S Co:8:002:0 s 21 09 0200 0000 0005 5 = 02010101 01
3059939037 C Co:8:002:0 0 5 >
3059943035 C Ii:8:002:1 0:8 8 = 2b181515 140f000b
3059945841 S Ii:8:002:1 -115:8 8 <
3059956862 S Co:8:002:0 s 21 09 0200 0000 0005 5 = 03010101 01
3060121048 C Co:8:002:0 0 5 >
3060127044 C Ii:8:002:1 0:8 8 = 050407dc 00000000
3060131063 S Ii:8:002:1 -115:8 8 <

I can send these control messages like this:

odin_psu->report->field[0]->value[0] = 0x02;
odin_psu->report->field[0]->value[1] = 0x01;
odin_psu->report->field[0]->value[2] = 0x01;
odin_psu->report->field[0]->value[3] = 0x01;
odin_psu->report->field[0]->value[4] = 0x01;
usbhid_submit_report(odin_psu->hdev, odin_psu->report, USB_DIR_OUT);

Resulting in usbmon output like this:

3710917380 S Co:8:002:0 s 21 09 0200 0000 0005 5 = 02010101 01
3710920638 C Co:8:002:0 -71 0

3714917416 S Co:8:002:0 s 21 09 0200 0000 0005 5 = 02010101 01
3714920639 C Co:8:002:0 -71 0

Which seems to send the correct messages (I think - I'm not sure what 
the second Co line is for), but I'm not quite sure how to receive the 
Interrupt responses from within the hid framework.  Can I use 
usbhid_submit_report(), or do I need to create an URB etc.

Many thanks,
Adam.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-08 23:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-08 23:31 hid class and USB access Adam Nielsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox