Giter Club home page Giter Club logo

pixelbook-battery-stats's Introduction

pixelbook-battery-stats

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 &

WHAT'S NEXT:

  • Consolidate code into a single script?
  • Remove unnecessary code from the original hterm-notify.sh script
  • Run the script without needing a persistently open crosh window
  • Customize the notification with a graphic depicting battery charge level?
  • pixelbook-battery-stats's People

    Contributors

    rmlanghopto avatar

    Watchers

     avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.