[SOLVED] Checking ac/battery status from command-line


vinipsmaker

Member
Joined
Jun 22, 2013
Messages
210
Location
Brazil
Website
vinipsmaker.github.io
I want to shut down the OpenPandora after the battery is fully charged.

According to PandoraWiki<http://pandorawiki.org/User_manual#Charging>, "Once the OpenPandora has completed charging it will stop charging and begin discharging to protect the battery from damage". This is good, but I wanna wake up on the morning and get a device with 100% battery, then a solution would be to write a script to auto shutdown the OpenPandora once the battery is fully charged and on the "discharging state".

The usual way to check battery/ac-adaptor status is the acpi command line utility.

So my question is: What can I use to check the battery status on the OpenPandora from the command line?
 
Last edited by a moderator:
There was a batt command. I added it to prompt command line in StreaK's CLI Love Package, so you can monitor battery constantly 

screen:

01.png


http://repo.openpandora.org/?page=detail&app=cli-love-app
 
Last edited by a moderator:
I was able to create the script:


#!/usr/bin/env

while [ "$(cat /sys/class/power_supply/twl4030_ac/online)" != 0 ]; do
sleep 1;
done

sudo poweroff

But... as soon as the system halted, the ac gone online again and the system/device was turned on.

I think I'll leave it in low-power mode as probably every normal user do to solve the problem.
 
Yeah, you'll have trouble in that external power present causes the system to wake up - I think because the system assumes you're trying to charge the battery, and the system needs to be up to do that. I don't think there's anything you can do to break that trigger, unfortunately.
 
Yeah, you'll have trouble in that external power present causes the system to wake up - I think because the system assumes you're trying to charge the battery, and the system needs to be up to do that. I don't think there's anything you can do to break that trigger, unfortunately.
The low power mode of OpenPandora may save a lot of battery, then the problem is not a big deal. I can live with that. ;)
 
Yes, if I switch my Pandora to low power mode after plugging it in I generally find it's got 90-something percent in the morning. However, given if you plug it in in low power, it switches fully on, I'm not sure if the charging algorithm needs full power to function reliably.
 
You can power off the unit while charging on USB. Maybe with g-cdc loaded.

Dunno if it works on every machines.
 
Back
Top