Thread (5 messages) 5 messages, 4 authors, 2010-07-11

Re: Report ID problem with HID-RAW interface usage

From: Jiri Kosina <hidden>
Date: 2010-06-30 09:26:54

Possibly related (same subject, not in this thread)

On Tue, 29 Jun 2010, Alan Ott wrote:
quoted
i am trying to send a vendor specific HID report from a userspace host
program to vendor usb hid device
using HIDRAW interface .


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 .
  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);

   
I thought I'd be able to just go check the HID specification and be able to
say that the report number is not sent as part of the payload for Set_Report
devices, since it would be redundant because the Report ID is sent over in the
wValue field.

Unfortunately, I was not able to see that clearly laid out in the HID
specification in the section on Set_Report. I did however find language saying
"if a Report ID tag was used in the Report descriptor, all reports include a
single byte ID prefix," in section 8.1, Report Types.

I did some tests with the Windows implementation, and indeed, when numbered
reports are used in the HID descriptor, the Windows implementation will send
the report ID as the first byte of the payload.

Based on the language in the HID spec, and the behavior of Windows, I believe
the buf+1, count-1 to be a bug.

Jiri, what do you think? Can you confirm?
Correct, it is a bug indeed.

Does any of you guys already have a patch handy which I could apply? 
Otherwise I'll fix it myself.

Thanks for spotting it,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help