ref: 52267d1ed91e46fe8d850493d504c2d1badf848f
parent: 7641f045debfbc49634c385621cfa14be9dabb7d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Oct 31 16:40:13 EDT 2014
nusb/kb: dont set boot protocol on HidCSP interface when we failed to read report descriptor (thanks aap_) this fixes wireless keyboard/mouse on raspi.
--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -304,7 +304,6 @@
int id, proto;
Iface *iface;
- proto = Bootproto;
iface = f->dev->usb->ep[eid]->iface;
id = iface->id;
f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, id,
@@ -323,13 +322,20 @@
}
proto = Reportproto;
} else {- if(iface->csp == KbdCSP){+ switch(iface->csp){+ case KbdCSP:
f->nrep = sizeof(kbdbootrep);
memmove(f->rep, kbdbootrep, f->nrep);
- } else {+ break;
+ case PtrCSP:
f->nrep = sizeof(ptrbootrep);
memmove(f->rep, ptrbootrep, f->nrep);
+ break;
+ default:
+ werrstr("no report descriptor");+ return -1;
}
+ proto = Bootproto;
}
return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil, 0);
}
--
⑨