[PATCH 2/2] Input: gpio_keys - Set ABS params when using axes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <paul@xxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux