From: Roman Moravcik <roman.moravcik@gmail.com>
To: linux-input@atrey.karlin.mff.cuni.cz
Cc: kernel-discuss@handhelds.org
Subject: [PATCH] gpio_keys ev_sw support
Date: Tue, 10 Apr 2007 18:53:48 +0200 [thread overview]
Message-ID: <461BC11C.7020401@gmail.com> (raw)
This patch adds software event support to gpio_keys driver.
Signed-off-by: Roman Moravcik <roman.moravcik@gmail.com>
diff -Naur a/drivers/input/keyboard/gpio_keys.c
b/drivers/input/keyboard/gpio_keys.c
--- a/drivers/input/keyboard/gpio_keys.c 2007-02-25
19:50:43.000000000 +0100
+++ b/drivers/input/keyboard/gpio_keys.c 2007-04-05
22:53:02.000000000 +0200
@@ -39,7 +39,10 @@
if (irq == gpio_to_irq(gpio)) {
int state = (gpio_get_value(gpio) ? 1 : 0) ^
(pdata->buttons[i].active_low);
- input_report_key(input, pdata->buttons[i].keycode, state);
+ if (pdata->buttons[i].type == EV_SW)
+ input_report_switch(input, pdata->buttons[i].keycode,
state);
+ else
+ input_report_key(input, pdata->buttons[i].keycode, state);
input_sync(input);
}
}
@@ -59,7 +62,7 @@
platform_set_drvdata(pdev, input);
- input->evbit[0] = BIT(EV_KEY);
+ input->evbit[0] = BIT(EV_KEY) | BIT(EV_SW);
input->name = pdev->name;
input->phys = "gpio-keys/input0";
@@ -84,7 +87,10 @@
irq, error);
goto fail;
}
- set_bit(code, input->keybit);
+ if (pdata->buttons[i].type == EV_SW)
+ set_bit(code, input->swbit);
+ else
+ set_bit(code, input->keybit);
}
error = input_register_device(input);
diff -Naur a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
--- a/include/linux/gpio_keys.h 2007-02-25 16:21:52.000000000 +0100
+++ b/include/linux/gpio_keys.h 2007-04-05 20:23:31.000000000 +0200
@@ -6,6 +6,7 @@
int gpio;
int active_low;
char *desc;
+ int type;
};
struct gpio_keys_platform_data {
next reply other threads:[~2007-04-10 16:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-10 16:53 Roman Moravcik [this message]
2007-04-10 18:20 ` [PATCH] gpio_keys ev_sw support Dmitry Torokhov
2007-04-11 8:06 ` Roman Moravcik
2007-04-13 21:13 ` Paul Sokolovsky
2007-04-13 21:24 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=461BC11C.7020401@gmail.com \
--to=roman.moravcik@gmail.com \
--cc=kernel-discuss@handhelds.org \
--cc=linux-input@atrey.karlin.mff.cuni.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).