[OpenWrt-Devel] [PATCH] gpio-button-hotplug: gpio-keys: fix always missing first event

Christian Lamparter chunkeey at gmail.com
Wed Jun 5 16:23:13 EDT 2019

On Tue, Jun 4, 2019 at 3:05 PM Petr Štetiar <ynezz at true.cz> wrote:
> Commit afc056d7dc83 ("gpio-button-hotplug: support interrupt
> properties") changed the gpio-keys interrupt handling logic in a way,
> that it always misses first event, which causes issues with rc.button
> scripts, so this patch restores the previous behaviour.
> Cc: Christian Lamparter <chunkeey at gmail.com>
> Fixes: afc056d7dc83 ("gpio-button-hotplug: support interrupt properties")
> Reported-by: Kristian Evensen <kristian.evensen at gmail.com>
> Signed-off-by: Petr Štetiar <ynezz at true.cz>
> ---
> 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 f429f8c0271f..81697e9c4cf6 100644
> --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> @@ -344,10 +344,7 @@ static void gpio_keys_irq_work_func(struct work_struct *work)
>         if (state != bdata->last_state) {
>                 unsigned int type = bdata->b->type ?: EV_KEY;
> -
> -               if (bdata->last_state != -1 || type == EV_SW)
> -                       button_hotplug_event(bdata, type, state);
> -
> +               button_hotplug_event(bdata, type, state);
>                 bdata->last_state = state;
>         }
>  }

Thanks. initially I ran into issues with the WNDR4700 and WNDAP630 when
I was testing the interrupt-driven gpio-keys. On boot-up, they would produce
spurious ghost key presses when gpio-keys enabled the interrupt for the first
time. I'll test this again (don't have the HW at the moment... but I will on

Note: If we want to revert to the previous behavior (afc056d7dc83) and closer
to upstream gpio_keys.c. we have to drop even more.
@Kristian Evensen, can you please check if the following patch would also
resolve the issues you have been experiencing?

I had to attach the patch as a file since gmail's webmail interface now seems to
eat all the tabs. I hope this still gets through.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpio-keys-back-to-stock.diff
Type: text/x-patch
Size: 923 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190605/a4e7fa8b/attachment.bin>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list