From 6e8f5e395ddfe736c66df606dbf4fab4d8b8f9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Martos=20Harres?= Date: Mon, 31 May 2021 12:35:27 -0300 Subject: [PATCH 1/3] Update README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fda20d..c50b62d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,26 @@ # CPU Powersave > A small bash utility to scale down or up CPU power consumption +> Pequena utilidade escrita em bash para aumentar ou diminuir o consumo de energia da CPU + +## Features +1. Automatically detects if charger is plugged and acts accordingly to the context; +2. Set your own limits for maximium clock, core count and governor; +3. Control your CPU whenever a power source change and automatically apply the `battery` or `AC` profile. + +## WARNINGS: +1. This script runs as **root**, so make sure it's owned by user and group root and it's not writable by any other user, otherwise you're installing a tick bomb inside your system; +2. Do **NEVER** set a script with suid bit: If your shell script has suid priviledge, it's a backdoor waiting to be exploited, any user could gain root without password. + +## Dependencies: +- cpufreq +- cpufreqd +- lscpu +- Linux ## TODO - [x] 1. Make disable_pstate a parameter - [x] 2. Respect max pstate clock as well -- [ ] 3. Find a better solution to detect max clock speed +- [x] 3. Find a better solution to detect max clock speed - [ ] 4. Implement systemd service - [x] 5. Make governor a parameter - [ ] 6. modprobe all governors From e38f8d90376452ec533275dd39f46c30fe372f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Martos=20Harres?= Date: Mon, 28 Jun 2021 14:39:37 -0300 Subject: [PATCH 2/3] Bluetooth ta drenando a bateria ;-; --- startup.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/startup.sh b/startup.sh index b496a31..bc6776a 100755 --- a/startup.sh +++ b/startup.sh @@ -39,6 +39,8 @@ min_freq=false disable_turbo=1 governor=false debug=false +# TODO: Parametrize +disable_bluetooth=true while getopts "h?m:j:c:d:tv" opt; do case "$opt" in @@ -218,3 +220,11 @@ then done fi +################################################ +# Disable bluetooth # + +if [ ${disable_bluetooth} == true ] +then + systemctl stop bluetooth +fi + From 621a194ef3f3d35e18f37f91a3f27a8f6566c1d9 Mon Sep 17 00:00:00 2001 From: wh1t3h47 Date: Sat, 10 Jul 2021 04:26:18 -0300 Subject: [PATCH 3/3] fix getopt --- startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/startup.sh b/startup.sh index b496a31..1ab2c1b 100755 --- a/startup.sh +++ b/startup.sh @@ -40,7 +40,7 @@ disable_turbo=1 governor=false debug=false -while getopts "h?m:j:c:d:tv" opt; do +while getopts "h?m:j:c:d:g:tv" opt; do case "$opt" in h|\?) show_help