summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}