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

Kai-Heng Feng
2022-08-17T07:08:43Z

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.

Kai-Heng