usb/kb: reset led state on boot
This commit is contained in:
parent
d0485d345d
commit
0918ce10dc
2 changed files with 15 additions and 1 deletions
|
@ -10,12 +10,17 @@ enum {
|
||||||
KbdCSP = 0x010103, /* keyboard.boot.hid */
|
KbdCSP = 0x010103, /* keyboard.boot.hid */
|
||||||
|
|
||||||
/* Requests */
|
/* Requests */
|
||||||
|
Getreport = 0x01,
|
||||||
|
Setreport = 0x09,
|
||||||
Getproto = 0x03,
|
Getproto = 0x03,
|
||||||
Setproto = 0x0b,
|
Setproto = 0x0b,
|
||||||
|
|
||||||
/* protocols for SET_PROTO request */
|
/* protocols for SET_PROTO request */
|
||||||
Bootproto = 0,
|
Bootproto = 0,
|
||||||
Reportproto = 1,
|
Reportproto = 1,
|
||||||
|
|
||||||
|
/* protocols for SET_REPORT request */
|
||||||
|
Reportout = 0x0200,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -124,6 +124,12 @@ setbootproto(KDev* f, int eid)
|
||||||
return usbcmd(f->dev, r, Setproto, Bootproto, id, nil, 0);
|
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.
|
* 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.
|
* 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;
|
kd->ep = nil;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(setleds(kd, ep->id, 0) < 0){
|
||||||
|
fprint(2, "kb: %s: setleds: %r\n", d->dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
incref(d);
|
incref(d);
|
||||||
proccreate(f, kd, Stack);
|
proccreate(f, kd, Stack);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue