diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-10-20 19:57:37 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-10-20 19:57:37 +0200 |
commit | 5bb7240ee93111a7c73adaedc0dabfa0caacbe25 (patch) | |
tree | a16cfee0c09c0ef418329952a6e080948ae50005 | |
parent | 83e20b4df18d539db59c8e1090f77a6565df250e (diff) |
nusb/kb: work arround broken split transaction on raspi's dwc otg usb controller
-rw-r--r-- | sys/src/cmd/nusb/kb/hid.h | 1 | ||||
-rw-r--r-- | sys/src/cmd/nusb/kb/kb.c | 15 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sys/src/cmd/nusb/kb/hid.h b/sys/src/cmd/nusb/kb/hid.h index e9066ffee..10e614f4b 100644 --- a/sys/src/cmd/nusb/kb/hid.h +++ b/sys/src/cmd/nusb/kb/hid.h @@ -15,6 +15,7 @@ enum { Getreport = 0x01, Setreport = 0x09, Getproto = 0x03, + Setidle = 0x0a, Setproto = 0x0b, /* protocols for SET_PROTO request */ diff --git a/sys/src/cmd/nusb/kb/kb.c b/sys/src/cmd/nusb/kb/kb.c index f2417147d..eb9a9bbed 100644 --- a/sys/src/cmd/nusb/kb/kb.c +++ b/sys/src/cmd/nusb/kb/kb.c @@ -299,12 +299,19 @@ repparse(uchar *d, uchar *e, static int setproto(Hiddev *f, int eid) { - int id, proto; + int proto; Iface *iface; iface = f->dev->usb->ep[eid]->iface; - id = iface->id; - f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, id, + + /* + * DWC OTG controller misses some split transaction inputs. + * Set nonzero idle time to return more frequent reports + * of keyboard state, to avoid losing key up/down events. + */ + usbcmd(f->dev, Rh2d|Rclass|Riface, Setidle, 8<<8, iface->id, nil, 0); + + f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, iface->id, f->rep, sizeof(f->rep)); if(f->nrep > 0){ if(debug){ @@ -335,7 +342,7 @@ setproto(Hiddev *f, int eid) } proto = Bootproto; } - return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil, 0); + return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, iface->id, nil, 0); } static int |