From 9204ed8910fd0ddf7186c154a650586674fec641 Mon Sep 17 00:00:00 2001 From: ftrvxmtrx Date: Fri, 18 Apr 2014 16:43:43 +0200 Subject: 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. --- sys/src/cmd/nusb/kb/hid.h | 1 + sys/src/cmd/nusb/kb/kb.c | 9 ++++++--- 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); } -- cgit v1.2.3