initial copy from github

inital move from github
This commit is contained in:
kake26 2021-05-17 01:06:15 +02:00
parent 97561de3c3
commit 9fcb60b769
4 changed files with 65 additions and 1 deletions

10
Install.md Normal file
View file

@ -0,0 +1,10 @@
# Install.md
1. Create dir /opt/scripts
2. Drop cpuwrangler.bash in the new directory
3. Edit file and change $cpugov to what you want to use, default to conservative
4. CD to /etc/systemd/system/
5. Drop in the cpuwrangler.service file
6. Run systemctl enable cpuwrangler.service
Thats it!

View file

@ -1,3 +1,31 @@
# cpuwrangler
CPU Wrangler for the PinePhone.
# What it does
I recently got my PinePhone and noticed while there are many OSes out there, they seem to not pay attention to one thing. The CPU governor, leaving it on performance which is great for responsiveness, but eats battery. This script is a simple little tool to help adjust the governor. I've included a little bit of a description for each, but to get the full info you should look it up in the kernel docs.
# Supported Governors
# Performance
This is likely the default and just keeps the CPU at max power all the time. Downside is it drains battery power and generates allot of heat.
# Ondemand
A CPU governor that adjusts the power according to CPU load. A better balance between responsiveness and battery saving. Downside is its quick to
jump to max power on the CPU. Still better then performance
# Conservative
Similar to the ondemand, but not as quick to ratchet up to max power on the CPU. This I think strikes a good balance between responsiveness and good
battery savings. Especially, if the phone is mostly idle.
# Powersave
Well, not much to say here except max power saving.
# Notes
The service code for presisting the changes across the startup require systemd. However, using it elsewhere should be trivial.

19
cpuwrangler.bash Normal file
View file

@ -0,0 +1,19 @@
#!/bin/bash
# Some variables
$sysdu = "" # location to pull the systemd unit from github
$cur_gov = $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
$cpugov = "conservative" # set what you want here
# First, are running as root?
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Default action is to reapply settings
echo "$cpugov" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

7
cpuwrangler.service Normal file
View file

@ -0,0 +1,7 @@
[Unit]
Description=CPU Wrangler presistent startup unit
[Service]
Type=oneshot
ExecStart=/opt/scripts/cpuwrangler.bash
[Install]
WantedBy=multi-user.target