ref: 9204ed8910fd0ddf7186c154a650586674fec641
parent: d9ea4a71b9438507fd28413259b22123df20f8ee
author: ftrvxmtrx <devnull@localhost>
date: Fri Apr 18 12:43:43 EDT 2014
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.
--- a/sys/src/cmd/nusb/kb/hid.h
+++ b/sys/src/cmd/nusb/kb/hid.h
@@ -7,6 +7,7 @@
/* HID class subclass protocol ids */
PtrCSP = 0x020103, /* mouse.boot.hid */
+ Ptr2CSP = 0x000003, /* could be a trackpoint */
KbdCSP = 0x010103, /* keyboard.boot.hid */
/* Requests */
--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -255,10 +255,12 @@
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 @@
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);
}