* [RFC] [PATCH] input: export gpio-keys driven switch status over gpiolib sysfs
@ 2009-06-04 22:39 Janusz Krzysztofik
2009-06-11 6:18 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Janusz Krzysztofik @ 2009-06-04 22:39 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-omap
This patch adds support for exporting status of GPIO switches, configured as
gpio-keys buttons that generate events of type EV_SW, over standard gpiolib
sysfs interface. That way, switch state can be easily accessed from userspace
via a modern sysfs API in addition to traditional ioclt API, without the need
for adding a new, usualy controversial entry to sysfs interface.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
diff -up linux-2.6.30-rc5/drivers/input/keyboard/gpio_keys.c.orig linux-2.6.30-rc5/drivers/input/keyboard/gpio_keys.c
--- linux-2.6.30-rc5/drivers/input/keyboard/gpio_keys.c.orig 2009-03-24 00:12:14.000000000 +0100
+++ linux-2.6.30-rc5/drivers/input/keyboard/gpio_keys.c 2009-06-04 21:31:19.000000000 +0200
@@ -157,6 +157,19 @@ static int __devinit gpio_keys_probe(str
wakeup = 1;
input_set_capability(input, type, button->code);
+
+ /* For GPIO buttons generating events of type EV_SW
+ * (ie switches), export their status
+ * over gpiolib sysfs interface if configured */
+#ifdef CONFIG_GPIO_SYSFS
+ if (type == EV_SW) {
+ error = gpio_export(button->gpio, false);
+ if (error)
+ pr_warning("gpio-keys: "
+ "failed to export GPIO %d, error %d\n",
+ button->gpio, error);
+ }
+#endif
}
error = input_register_device(input);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] [PATCH] input: export gpio-keys driven switch status over gpiolib sysfs
2009-06-04 22:39 [RFC] [PATCH] input: export gpio-keys driven switch status over gpiolib sysfs Janusz Krzysztofik
@ 2009-06-11 6:18 ` Dmitry Torokhov
2009-06-12 11:19 ` Janusz Krzysztofik
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2009-06-11 6:18 UTC (permalink / raw)
To: Janusz Krzysztofik; +Cc: linux-input, linux-omap
Hi Janusz,
On Fri, Jun 05, 2009 at 12:39:39AM +0200, Janusz Krzysztofik wrote:
> This patch adds support for exporting status of GPIO switches, configured as
> gpio-keys buttons that generate events of type EV_SW, over standard gpiolib
> sysfs interface. That way, switch state can be easily accessed from userspace
> via a modern sysfs API in addition to traditional ioclt API, without the need
> for adding a new, usualy controversial entry to sysfs interface.
>
But this would make your application only work with devices using
gpio-keys driver and nothing else. I don't think it's a good idea.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] [PATCH] input: export gpio-keys driven switch status over gpiolib sysfs
2009-06-11 6:18 ` Dmitry Torokhov
@ 2009-06-12 11:19 ` Janusz Krzysztofik
0 siblings, 0 replies; 3+ messages in thread
From: Janusz Krzysztofik @ 2009-06-12 11:19 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-omap
Hi Dmitry,
Thursday 11 June 2009 08:18:56 Dmitry Torokhov napisał(a):
> Hi Janusz,
>
> On Fri, Jun 05, 2009 at 12:39:39AM +0200, Janusz Krzysztofik wrote:
> > This patch adds support for exporting status of GPIO switches, configured
> > as gpio-keys buttons that generate events of type EV_SW, over standard
> > gpiolib sysfs interface. That way, switch state can be easily accessed
> > from userspace via a modern sysfs API in addition to traditional ioclt
> > API, without the need for adding a new, usualy controversial entry to
> > sysfs interface.
>
> But this would make your application only work with devices using
> gpio-keys driver and nothing else. I don't think it's a good idea.
No, my patch wouldn't make that, neither to mine nor any other application.
It's an application developer, not my patch, who can make the application
limited, and I think he should be free to do this at his will. My patch would
only provide him with extra functionality, exposed by one of device drivers,
designed for a specific group of devices, for his free use.
I think that providing extra functionality for free use, without breaking
anything, neither in kernel nor user space, not adding any overhead, moreover,
using an already existing kernel API designed for that specific purpose, is a
good idea.
Thanks,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-12 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-04 22:39 [RFC] [PATCH] input: export gpio-keys driven switch status over gpiolib sysfs Janusz Krzysztofik
2009-06-11 6:18 ` Dmitry Torokhov
2009-06-12 11:19 ` Janusz Krzysztofik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.