8

I have solved the problem of my laptop waking in 20 seconds like this - see links there. I would like to understand how this works.

That solution is to somehow modify a variable in /sys/power/mem_sleep, namely s2idle to deep.

Looking at that file it contained this single line:

s2idle [deep]

which was already confusing , given both variables seemed mentioned there, one in brackets.

I didn't need to decide anything though, because, as instructed in the second comment, I haven't tried to change that file as such, but I have used the command:

echo deep | sudo tee -a /sys/power/mem_sleep

Looking again at that file it seemed unchanged though.

After restart the waking from suspend is instantaneous, but that file has the same single line s2idle [deep] that it had in the first place.

I have trusted that solution but:

  • I don't know how to reverse that in case I had to

  • The file seems unchanged so what changing/reversing could mean?


Maybe interesting to notice, there is a file at that location sys/power/wakeup_count which contains this single line: 20. Could those be the 20 seconds that I had experienced before?

cipricus
  • 4,066
  • 4
  • 47
  • 106

1 Answers1

4

You wrote deep to that system file. That file has fixed values that you can see. The one in brackets is the selected value. So it doesn't look like you changed anything.

The meaning of the values is:

The /sys/power/mem_sleep file controls the operating mode of system suspend. Reading from it returns the available modes as "s2idle" (always present), "shallow" and "deep" (present if supported). The mode that will be used on subsequent attempts to suspend the system (by writing "mem" to the /sys/power/state file described above) is enclosed in square brackets.

  Writing one of the above strings to this file causes the mode
  represented by it to be used on subsequent attempts to suspend the system.
  See Documentation/admin-guide/pm/sleep-states.rst for more
  information.

The /sys/power/wakeup_count file allows user space to put the system into a sleep state while taking into account the concurrent arrival of wakeup events. Reading from it returns the current number of registered wakeup events and it blocks if some wakeup events are being processed at the time the file is read from. Writing to it will only succeed if the current number of wakeup events is equal to the written value and, if successful, will make the kernel abort a subsequent transition to a sleep state if any wakeup events are reported after the write has returned.

Source: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-power

Pilot6
  • 92,041