linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Report ID problem with HID-RAW interface usage
@ 2010-06-29 11:10 Amit Nagal
       [not found] ` <AANLkTinrmRsB39gj7Ie4xCr3fhP3jU1dfYuVrkiKv347-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 31+ messages in thread
From: Amit Nagal @ 2010-06-29 11:10 UTC (permalink / raw)
  To: linux-usb, linux-input; +Cc: Alan Ott

Hi ,

i am trying to send a vendor specific HID report from a userspace host
program to vendor usb hid device
using HIDRAW interface .

the vendor specific report consist of < "Report ID " (0th position ) >
followed by <  "payload of data "  > .
when i send report in this format , i am not getting report response
from the usb device .

but when i send report in the format  < "Report ID "(0th byte ) >
<Report ID (1st byte )> < "data payload ">
i am getting perfect report response from usb device .

when i debugged kernel source code , i found the  function
usbhid_output_raw_report function defined in
drivers/hid/usbhid/hid-core.c
responsible for report transfer , where we use usb_control_msg as  :

ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
		HID_REQ_SET_REPORT,
		USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
		cpu_to_le16(((HID_OUTPUT_REPORT + 1) << 8) | *buf),
		interface->desc.bInterfaceNumber, buf + 1, count - 1,
		USB_CTRL_SET_TIMEOUT);


As we can see above we are passing   " buf + 1 "  , " count - 1 "  to
data and size parameters of usb_control_msg()  function ,
which effectively means that if i make my report  format as <report id
>  < payload >
then in the  data parameter of usb_control_msg function , report id is
stripped off () .
and thats why i am not getting response with above report format .

report responses comes fine if  i  modify usb_control_msg usage as below :

ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
		HID_REQ_SET_REPORT,
		USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
		cpu_to_le16(((HID_OUTPUT_REPORT + 1) << 8) | *buf),
		interface->desc.bInterfaceNumber, buf , count ,
		USB_CTRL_SET_TIMEOUT);

here i passed complete buf and count thereby passing < report id >
also in data params of usb_control_msg .

kindly provide insight and clarity regarding the < report id > ambiguity .


the original usbhid_output_raw_report()  function is  copied below for
reference .

static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf,
size_t count)
{
	struct usbhid_device *usbhid = hid->driver_data;
	struct usb_device *dev = hid_to_usb_dev(hid);
	struct usb_interface *intf = usbhid->intf;
	struct usb_host_interface *interface = intf->cur_altsetting;
	int ret;

	printk("=====>[IPOD HID ][Hid-core.c]%s\n" , __FUNCTION__);

	ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
		HID_REQ_SET_REPORT,
		USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
		cpu_to_le16(((HID_OUTPUT_REPORT + 1) << 8) | *buf),
		interface->desc.bInterfaceNumber, buf + 1, count - 1,
		USB_CTRL_SET_TIMEOUT);

	/* count also the report id */
	if (ret > 0)
		ret++;

	return ret;
}


Thanx & Regards
Amit Nagal

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2010-07-11 21:14 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 11:10 Report ID problem with HID-RAW interface usage Amit Nagal
     [not found] ` <AANLkTinrmRsB39gj7Ie4xCr3fhP3jU1dfYuVrkiKv347-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-29 16:30   ` Alan Ott
2010-06-29 23:32     ` Xiaofan Chen
2010-06-30  7:39       ` Amit Nagal
2010-06-30  7:56         ` Amit Nagal
2010-06-30  7:57           ` Jiri Kosina
     [not found]     ` <4C2A1FA0.6020704-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-06-30  9:26       ` Jiri Kosina
2010-06-30 10:30         ` Amit Nagal
     [not found]           ` <AANLkTilf1JU_GPlqE-FeaRon6IMqgA68WZ964PJfLpSP-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-30 10:55             ` Jiri Kosina
2010-06-30 11:14               ` Amit Nagal
2010-06-30 12:54                 ` Alan Ott
2010-06-30 13:04                   ` Xiaofan Chen
2010-06-30 13:06                     ` Jiri Kosina
2010-06-30 14:09                       ` Xiaofan Chen
     [not found]                         ` <AANLkTil0S747k-MomthJW4dv2WwB-abjZmGmxf3fH59y-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-30 14:32                           ` Alan Ott
2010-06-30 23:33                             ` Xiaofan Chen
2010-06-30 13:13                     ` Antonio Ospite
2010-06-30 14:02                       ` Xiaofan Chen
2010-06-30 14:10                         ` Alan Ott
2010-06-30 14:16                         ` Antonio Ospite
2010-06-30 16:40                   ` Amit Nagal
     [not found]                     ` <AANLkTimb_xMYTZYAm51lmHEkYvrvegwbmkUyJldxYA-f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-01  2:40                       ` Xiaofan Chen
2010-07-01 13:16                       ` Alan Ott
2010-07-02  6:46                         ` Amit Nagal
     [not found]                           ` <AANLkTilFyRjuP4VUmJolYhloDol5B7HsYV9d5SD8vZPo-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-02 15:05                             ` Alan Ott
     [not found]                               ` <4C2E0057.30206-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-07-02 16:19                                 ` Amit Nagal
     [not found]               ` <alpine.LNX.2.00.1006301252380.13809-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2010-06-30 12:32                 ` Alan Ott
     [not found]                   ` <4C2B3956.6080107-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-06-30 12:38                     ` Jiri Kosina
2010-06-30 13:50         ` [PATCH 0/1] HID: Send Report ID when numbered reports are sent over the control endpoint Alan Ott
2010-06-30 13:50         ` [PATCH 1/1] " Alan Ott
     [not found]           ` <1277905836-3949-2-git-send-email-alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-07-11 21:14             ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).