From patchwork Fri Feb 26 16:17:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 46356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4A7C5B7D00 for ; Sat, 27 Feb 2010 03:42:56 +1100 (EST) Received: from localhost ([127.0.0.1]:48335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nl3HB-0008Pn-Iw for incoming@patchwork.ozlabs.org; Fri, 26 Feb 2010 11:42:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nl2sz-0001h1-BJ for qemu-devel@nongnu.org; Fri, 26 Feb 2010 11:17:53 -0500 Received: from [199.232.76.173] (port=52144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nl2sy-0001gJ-PK for qemu-devel@nongnu.org; Fri, 26 Feb 2010 11:17:52 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nl2st-0004qa-BN for qemu-devel@nongnu.org; Fri, 26 Feb 2010 11:17:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21290) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nl2ss-0004po-J1 for qemu-devel@nongnu.org; Fri, 26 Feb 2010 11:17:46 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1QGHhIj018150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Feb 2010 11:17:43 -0500 Received: from zweiblum.home.kraxel.org (vpn1-4-31.ams2.redhat.com [10.36.4.31]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1QGHfha020266; Fri, 26 Feb 2010 11:17:41 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 4F55070113; Fri, 26 Feb 2010 17:17:39 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 26 Feb 2010 17:17:38 +0100 Message-Id: <1267201059-24145-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1267201059-24145-1-git-send-email-kraxel@redhat.com> References: <1267201059-24145-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v2 3/4] kbd leds: usb kbd X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; }