From patchwork Mon Jan 9 22:59:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Palatin X-Patchwork-Id: 135139 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C2CE3B6FC2 for ; Tue, 10 Jan 2012 09:59:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3657F28200; Mon, 9 Jan 2012 23:59:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WSA2gLhLlrfK; Mon, 9 Jan 2012 23:59:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 45E112822F; Mon, 9 Jan 2012 23:59:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2D9822822F for ; Mon, 9 Jan 2012 23:59:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WQKmzACPiXqv for ; Mon, 9 Jan 2012 23:59:45 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-we0-f202.google.com (mail-we0-f202.google.com [74.125.82.202]) by theia.denx.de (Postfix) with ESMTPS id 81CFE28200 for ; Mon, 9 Jan 2012 23:59:43 +0100 (CET) Received: by werf1 with SMTP id f1so167268wer.3 for ; Mon, 09 Jan 2012 14:59:43 -0800 (PST) Received: by 10.213.9.17 with SMTP id j17mr715007ebj.2.1326149983417; Mon, 09 Jan 2012 14:59:43 -0800 (PST) Received: by 10.213.9.17 with SMTP id j17mr714996ebj.2.1326149983208; Mon, 09 Jan 2012 14:59:43 -0800 (PST) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id v41si50547359eea.2.2012.01.09.14.59.43 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 09 Jan 2012 14:59:43 -0800 (PST) Received: from vpa.mtv.corp.google.com (vpa.mtv.corp.google.com [172.22.72.27]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 049EA5C0060; Mon, 9 Jan 2012 14:59:43 -0800 (PST) Received: by vpa.mtv.corp.google.com (Postfix, from userid 125455) id 3C3DF161071; Mon, 9 Jan 2012 14:59:42 -0800 (PST) From: Vincent Palatin To: u-boot Date: Mon, 9 Jan 2012 14:59:36 -0800 Message-Id: <1326149976-19976-1-git-send-email-vpalatin@chromium.org> X-Mailer: git-send-email 1.7.3.1 Cc: Vincent Palatin Subject: [U-Boot] [PATCH] usb: add numeric keypad support to HID driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When keys are pressed on the numeric keypad, emit key codes for the numbers, operators, dot and enter. Signed-off-by: Vincent Palatin --- common/usb_kbd.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index aaf7d6f..2472d25 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -87,6 +87,12 @@ static const unsigned char usb_kbd_numkey_shifted[] = { '|', '~', ':', '"', '~', '<', '>', '?' }; +static const unsigned char usb_kbd_num_keypad[] = { + '/', '*', '-', '+', '\r', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + '.', 0, 0, 0, '=' +}; + /* * NOTE: It's important for the NUM, CAPS, SCROLL-lock bits to be in this * order. See usb_kbd_setled() function! @@ -218,6 +224,10 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode, keycode = usb_kbd_numkey[scancode - 0x1e]; } + /* Numeric keypad */ + if ((scancode >= 0x54) && (scancode <= 0x67)) + keycode = usb_kbd_num_keypad[scancode - 0x54]; + if (data->flags & USB_KBD_CTRL) keycode = scancode - 0x3;