Search code examples
ubuntuubuntu-14.04batterypower-management

Stop charging battery at 100% and vice-versa


Is there any way software / script through which i can stop charging battery when it 100% and vice-versa?

I am not exactly sure how to put in words but ubuntu must be identifying when the power cable is plugged in or not, so, i was wondering if there is any way to fool the OS to cut off power when battery is charged to 100%....this off-course requires to identify 2 things

  • figuring out how ubuntu identifies connectivity of power plug

  • Associate this to the % of battery charged after figuring out % charged

Does someone has any idea about it?


Solution

  • Is there any way software / script through which i can stop charging battery when it 100% and vice-versa?

    Your laptop's hardware does that for you; if it didn't, the accumulator cells would get hot and possibly catch on fire regularly.

    In fact, this functionality is so crucial to your computer's integrity that you can't control it using software (normally; there might be people who would crack firmware to do exactly that -- destroy an opponent's hardware).

    If you want to figure out how information like that can be processed, have a look at a tool called upower.

    If you want to work with that information in your own program: Batterystate is available via sysFS in /sys/class/power_supply/; look at BATn, especially charge_now and charge_full. These contain numbers (encoded as normal strings).