提交 bd87813e 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

kbd leds: usb kbd

Add led status notification support to the usb kbd driver.
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 6937b376
......@@ -600,12 +600,20 @@ static int usb_keyboard_poll(USBKeyboardState *s, uint8_t *buf, int len)
static int usb_keyboard_write(USBKeyboardState *s, uint8_t *buf, int len)
{
if (len > 0) {
int ledstate = 0;
/* 0x01: Num Lock LED
* 0x02: Caps Lock LED
* 0x04: Scroll Lock LED
* 0x08: Compose LED
* 0x10: Kana LED */
s->leds = buf[0];
if (s->leds & 0x04)
ledstate |= QEMU_SCROLL_LOCK_LED;
if (s->leds & 0x01)
ledstate |= QEMU_NUM_LOCK_LED;
if (s->leds & 0x02)
ledstate |= QEMU_CAPS_LOCK_LED;
kbd_put_ledstate(ledstate);
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册