Is it possible to throttle the Pocket default CPU such that you could force it to use less power? If you have the display off, and the session locked, this seems like it could be a good way to help extend battery life away from the wall?
Yes, it should be possible to do some kind of pseudo suspend by forcing everything to the lowest clocks using cpufreq-set. Maybe thereâs also something possible for the GPU, but havenât looked yet. And turning off 3 of the CPU cores, and all the lights, and perhaps network interfaces.
Yesterday I did a very quick test with things like:
screen off
turn off wifi radio
almost all daemons (including bluetooth and network-manager) and almost no programs running.
set cpu frequency to 1.2Ghz
My notes are on the Reform itself but I can not boot it right now, don´t remember if I did something else. It went from 57% to 34% in 1:30 hours, which would translate to 6:30 hours from 100% to 0%.
I did not shut down cpu cores, but Iâll try that too. Also, the user session resides on a cgroup2, so it could be completely frozen and resumed, but anyway I killed everything except for sway itself.
Update, this is exactly what I have done, and the results are power draw in mA as given by the command sensors. The computer had no network and no ethernet cable.
Unfortunately, lowering the frequency and putting cpu cores offline do not yield a real consumption improvement, at least in this quick&dirty test.
Still, if somebody is interested in, say, putting the computer in the lowest posible comsuption mode, instead of having to shutdown it, like you donât want to close all your programs, and you will pause your work only for some minutes, consuming 530mA is still better than nothing.
I have not tested it, but a real script would also freeze the whole user session with with something like echo 1 > /sys/fs/cgroup/user.slice/user-1000.slice/cgroup.freeze, and all the user programs whould freeze.
You are the on the Reform or the Pocket Reform? For me normal active running consumption is between 600-1200mA. With the norm being around 1A. So cutting power to 500mA is a doubling of battery life. Seems kind of promising.
Wrote a dirty script, this is what I can expect with it on my pocket:
05:53:33 PM CEST 2024 curr1: 812.00 mA
05:53:39 PM CEST 2024 curr1: 687.00 mA
05:53:44 PM CEST 2024 curr1: 462.00 mA -> (pseudo) suspend
05:53:49 PM CEST 2024 curr1: 462.00 mA
05:53:54 PM CEST 2024 curr1: 487.00 mA
05:54:00 PM CEST 2024 curr1: 437.00 mA
05:54:05 PM CEST 2024 curr1: 437.00 mA
05:54:10 PM CEST 2024 curr1: 887.00 mA -> resume
05:54:15 PM CEST 2024 curr1: 687.00 mA
05:54:21 PM CEST 2024 curr1: 637.00 mA
05:54:26 PM CEST 2024 curr1: 612.00 mA
05:54:31 PM CEST 2024 curr1: 687.00 mA
...
Very cool, for me at least this should be a good interim solution until we can get proper standby working on the Pocket. And, I might be able to adapt some this to put my Pinephone into a standby mode as well.
One question though, you mentioned that the screen should go blank, but on mine the screen just freezes. Is there something else I need to do to shut off the display?
Behavior on my pocket:
pressing hyper+ctrl+1 triggers the script, network etc stops, screen freezes.
The screen does NOT black (not sure if it was supposed to?)
Everything resumes happily on repeat trigger.
If I manually black my screen first, it does seem to shave a small but noticeable portion of power usage compared to unfrozen (like 650-750a vs 800-900a)
Interestingly, while mouse input and keyboard do nothing in freeze-mode, if I press hyper+super+1 while frozen (which normally dims brightness) nothing happens until the system is unfrozen and /then/ it applies the dim. Weird! Is it buffering the command somewhere?
Earlier I messed with my input environment variables to get fcitx5 working on sway though, maybe thatâs interfering somehow. I only vaguely understand input method stuff.
Great, thanks! I need manually to blank the screen and the keyboard backlight but aside of that the script seem to work. Power consumption is reduced slightly (800->600mA) but itâs probably because I donât use the wifi. A nice improvement anyway! Thanks once more!
@MeLikeyTacos@geodewomb, @jirka the display is shut down if either you are using swayidle (it is signaled with USR1) or you are on a terminal (setterm blanks it). I donât know of any global way to shut down the screen. What window manager are you using and how do you blank your screen? I can try to include that too.
All processes under user sessions (as understood by cgroups) freeze, but not daemons processes. Think of running a program from a terminal and pressing Control+z, the program freezes until you put it on the foreground with fg, but for all the processes in the computer, except for the kernel and daemons. The âfocusedâ program still receives your keyboard input, but it wonât process that until unfrozen.
I have just added dimming the display to brightness 1 (to consume less power, but also to let the user know it is not really completely blanked because the script does not know how), and keyboard led blanking. The keyboard leds resume colours can be configured.
If you want to test the power consumption while pseudo-suspended, comment out the module âsession_freeze_rootâ on the config file and run under a root ssh session a screen/tmux with something like while sleep 3; do printf "%(%H:%M:%S)T " -1; sensors | grep curr; done. Commenting out makes root sessions (including this command line) to not get frozen.
Also, if your computer hangs or runs out of battery while suspended, on next boot you will need to run nmcli networking on, else your network interfaces wonât go up. Adding something like @reboot /usr/bin/nmcli n on to your root cron would be a good idea.
The screen stays on but when I undo the psuspend the screen turns immediately off. What I mean by that is that swayidle is working, as the screen does power off 30 seconds after the screensaver comes on.