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@xxxxxxxxxxxxxx/
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@xxxxxxxxxxx