* [PATCH] gpio_keys: Add support for EV_ABS
@ 2011-04-10 15:03 Alexander Stein
2011-04-12 6:30 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Stein @ 2011-04-10 15:03 UTC (permalink / raw)
To: linux-input; +Cc: Dmitry Torokhov, Alexander Stein
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@informatik.tu-chemnitz.de>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio_keys: Add support for EV_ABS
2011-04-10 15:03 [PATCH] gpio_keys: Add support for EV_ABS Alexander Stein
@ 2011-04-12 6:30 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2011-04-12 6:30 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-input
On Sun, Apr 10, 2011 at 05:03:11PM +0200, Alexander Stein wrote:
> 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@informatik.tu-chemnitz.de>
Glad my suggestion worked for you. I'll queue the patches for .40.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-12 6:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-10 15:03 [PATCH] gpio_keys: Add support for EV_ABS Alexander Stein
2011-04-12 6:30 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).