From patchwork Mon Jul 21 01:20:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 4592621 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (unknown [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3D9999F375 for ; Mon, 21 Jul 2014 01:21:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 599FA20109 for ; Mon, 21 Jul 2014 01:21:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65B87200EC for ; Mon, 21 Jul 2014 01:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751754AbaGUBU6 (ORCPT ); Sun, 20 Jul 2014 21:20:58 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:47388 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598AbaGUBU5 (ORCPT ); Sun, 20 Jul 2014 21:20:57 -0400 Received: by mail-pa0-f53.google.com with SMTP id kq14so8670517pab.26 for ; Sun, 20 Jul 2014 18:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=7xXQWTrBwpvx8/xz/N+PbVAhfZ9eOtklTEQaBGlq1bc=; b=m0dnxTMO8pYkvGZ3HiFqY/2XwQoLDU5aw2qOr9n0Lm6avFEDSlbasPMTfdEqlV73b6 GNqEukd9DZE8bSHCggScRadyNJEOS5Rsnr+bWdNDqvqdNxxF7aXwhX7YpQuYL+poHvQF kC6wHstcqaRe9anTw+trkhOz4ogg8v2GRb0e6ctnqXxRuN4UrIXxQUiQa74oYuiAjyh4 khK4RTfvMO/fJ7PtIPHwo9vQFQVtVVzxRcJYxYHoGP54eqUH3Y52CWTy+7spqhacZyoA bVtxcDMmHNq/B9J2TXy66PuSBVvUIEYEcO6DEMrnxOV6hRYRp9oaRi0SetwPVbO57A17 w8Nw== X-Received: by 10.70.140.172 with SMTP id rh12mr21633460pdb.45.1405905657342; Sun, 20 Jul 2014 18:20:57 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-50-136-245-103.hsd1.ca.comcast.net. [50.136.245.103]) by mx.google.com with ESMTPSA id ga1sm12362788pbb.82.2014.07.20.18.20.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 20 Jul 2014 18:20:56 -0700 (PDT) Date: Sun, 20 Jul 2014 18:20:49 -0700 From: Dmitry Torokhov To: Daniel Mack Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: cap1106 - allow changing key mapping from userspace Message-ID: <20140721012045.GA4395@core.coreip.homeip.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings from userspace. Signed-off-by: Dmitry Torokhov --- Just compiled, not tested. drivers/input/keyboard/cap1106.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard/cap1106.c b/drivers/input/keyboard/cap1106.c index f7d7a0d..180b184 100644 --- a/drivers/input/keyboard/cap1106.c +++ b/drivers/input/keyboard/cap1106.c @@ -64,7 +64,7 @@ struct cap1106_priv { struct input_dev *idev; /* config */ - unsigned int keycodes[CAP1106_NUM_CHN]; + unsigned short keycodes[CAP1106_NUM_CHN]; }; static const struct reg_default cap1106_reg_defaults[] = { @@ -272,6 +272,12 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, for (i = 0; i < CAP1106_NUM_CHN; i++) __set_bit(priv->keycodes[i], priv->idev->keybit); + __clear_bit(KEY_RESERVED, priv->idev->keybit); + + priv->idev->keycode = priv->keycodes; + priv->idev->keycodesize = sizeof(priv->keycodes[0]); + priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes); + priv->idev->id.vendor = CAP1106_MANUFACTURER_ID; priv->idev->id.product = CAP1106_PRODUCT_ID; priv->idev->id.version = rev;