HIDRAW handling of non-numbered reports doesn't match documentation

From: Andrzej Szombierski <hidden>
Date: 2024-06-03 10:14:53

Hi,

I've recently encountered a discrepancy in the hidraw device's handling 
of non-numbered reports on HIDIOCGINPUT and HIDIOCGOUTPUT. The docs 
state that "For devices which do not use numbered reports, the report 
data will begin at the first byte of the returned buffer". The actual 
implementation doesn't follow this rule, and always prepends a report ID 
(in this case: zero). I've linked an example reproducer at the end.

This issue was actually raised before by Andrey Smirnov, but the 
discussion seems to have sidetracked towards implementation details.

https://lore.kernel.org/linux-input/CADyDSO4uh6b+sSZTkZ2_DR923=bA=kXgK1LqUMkknCMzf_DSwQ@mail.gmail.com/ (local)

The main question is: will this behavior be modified to match the 
documentation someday? This would necessarily break any userspace 
already using hidraw. Or should this be now considered a documentation bug?

Example code: 
https://gist.github.com/anszom/e681df62b53209082a1798836edadff3

$ sudo ./hidraw  /dev/hidraw3
Testing device: Logitech USB Receiver
Device uses numbered reports: NO
input report 0 = 00 01 00 00 00 00 00 00 (ctrl key pressed)
output report 0 = 00 02 00 00 00 00 00 00 (caps lock LED on)

-- 

Andrzej Szombierski

qq@kuku.eu.org
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help