Re: [PATCH V3] acpi: trigger wakeup key event from power button

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

 



On Tue, Sep 12, 2023 at 09:16:06PM +0800, Ken Xue wrote:
> Andorid can wakeup from various wakeup sources,
> but only several wakeup sources can wake up screen
> with right events(POWER, WAKEUP) from input device.


You still have a room for 10+ characters on each line in the above paragraph.
Why not use them?

> Regarding pressing acpi power button, it can resume system and
> ACPI_BITMASK_WAKE_STATUS and ACPI_BITMASK_POWER_BUTTON_STATUS
> are set in pm1a_sts, but kernel does not report any key
> event to user space during resume by default.
> 
> So, trigger wakeup key event to user space during resume
> from power button.
> 
> Signed-off-by: Ken Xue <Ken.Xue@xxxxxxx>

...

> +void acpi_power_button_wakeup(struct acpi_device *dev)
> +{
> +	struct acpi_button *button = acpi_driver_data(dev);
> +	struct input_dev *input;

> +	if (button->type == ACPI_BUTTON_TYPE_POWER) {

It seems you missed the suggestion and I haven't heard an objection on written
the above as

	if (button->type != ACPI_BUTTON_TYPE_POWER)
		return;

> +		input = button->input;
> +		input_report_key(input, KEY_WAKEUP, 1);
> +		input_sync(input);
> +		input_report_key(input, KEY_WAKEUP, 0);
> +		input_sync(input);
> +	}
> +}

...

>  #include <linux/syscore_ops.h>
>  #include <asm/io.h>
>  #include <trace/events/power.h>
> +#include <acpi/button.h>

While at it, I would add a blank line here to distinguish groups of header
inclusions.

  #include <linux/syscore_ops.h>
  #include <asm/io.h>
  #include <trace/events/power.h>

  #include <acpi/button.h>

Or even

  #include <linux/syscore_ops.h>

  #include <asm/io.h>

  #include <trace/events/power.h>

  #include <acpi/button.h>


-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux