Re: [RFC PATCH] Input: gpio_keys - trigger input event if key is pressed in boot stage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Barry,

On Wed, May 20, 2015 at 06:02:36PM +0800, Barry Song wrote:
> sometimes we press a key to boot, and the boot stage need to get this
> event.
> the current codes use edge trigger, so we have no chance to report
> the cold-touch event.
> but our user sceneries like Linux navigator does need it.

Input events that come before input device is opened (either by
userspace or by a kernel consumer) are ignored by input core and we
already call gpio_keys_report_state() from gpio_keys_open() so I do not
think this patch has any effect.

Thanks.

> 
> Signed-off-by: Barry Song <Baohua.Song@xxxxxxx>
> ---
>  -RFC: for the moment, only an idea
> 
>  drivers/input/keyboard/gpio_keys.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c
> b/drivers/input/keyboard/gpio_keys.c
> index ddf4045..77fe0dd 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -766,6 +766,19 @@ static int gpio_keys_probe(struct platform_device *pdev)
> 
>      device_init_wakeup(&pdev->dev, wakeup);
> 
> +    /* if the key is pressed while system boot, force an interrupt */
> +    for (i = 0; i < pdata->nbuttons; i++) {
> +        const struct gpio_keys_button *button = &pdata->buttons[i];
> +        struct gpio_button_data *bdata = &ddata->data[i];
> +        int state;
> +
> +        if (gpio_is_valid(button->gpio)) {
> +            state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^
> button->active_low;
> +            if (state)
> +                gpio_keys_gpio_isr(bdata->irq, bdata);
> +        }
> +    }
> +
>      return 0;
> 
>  err_remove_group:
> -- 
> 1.9.1

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux