changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: nusb/kb: work arround broken split transaction on raspi's dwc otg usb controller

changeset 6833: 5c8c5fbd94ce
parent 6832: f80792d28e0e
child 6834: be4c5c8a5e37
author: cinap_lenrek@felloff.net
date: Sat, 20 Oct 2018 19:57:37 +0200
files: sys/src/cmd/nusb/kb/hid.h sys/src/cmd/nusb/kb/kb.c
description: nusb/kb: work arround broken split transaction on raspi's dwc otg usb controller
     1.1--- a/sys/src/cmd/nusb/kb/hid.h
     1.2+++ b/sys/src/cmd/nusb/kb/hid.h
     1.3@@ -15,6 +15,7 @@ enum {
     1.4 	Getreport = 0x01,
     1.5 	Setreport = 0x09,
     1.6 	Getproto	= 0x03,
     1.7+	Setidle		= 0x0a,
     1.8 	Setproto	= 0x0b,
     1.9 
    1.10 	/* protocols for SET_PROTO request */
     2.1--- a/sys/src/cmd/nusb/kb/kb.c
     2.2+++ b/sys/src/cmd/nusb/kb/kb.c
     2.3@@ -299,12 +299,19 @@ repparse(uchar *d, uchar *e,
     2.4 static int
     2.5 setproto(Hiddev *f, int eid)
     2.6 {
     2.7-	int id, proto;
     2.8+	int proto;
     2.9 	Iface *iface;
    2.10 
    2.11 	iface = f->dev->usb->ep[eid]->iface;
    2.12-	id = iface->id;
    2.13-	f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, id, 
    2.14+
    2.15+	/*
    2.16+	 * DWC OTG controller misses some split transaction inputs.
    2.17+	 * Set nonzero idle time to return more frequent reports
    2.18+	 * of keyboard state, to avoid losing key up/down events.
    2.19+	 */
    2.20+	usbcmd(f->dev, Rh2d|Rclass|Riface, Setidle, 8<<8, iface->id, nil, 0);
    2.21+
    2.22+	f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, iface->id,
    2.23 		f->rep, sizeof(f->rep));
    2.24 	if(f->nrep > 0){
    2.25 		if(debug){
    2.26@@ -335,7 +342,7 @@ setproto(Hiddev *f, int eid)
    2.27 		}
    2.28 		proto = Bootproto;
    2.29 	}
    2.30-	return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil, 0);
    2.31+	return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, iface->id, nil, 0);
    2.32 }
    2.33 
    2.34 static int