From patchwork Fri Mar 25 13:40:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 662221 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2PDefoB019060 for ; Fri, 25 Mar 2011 13:40:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753210Ab1CYNkP (ORCPT ); Fri, 25 Mar 2011 09:40:15 -0400 Received: from adelie.canonical.com ([91.189.90.139]:56250 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752400Ab1CYNkO (ORCPT ); Fri, 25 Mar 2011 09:40:14 -0400 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Q37FN-00016O-CE; Fri, 25 Mar 2011 13:40:13 +0000 Received: from c-69-254-227-224.hsd1.ks.comcast.net ([69.254.227.224] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Q37FN-00063F-2o; Fri, 25 Mar 2011 13:40:13 +0000 From: Seth Forshee To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] Input: sparse-keymap - report KEY_UNKNOWN for unknown scan codes Date: Fri, 25 Mar 2011 08:40:03 -0500 Message-Id: <1301060403-19229-3-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1301060403-19229-1-git-send-email-seth.forshee@canonical.com> References: <20110325073554.GD2590@core.coreip.homeip.net> <1301060403-19229-1-git-send-email-seth.forshee@canonical.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 25 Mar 2011 13:40:41 +0000 (UTC) diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c index 74bca5d..fdb6a39 100644 --- a/drivers/input/sparse-keymap.c +++ b/drivers/input/sparse-keymap.c @@ -209,6 +209,7 @@ int sparse_keymap_setup(struct input_dev *dev, } if (test_bit(EV_KEY, dev->evbit)) { + __set_bit(KEY_UNKNOWN, dev->keybit); __set_bit(EV_MSC, dev->evbit); __set_bit(MSC_SCAN, dev->mscbit); } @@ -311,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, { const struct key_entry *ke = sparse_keymap_entry_from_scancode(dev, code); + struct key_entry unknown_ke; if (ke) { sparse_keymap_report_entry(dev, ke, value, autorelease); return true; } + /* Report an unknown key event as a debugging aid */ + unknown_ke.type = KE_KEY; + unknown_ke.code = code; + unknown_ke.keycode = KEY_UNKNOWN; + sparse_keymap_report_entry(dev, &unknown_ke, value, true); + return false; } EXPORT_SYMBOL(sparse_keymap_report_event);