summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorment <thement@ibawizard.net>2011-06-27 22:15:50 +0200
committerment <thement@ibawizard.net>2011-06-27 22:15:50 +0200
commit0918ce10dc7b3e39506b8c4177e68a7b3233f5a9 (patch)
tree3ae5b900169423a51209a8d97785f003df07e5cc
parentd0485d345db63b0ee82301251339e72d6093107d (diff)
downloadplan9front-0918ce10dc7b3e39506b8c4177e68a7b3233f5a9.tar.xz
usb/kb: reset led state on boot
-rw-r--r--sys/src/cmd/usb/kb/hid.h5
-rw-r--r--sys/src/cmd/usb/kb/kb.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/sys/src/cmd/usb/kb/hid.h b/sys/src/cmd/usb/kb/hid.h
index e89c88d0c..dba2b027d 100644
--- a/sys/src/cmd/usb/kb/hid.h
+++ b/sys/src/cmd/usb/kb/hid.h
@@ -10,12 +10,17 @@ enum {
KbdCSP = 0x010103, /* keyboard.boot.hid */
/* Requests */
+ Getreport = 0x01,
+ Setreport = 0x09,
Getproto = 0x03,
Setproto = 0x0b,
/* protocols for SET_PROTO request */
Bootproto = 0,
Reportproto = 1,
+
+ /* protocols for SET_REPORT request */
+ Reportout = 0x0200,
};
enum {
diff --git a/sys/src/cmd/usb/kb/kb.c b/sys/src/cmd/usb/kb/kb.c
index bf4918cc4..0880f5b51 100644
--- a/sys/src/cmd/usb/kb/kb.c
+++ b/sys/src/cmd/usb/kb/kb.c
@@ -124,6 +124,12 @@ setbootproto(KDev* f, int eid)
return usbcmd(f->dev, r, Setproto, Bootproto, id, nil, 0);
}
+static int
+setleds(KDev* f, int eid, uchar leds)
+{
+ return usbcmd(f->dev, Rh2d|Rclass|Riface, Setreport, Reportout, 0, &leds, 1);
+}
+
/*
* Try to recover from a babble error. A port reset is the only way out.
* BUG: we should be careful not to reset a bundle with several devices.
@@ -537,7 +543,10 @@ kbstart(Dev *d, Ep *ep, Kin *in, void (*f)(void*), int accel)
kd->ep = nil;
return;
}
-
+ if(setleds(kd, ep->id, 0) < 0){
+ fprint(2, "kb: %s: setleds: %r\n", d->dir);
+ return;
+ }
incref(d);
proccreate(f, kd, Stack);
}