From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1168554AbcKAKZl (ORCPT ); Tue, 1 Nov 2016 06:25:41 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:56088 "EHLO outils.crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1168491AbcKAKZR (ORCPT ); Tue, 1 Nov 2016 06:25:17 -0400 From: Paul Cercueil To: Dmitry Torokhov , Laxman Dewangan , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Maarten ter Huurne , Paul Cercueil Subject: [PATCH 2/2] Input: gpio_keys - Set ABS params when using axes Date: Tue, 1 Nov 2016 11:25:04 +0100 Message-Id: <20161101102504.3783-3-paul@crapouillou.net> In-Reply-To: <20161101102504.3783-1-paul@crapouillou.net> References: <20161101102504.3783-1-paul@crapouillou.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The gpio-keys supports the EV_ABS event type, but does not actually configure the input device to work with that mode. This patch configures the axis corresponding to button->code as being in the range [-1,+1]. This makes it possible to use gpio-keys to implement a hat (using the ABS_HAT0X /ABS_HAT0Y axes, with two GPIOs each with values -1/+1). Signed-off-by: Paul Cercueil --- drivers/input/keyboard/gpio_keys.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 7018c49..1f2850a 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -540,6 +540,9 @@ static int gpio_keys_setup_key(struct platform_device *pdev, input_set_capability(input, button->type ?: EV_KEY, button->code); + if (button->type == EV_ABS) + input_set_abs_params(input, button->code, -1, 1, 0, 0); + /* * Install custom action to cancel release timer and * workqueue item. -- 2.9.3