Battery firmware scraper and notifier script for Pixelbooks with a faulty EC battery connection
HOW TO USE:
Open crosh via CTRL + ALT + T, enter shell mode (type and enter shell
from the crosh terminal), copy the scripts to /usr/local/bin, and add the battery_loop.sh
script to ~/.bashrc
. The script provides notifications for battery's current % charged.
BACKGROUND:
This script came about when I changed a Pixelbook battery and likely shorted out the embedded controller (EC) connection while doing so; my understanding is that this is a common risk and issue when replacing batteries on these models.
While the battery seems completely unrecognized by any GUI elements (like a shelf notification) or common ChromeOS shell (crosh) commands like battery_test, battery stats can still be retrieved by at least one command via crosh: sudo ectool battery
.
You can retrieve these battery stats by logging into crosh by using CTL + ALT + T, typing shell (provided you're in developer mode, which you already must be if you've disabled write-protection and flashed Mr. Chromebox's RW_LEGACY firmware), and then typing sudo ectool battery
into the terminal. The values returned include OEM name, model number, chemistry(!), serial number, design capacity, last full charge, design output voltage, cycle count, present voltage, present current, remaining capacity, and flags.
This script requires a bit of upfront setup and meddling, but it can now work in the background on a set interval (provided you leave the crosh sessions window open). To begin using, open crosh (CTRL + ALT + T), type and enter shell
. To further complicate matters, you must copy the scripts to your /usr/local/bin directory in order to run it from the crosh shell as most of the directories and file systems via crosh as otherwise locked down for security purposes. Finally, add this code to the bottom of your ~/.basrc
(just under the #Put your fun stuff here line
)in order to automatically run the script whenever you start crosh:
sh /usr/local/bin/battery_loop.sh &