On 18/01/15(Sun) 14:17, Martin Pieuchot wrote:
> Hello Benjamin,
>
> On 17/01/15(Sat) 22:40, Benjamin Baier wrote:
> > >Synopsis: usbhidctl(1) -l does not work/loop
> > >Category: user
> > >Environment:
> > System : OpenBSD 5.7
> > Details : OpenBSD 5.7-beta (GENERIC.MP) #0: Fri Jan 16 17:26:49 CET
> > 2015
> >
> > [email protected]:/git/hellfish/src/sys/arch/amd64/compile/GENERIC.MP
> >
> > Architecture: OpenBSD.amd64
> > Machine : amd64
> > >Description:
> > $ usbhidctl -f /dev/uhid1 -l
> > usbhidctl: Unexpected response length: 2 != 3
> >
> > disabling length check (like in usbhidaction(1)) gives
>
> The lengths are different because hid_report_size() adds one for the
> reportID but the kernel skips it.
>
> Could you try the diff below it should fix that. It also include a
> commented out check for usbhidaction(1) that I guess is the same
> problem. Do you also use usbhidaction(1)? Could you try?
>
> > $ usbhidctl -f /dev/uhid1 -l
> > Mute=1
> > usbhidctl: Excessive collection ends
>
> This is more interesting. Could you send me the output of "lsusb -v"
> for your device? You'll find lsusb(1) in the package "usbutils".
Now with the diff below.
Index: lib/libusbhid//parse.c
===================================================================
RCS file: /cvs/src/lib/libusbhid/parse.c,v
retrieving revision 1.9
diff -u -p -r1.9 parse.c
--- lib/libusbhid//parse.c 12 May 2014 17:03:28 -0000 1.9
+++ lib/libusbhid//parse.c 18 Jan 2015 13:08:46 -0000
@@ -541,8 +541,8 @@ hid_report_size(report_desc_t r, enum hi
else
temp = hpos - lpos;
- /* return length in bytes rounded up */
- return ((temp + 7) / 8 + report_id);
+ /* No extra byte for the reportID because the kernel skips it. */
+ return ((temp + 7) / 8);
}
int
Index: usr.bin/usbhidaction//usbhidaction.c
===================================================================
RCS file: /cvs/src/usr.bin/usbhidaction/usbhidaction.c,v
retrieving revision 1.18
diff -u -p -r1.18 usbhidaction.c
--- usr.bin/usbhidaction//usbhidaction.c 15 Aug 2014 03:51:40 -0000
1.18
+++ usr.bin/usbhidaction//usbhidaction.c 18 Jan 2015 13:11:14 -0000
@@ -180,11 +180,9 @@ main(int argc, char **argv)
else
exit(1);
}
-#if 0
if (n != sz) {
err(2, "read size");
}
-#endif
for (cmd = commands; cmd; cmd = cmd->next) {
val = hid_get_data(buf, &cmd->item);
if (cmd->value == val || cmd->anyvalue)