diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-05-07 09:19:53 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-05-07 09:19:53 +0200 |
commit | 3a4a3faf291b21624a4521fe1e22aec5bec7843d (patch) | |
tree | 36a6d81c497d510db350d0e94cabacab32b75a0a /sys/src/cmd/nusb/kb/kb.c | |
parent | ceed9b8853ab7b10e5a9e39704e712bfce53ce8a (diff) |
nusb/usbd: work around devices that ignore the high byte of wLength in control transfer reads
there appear to be devices out there such as Realtek RTL2838UHIDIR
SDR that do not process control transfers correctly, ignoring the
high byte of the wLength field. to work around this, we specify an
odd number of bytes for read sizes >= 256 which keeps the low byte
0xFF.
Diffstat (limited to 'sys/src/cmd/nusb/kb/kb.c')
-rw-r--r-- | sys/src/cmd/nusb/kb/kb.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/src/cmd/nusb/kb/kb.c b/sys/src/cmd/nusb/kb/kb.c index ccc8b3058..8d481aaee 100644 --- a/sys/src/cmd/nusb/kb/kb.c +++ b/sys/src/cmd/nusb/kb/kb.c @@ -42,7 +42,12 @@ struct Hiddev /* report descriptor */ int nrep; - uchar rep[512]; + + /* + * use odd size as some devices ignore the high byte of + * wLength in control transfer reads. + */ + uchar rep[512-1]; }; typedef struct Hidreport Hidreport; |