From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkZFr-000685-5o for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:39:31 -0500 Received: from [199.232.76.173] (port=33646 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkZFo-00067I-5s for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:39:28 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkZFn-0007Yj-3J for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:39:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15594) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkZFm-0007YV-70 for qemu-devel@nongnu.org; Thu, 25 Feb 2010 03:39:26 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1P8dODu005351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Feb 2010 03:39:24 -0500 From: Gerd Hoffmann Date: Thu, 25 Feb 2010 09:39:20 +0100 Message-Id: <1267087161-15204-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1267087161-15204-1-git-send-email-kraxel@redhat.com> References: <1267087161-15204-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] kbd leds: usb kbd List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Add led status notification support to the usb kbd driver. Signed-off-by: Gerd Hoffmann --- hw/usb-hid.c | 8 ++++++++ 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; } -- 1.6.6