With this patch you can setup a group of GPIOs representing a specific position on an EV_ABS axis. Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxxxxxxxxxxxx> --- See also the discussion thread beginning at http://www.spinics.net/lists/linux-input/msg14324.html drivers/input/keyboard/gpio_keys.c | 7 ++++++- include/linux/gpio_keys.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index eb30063..f319884 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -324,7 +324,12 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata) unsigned int type = button->type ?: EV_KEY; int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; - input_event(input, type, button->code, !!state); + if (type == EV_ABS) { + if (state) + input_event(input, type, button->code, button->value); + } else { + input_event(input, type, button->code, !!state); + } input_sync(input); } diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index dd1a56f..c09d7fb 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -7,7 +7,8 @@ struct gpio_keys_button { int gpio; int active_low; char *desc; - int type; /* input event type (EV_KEY, EV_SW) */ + int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ + int value; /* axis value for EV_ABS */ int wakeup; /* configure the button as a wake-up source */ int debounce_interval; /* debounce ticks interval in msecs */ bool can_disable; -- 1.7.4.1 -- 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