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

Peter M. Brigham pmbrig at gmail.com
Tue Mar 3 10:07:34 EST 2015


So it looks from your links that I should use "/sys/class/power_supply/BAT0/" for the URL on Unix, and check for "charging" or "discharging" as the first word??

-- Peter

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

On Mar 2, 2015, at 2:18 PM, Richard Gaskin wrote:

> Peter Brigham wrote:
> 
> > What gets returned in
> >    get URL "/proc/acpi/battery/BAT1/state" on Unix?
> > If you give me a sample to work with I will finish the handler and
> > post it.
> 
> Further reading shows that path deprecated on many modern systems, suggesting the /sys path instead:
> 
> /sys/class/power_supply/BAT0/
> 
> <https://blog.sleeplessbeastie.eu/2013/01/02/debian-how-to-monitor-battery-capacity/>
> 
> Of the elements found at that path "status" seems the most relevant, but at the moment I'm on a desktop workstation and my Linux laptop is at home so I can't check it right now.
> 
> The key question for the moment is whether BAT0 or BAT1 is used by folks here.  Oddly enough when I was using /proc I had no BAT0 but I did find the info in BAT1.
> 
> Perhaps my Dell model thinks it can support multiple batteries (maybe counting the onboard clock battery?  Seems unlikely).
> 
> Once we discover the battery numbering scheme, parsing the byte stream at that location will be trivial.
> 
> In fact, the articles I've found suggest that when that status element is present it contains just a single word, such as "charging" or "discharging", shown in the example here:
> <https://bbs.archlinux.org/viewtopic.php?id=133716>
> 
> I'll see if I can get some time to look into this further this evening.
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com                http://www.FourthWorld.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list