On Windows the system wakes up when connected or disconnected from an AC adapter. On Linux the system will momentarily wake up but immediately go back into suspend.
I get why this could be a source of bugs, but if I unplug my laptop while its asleep why would I want it to turn on?
Yeah I agree here. I’d expect my laptop to stay asleep if it was asleep to begin with. Also I find it kind of annoying that in order to fix bugs they have to change Linux to mimic windows, especially when it’s a situation like this where the change specifically results in a different behavior which is noticable to users.
This is kinda a quirk of modern/S0 standby.
I assume this is mostly so the device can correctly change between which type of sleep it’s in (connected standby vs disconnected). My windows device seem to do a LOT in connected standby so making sure it properly switches to disconnected and doesn’t chew through the battery is very important.
Besides changing the behavior, the other interesting aspect of this is /sys/power/suspend_stats/last_sleep_energy as a new file to expose the amount of energy that the battery consumed during the last sleep cycle. The “last_sleep_energy” is reported in mAh.
I’m surprised this didn’t exist before. I use the report in windows all the time to figure out why my POS laptop died after 20 minutes of being in sleep.