diff options
author | John Crispin <blogic@openwrt.org> | 2013-11-11 12:19:06 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-11-11 12:19:06 +0000 |
commit | 0cfaf503c393ac345b230ce507723735bce21e3c (patch) | |
tree | 09d84f613c25f92ad7ec467158f1ddc682e7392d /package/kernel | |
parent | c77ae7ec32ef6c778485f77843f256d9db3b75f8 (diff) | |
download | upstream-0cfaf503c393ac345b230ce507723735bce21e3c.tar.gz upstream-0cfaf503c393ac345b230ce507723735bce21e3c.tar.bz2 upstream-0cfaf503c393ac345b230ce507723735bce21e3c.zip |
gpio-button-hotplug: add support for sliding switches
Signed-off-by: John Crispin <blogic@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38725 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel')
-rw-r--r-- | package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 927f37dccf..19621d96d4 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -141,17 +141,7 @@ static int button_hotplug_fill_event(struct bh_event *event) if (ret) return ret; - switch (event->type) { - case EV_SW: - s = "switch"; - break; - case EV_KEY: - default: - s = "button"; - break; - } - - ret = bh_event_add_var(event, 0, "SUBSYSTEM=%s", s); + ret = bh_event_add_var(event, 0, "SUBSYSTEM=%s", "button"); if (ret) return ret; @@ -163,6 +153,12 @@ static int button_hotplug_fill_event(struct bh_event *event) if (ret) return ret; + if (event->type == EV_SW) { + ret = bh_event_add_var(event, 0, "TYPE=%s", "switch"); + if (ret) + return ret; + } + ret = bh_event_add_var(event, 0, "SEEN=%ld", event->seen); if (ret) return ret; @@ -299,7 +295,7 @@ static void gpio_keys_polled_check_state(struct gpio_keys_button *button, return; } - if (bdata->last_state != -1) + if ((bdata->last_state != -1) || (type == EV_SW)) button_hotplug_event(bdata, type, button->code, state); bdata->last_state = state; |