ref: bb33ba6b9af392e39d6e4f49814384cb825cc90f
parent: 634c55543a24e459900fdbad229eb01baae63680
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);
}