summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorftrvxmtrx <devnull@localhost>2014-04-18 16:43:43 +0200
committerftrvxmtrx <devnull@localhost>2014-04-18 16:43:43 +0200
commit9204ed8910fd0ddf7186c154a650586674fec641 (patch)
tree4486fb6624ecf077f6e9083c9b2a40f47ee58c4c
parentd9ea4a71b9438507fd28413259b22123df20f8ee (diff)
nusb/kb: fix trackpoint on thinkpad usb keyboard
The trackpoint has no subclass, but it's still a pointer device. Also close the device while we are here.
-rw-r--r--sys/src/cmd/nusb/kb/hid.h1
-rw-r--r--sys/src/cmd/nusb/kb/kb.c9
2 files changed, 7 insertions, 3 deletions
diff --git a/sys/src/cmd/nusb/kb/hid.h b/sys/src/cmd/nusb/kb/hid.h
index 0456da61d..9eabbc783 100644
--- a/sys/src/cmd/nusb/kb/hid.h
+++ b/sys/src/cmd/nusb/kb/hid.h
@@ -7,6 +7,7 @@ enum {
/* HID class subclass protocol ids */
PtrCSP = 0x020103, /* mouse.boot.hid */
+ Ptr2CSP = 0x000003, /* could be a trackpoint */
KbdCSP = 0x010103, /* keyboard.boot.hid */
/* Requests */
diff --git a/sys/src/cmd/nusb/kb/kb.c b/sys/src/cmd/nusb/kb/kb.c
index 695dc9ec6..148cc8e53 100644
--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -255,10 +255,12 @@ static int
setproto(KDev *f, int eid)
{
int id, proto;
+ Iface *iface;
proto = Bootproto;
- id = f->dev->usb->ep[eid]->iface->id;
- if(f->dev->usb->ep[eid]->iface->csp == PtrCSP){
+ iface = f->dev->usb->ep[eid]->iface;
+ id = iface->id;
+ if(iface->csp == PtrCSP || iface->csp == Ptr2CSP){
f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, id,
f->rep, sizeof(f->rep));
if(f->nrep > 0){
@@ -809,8 +811,9 @@ threadmain(int argc, char* argv[])
continue;
if(ep->type == Eintr && ep->dir == Ein && ep->iface->csp == KbdCSP)
kbstart(d, ep, "/dev/kbin", kbdwork);
- if(ep->type == Eintr && ep->dir == Ein && ep->iface->csp == PtrCSP)
+ if(ep->type == Eintr && ep->dir == Ein && (ep->iface->csp == PtrCSP || ep->iface->csp == Ptr2CSP))
kbstart(d, ep, "/dev/mousein", ptrwork);
}
+ closedev(d);
threadexits(nil);
}