diff options
| -rw-r--r-- | sys/src/cmd/nusb/kb/kb.c | 7 | ||||
| -rw-r--r-- | sys/src/cmd/nusb/lib/dev.c | 6 |
2 files changed, 10 insertions, 3 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; diff --git a/sys/src/cmd/nusb/lib/dev.c b/sys/src/cmd/nusb/lib/dev.c index cb79e1582..07e547799 100644 --- a/sys/src/cmd/nusb/lib/dev.c +++ b/sys/src/cmd/nusb/lib/dev.c @@ -136,8 +136,10 @@ enum /* * Max device conf is also limited by max control request size as * limited by Maxctllen in the kernel usb.h (both limits are arbitrary). + * Some devices ignore the high byte of control transfer reads so keep + * the low byte all ones. asking for 16K kills Newsham's disk. */ - Maxdevconf = 4 * 1024, /* asking for 16K kills Newsham's disk */ + Maxdevconf = 4*1024 - 1, }; int @@ -201,7 +203,7 @@ mkstr(uchar *b, int n) char* loaddevstr(Dev *d, int sid) { - uchar buf[256]; + uchar buf[256-2]; /* keep size < 256 */ int langid; int type; int nr; |
