Re: How to get "wake up reason" for Suspend-to-Idle

Mika Westerberg
2022-08-17T10:30:06Z

Hi,

On Wed, Aug 17, 2022 at 03:08:18PM +0800, Kai-Heng Feng wrote:
> We are seeing laptops wake up when Thunderbolt dock gets plugged, or
> even wake up on AC plugging.
>
> On Windows these events are logged with "Wakeup Reason", and if the
> wakeup event is from unplugging AC, the system will be put to suspend
> again.
>
> So I wonder if it's possible to get the "Wakeup Reason" under Linux?
>
> '/sys/power/wakeup_count' seems to be insufficient for this purpose.

I don't know if there is a way but unfortunately several systems (or
their firmware) are expecting Windows style "dark resume" so they pretty
much wake up each time something gets plugged or even unplugged to these
ports. Linux does not have similar mechanism at the moment but I think
at least if you have lid closed it will eventually go back to s2idle.