Power Status (was Re: Because LC can't do two things at once.)

Peter M. Brigham pmbrig at gmail.com
Wed Mar 4 08:10:53 EST 2015


On Mar 3, 2015, at 11:17 PM, Mark Wieder wrote:

> Peter-
> 
> Actually, BAT0 is a directory, so you want
> 
>        put url "/sys/class/power_supply/BAT0/status" into tStatus
> 
> and what I see on my Thinkpad running linux Mint 17 is status returns one of 
> three states:
> 
> Unknown if the laptop is plugged into the AC adapter
> Discharging if running off the battery power
> Charging if it's (wait for it) charging the battery.

Please clarify: "Unknown" if using the AC adapter, and "Charging" if it's charging the battery. How could you be charging the battery if you're not using the AC adapter? Is "Unknown" reserved for when you're plugged in and the battery is fully charged?

> If I remove the battery and run the laptop off AC power there is no BAT0 
> directory.

OK, so a test for "no such file" is called for.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list