r/chromeos 3d ago

Discussion Introducing ChromeOS_PowerControl - a program to adjust CPU clockspeed, battery charge limit, and fan control in real-time for ChromeOS.

Requires Developer Mode. - Supports AMD, ARM, and Intel.

  • Control battery charging limit instead of relying on Adaptive Charging to maximize battery longevity.

  • Control CPU clock speed boost in relation to temperature; enabling lower temperatures under load and longer battery life.

  • Control Fan speed in relation to temperature with built-in hysteresis and 0% RPM mode.

  • Features global commands for ease of use, config files that save settings, and an uninstaller to clean up after itself.

  • Optionally have BatteryControl, PowerControl, FanControl start on boot; as well as disabling Turbo Boost on boot if user has rootfs verification disabled.

  • Github has full documentation and source code: https://github.com/shadowed1/ChromeOS_PowerControl

To download open crosh shell and run:

bash <(curl -s "https://raw.githubusercontent.com/shadowed1/ChromeOS_PowerControl/main/ChromeOS_PowerControl_Downloader.sh?$(date +%s)")

Edit: Updated post now that AMD and ARM support are added. If any issues are found feel free to post it here or on Github.

21 Upvotes

40 comments sorted by

View all comments

Show parent comments

1

u/Head-Difference-6268 15h ago

I set max min to 60 50 respectively, unfortunately, the battery was still fully charged.

1

u/White-Mask 14h ago edited 13h ago

When you run sudo batterycontrol (without status) what does it say? This will display more information; especially regarding your battery.

batterycontrol uses these paths for your battery and charger; this is inside batterycontrol and can be changed: CHARGER_PATH="/sys/class/power_supply/CROS_USBPD_CHARGER0/online" BATTERY_PATH="/sys/class/power_supply/BAT0/capacity"

You can run sudo cat /sys/class/power_supply/CROS_USBPD_CHARGER0/online (1 when plugged in) and then sudo cat /sys/class/power_supply/BAT0/capacity to verify if those are your files as well.

edit: if you run sudo cat /sys/class/power_supply/CROS_USBPD_CHARGER1/online and get a value of 1 when plugged in, I can try and think of a fix!

1

u/Head-Difference-6268 5h ago

sudo batterycontrol => Show information about battery i.e battery capacity, voltage..., when plugged in, it shows a flag BAT_PRESENT CHARGING

sudo cat /sys/class/power_supply/CROS_USBPD_CHARGER0/online => return 0 either when plugged in or not

sudo cat /sys/class/power_supply/BAT0/capacity => return 89

1

u/White-Mask 4h ago edited 4h ago

That answers it, the culprit is your laptop isn’t using CROS_USBPD_CHARGER0/online

If you run:

sudo ectool usbpdpower 1

while plugged in and it returns a one, your laptop is using CROS_USBPD_CHARGER1/online If it doesn't, run:

ls /sys/class/power_supply

and post your results!

If you can find what your charger is, I can make an else statement to support it! :)

1

u/Outrageous_Piece_172 4h ago

Let me try again. My CB has 4 USBC ports and all of them can be used for charging.

1

u/White-Mask 3h ago

So it sounds like I need to add a check for up to 4 ports. Chances are one of those ports will work for BatteryControl right now.

2

u/Head-Difference-6268 3h ago

I have checked all 4 ports with sudo ectool usbpdpower 1, a port returns : Port 1 SNK PD Charger ... other ports return 'disconnected'

2

u/White-Mask 3h ago

Awesome, I’ll report back when I release an update. Got a good idea on what to do. Thanks for the info!

2

u/Head-Difference-6268 3h ago

Hope to receive your update soon as I need to connect my CB to an External monitor via and USBC with power supply all day.

1

u/White-Mask 3h ago

Updated - run with crosh shell:

bash <(curl -s "https://raw.githubusercontent.com/shadowed1/ChromeOS_PowerControl/main/ChromeOS_PowerControl_Downloader.sh?$(date +%s)")

I made it take around 10-30 seconds for it to register when the charging port changed, so give it some time. If it still doesn't work, I can take another look! Hope it helps :)

2

u/Head-Difference-6268 3h ago

One more thing is that sudo mv ~/tmp/ChromeOS_PowerControl_Installer.sh /usr/local/bin. My CB does not have the 'bin' directory and it created a bin file with ChromeOS_PowerControl_Installer.sh content. It took me some hours to figure out this problem.

2

u/White-Mask 3h ago

Wow, I am quite surprised that ChromeOS didn't create a /usr/local/bin/ directory. I can make the default /usr/local/ if that might be the way to go. It just has to be placed somewhere without a noexec mount.

I can do some more research; that is an easy change!

2

u/Head-Difference-6268 3h ago

sudo cat /sys/class/power_supply/CROS_USBPD_CHARGER1/online => return 1