Skip to content
Snippets Groups Projects
Commit 27d234a3 authored by Petr Štetiar's avatar Petr Štetiar
Browse files

gpio-button-hotplug: fix wrong initial seen value


Currently the generated event contains wrong seen value, when the button
is pressed for the first time:

 rmmod gpio_button_hotplug; modprobe gpio_button_hotplug
 [ pressing the wps key immediately after modprobe ]
 gpio-keys: create event, name=wps, seen=1088, pressed=1

So this patch adds a check for this corner case and makes seen=0 if the
button is pressed for the first time.

Tested-by: default avatarKuan-Yi Li <kyli.tw@gmail.com>
Signed-off-by: default avatarPetr Štetiar <ynezz@true.cz>
parent 33ccfe0e
No related branches found
No related tags found
No related merge requests found
......@@ -253,6 +253,9 @@ static void button_hotplug_event(struct gpio_keys_button_data *data,
if (btn < 0)
return;
if (priv->seen == 0)
priv->seen = seen;
button_hotplug_create_event(button_map[btn].name, type,
(seen - priv->seen) / HZ, value);
priv->seen = seen;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment