aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-02-26 17:17:38 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-09 08:47:20 -0600
commitbd87813e8c3adfa1c12f763b35b2dbacc7796f0d (patch)
treea899cedefadac618140bbb05bbb5be4a83567175
parent6937b3766fb47b87a986e7c8010546465de87a4c (diff)
downloadqemu-bd87813e8c3adfa1c12f763b35b2dbacc7796f0d.zip
qemu-bd87813e8c3adfa1c12f763b35b2dbacc7796f0d.tar.gz
qemu-bd87813e8c3adfa1c12f763b35b2dbacc7796f0d.tar.bz2
kbd leds: usb kbd
Add led status notification support to the usb kbd driver. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/usb-hid.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index bf456bb..2e4e647 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -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;
}