View Full Version : Battery life indicator?
Eponasoft
August 26th, 2009, 02:36
Are there any programs for X (for KDE would be great, something that sits in the Panel) that display the current charge of a laptop's battery? It would be great to know how long until my laptop dies...I used it with just the battery today for the first time ever...got about 2 hours out of the battery (as opposed to barely a half an hour when I used to run XP) but when it was drained, the system just shut off on me...I had no idea how much life the thing had left in it.
jrick
August 26th, 2009, 03:03
I don't know any GUI applications for this, but you can check it with sysctl:
% sysctl hw.acpi.battery
hw.acpi.battery.life: -1
hw.acpi.battery.time: -1
hw.acpi.battery.state: 7
hw.acpi.battery.units: 1
hw.acpi.battery.info_expire: 5
...although my values are currently -1 since I don't have my battery plugged in.
kpedersen
August 26th, 2009, 03:34
Hello,
In the default gnome install there is. The small blue Power Manager icon in the system tray.
It is exactly not KDE though soz!
Eponasoft
August 26th, 2009, 03:49
$ sysctl hw.acpi.battery
sysctl: unknown oid 'hw.acpi.battery'
:(
I have to disable ACPI because the network card won't work with it enabled (stupid Acer). Also, Gnome won't build on my system, and fails to install via ports. Ah well...is there any other method?
jrick
August 26th, 2009, 03:57
Not that I'm aware of, and even if you could get Gnome installed, it's my guess that it's using ACPI as well.
Eponasoft
August 26th, 2009, 06:09
Dang. :( Oh well...thanks for the help. :)
lyuts
August 26th, 2009, 09:34
Take a look at KLaptop.
kpedersen
August 26th, 2009, 16:57
as far as I recall, before the battery icon was working (FreeBSD 7.0 i think) I used to use...
acpi -i
or
apm
I cannot quite remember their exact usage, but they both allowed me to output my battery status to the console
If you want that displayed in X, it would be quite easy to make a simple gtk / qt dialog and scrape the data from the console output.
jrick
August 26th, 2009, 18:18
If you want that displayed in X, it would be quite easy to make a simple gtk / qt dialog and scrape the data from the console output.
echoing the output to something like dzen2 is even simpler. This is what I use to see my battery life in my xmonad status bar.
Eponasoft
August 27th, 2009, 00:17
Hrm...
fbsd# apm
apm: can't open /dev/apm: No such file or directory
fbsd# acpi
acpi: Command not found.
:(
I'll try klaptopdaemon, thanks for the tip. :)
fronclynne
August 27th, 2009, 01:49
Maybe sysutils/xbattbar
Though with apm & acpi disabled, I'm not sure how anything is going to find your battery state.
morbit
August 27th, 2009, 23:49
fbsd# acpi
acpi: Command not found.
acpiconf -i0
Eponasoft
August 28th, 2009, 04:55
$ acpiconf -i0
acpiconf: /dev/acpi: No such file or directory
:(
$ xbattbar
This is xbattbar version 1.4.2, copyright (c)1998-2001 Suguru Yamaguchi
xbattbar: fall back to apm interface
xbattbar: cannot open apm device
:( :(
stupid Acer...
fronclynne
August 28th, 2009, 07:56
Might try rebuilding your kernel with device apm (I believe this is i386 only).
And good luck. I don't recall apm working all that well in the 4.x days and I don't know if that code has been updated much since then.
morbit
August 28th, 2009, 10:24
Maybe it's time to check 8.0-BETA3. There is new acpica.
Eponasoft
August 28th, 2009, 23:14
Hrm ok...thanks for all the help folks. I'm not a fan of beta-quality software, especially when it's an operating system, so I'll just chill until 8.0 is considered CURRENT, then upgrade. :)
jrick
August 28th, 2009, 23:36
Hrm ok...thanks for all the help folks. I'm not a fan of beta-quality software, especially when it's an operating system, so I'll just chill until 8.0 is considered CURRENT, then upgrade. :)
Uh... 8 is -CURRENT. :P
(Or maybe it's 9 now?)
morbit
August 28th, 2009, 23:41
CURRENT is already 9, 8-STABLE is BETA3 now.
http://wiki.freebsd.org/8.0TODO
DutchDaemon
August 29th, 2009, 00:25
In FreeBSD, 'CURRENT' == 'bleeding edge - high risk'. Pick -RELEASE for production, -STABLE for 'some risk, but usually ok'.
Eponasoft
August 29th, 2009, 06:43
Oops, my bad...whatever the word is for "recent, most stable, not likely to go crash" hehe. :) I guess that would be RELEASE. All the different descriptors are kind of confusing. :(
morbit
August 29th, 2009, 10:58
'Safe' and tested changes from CURRENT are backported to STABLE. RELEASE is (usually) cut from STABLE.
http://www.over-yonder.net/~fullermd/rants/bsd4linux/bsd4linux5.php
*If you would like to track CURRENT/STABLE I would recommend using devel/subversion-freebsd port and subversion repository. It's faster.
Carpetsmoker
August 30th, 2009, 17:50
This works for me: http://carpetsmoker.net/code/battray/ -- But I may not be completely impartial though ;)
Eponasoft
August 30th, 2009, 18:17
$ ./battray.py
Traceback (most recent call last):
File "./battray.py", line 103, in <module>
exec("import %s as p" % sys.platform)
File "<string>", line 1, in <module>
File ".//platforms/freebsd7.py", line 15, in <module>
o = subprocess.Popen(['apm', '-ablt'], stdout=subprocess.PIPE).communicate()[0]
NameError: name 'subprocess' is not defined
:(
Carpetsmoker
August 30th, 2009, 23:00
Oops, I forgot to add a line for platforms/freebsd.py
EDIT:
Ok, I had some spare time:
http://carpetsmoker.net/code/battray/download/battray-1.1.tar.gz
Can you please verify if this works? An early version worked fine on FreeBSD, but I have since switced my laptop to OpenBSD and I don't have a FreeBSD installation to test it anymore ...
Eponasoft
August 31st, 2009, 02:49
$ ./battray.py
apm: can't open /dev/apm: No such file or directory
Traceback (most recent call last):
File "./battray.py", line 130, in <module>
exec("import %s as p" % sys.platform)
File "<string>", line 1, in <module>
File ".//platforms/freebsd7.py", line 18, in <module>
(ac, charging, percent, time) = o.split()
ValueError: need more than 0 values to unpack
Python isn't my thing so I don't know anything about how to fix it. :)
Carpetsmoker
August 31st, 2009, 03:09
It's not a python problem this time, the problem is:
apm: can't open /dev/apm: No such file or directory
The apm(8) command doesn't seem to work on your laptop ...
An alternative might be using sysctl, post the output of:
sysctl hw.acpi
everypot
August 31st, 2009, 04:38
I simply use the Battery widget in KDE4.3.
Also acpiconf -i0 works for me:
acpiconf -i0
Design capacity: 4860 mAh
Last full capacity: 4733 mAh
Technology: secondary (rechargeable)
Design voltage: 10800 mV
Capacity (warn): 240 mAh
Capacity (low): 144 mAh
Low/warn granularity: 264 mAh
Warn/full granularity: 3780 mAh
Model number: GC86508SAT0
Serial number:
Type: LION
OEM info: SANYO
State: high
Remaining capacity: 100%
Remaining time: unknown
Present rate: 0 mA
Voltage: 12417 mV
Eponasoft
September 3rd, 2009, 21:29
ACPI is disabled on my system, so anything involving ACPI will automatically fail.
kpedersen
September 3rd, 2009, 22:11
Solution:
1) Time exactly how long from full battery, it takes to become flat.
2) Buy a stopwatch (I found a really cheap one here on ebay for you!)
http://cgi.ebay.co.uk/Chronograph-Digital-Timer-Stopwatch-Sport-Counter_W0QQitemZ280389309024QQcmdZViewItemQQptZLH _DefaultDomain_0?hash=item4148815260&_trksid=p3286.c0.m14
3) Input into the stopwatch, the time it took from step 1
4) Glue that stopwatch to the side of the screen.
The only slight inconvenience with this method is that you MUST remember to pause the stopwatch when you shutdown the computer.
I was going to say get a stop watch with a slow motion function for when you put the computer in hibernate / suspend but that wont work without acpi / apm anyways :)
I look forward to reading the updated handbook in the acpi problems section.
Hope this helps.
Carpetsmoker
September 3rd, 2009, 22:26
@kpedersen, haha, that's funny but also kind of strange ... High tech computer and you need to glue a stopwatch to your screen :-/
ACPI is disabled on my system, so anything involving ACPI will automatically fail.
Right, that explains it then. All battery status indicators will fail for you then ;)
kpedersen
September 4th, 2009, 00:09
@Carpetsmoker,
Strange? I already have a pencil sharpener, pad of paper, pens and some chocolate bars stuck to mine :)
Eponasoft
September 4th, 2009, 04:58
Solution:
1) Time exactly how long from full battery, it takes to become flat.
2) Buy a stopwatch (I found a really cheap one here on ebay for you!)
http://cgi.ebay.co.uk/Chronograph-Digital-Timer-Stopwatch-Sport-Counter_W0QQitemZ280389309024QQcmdZViewItemQQptZLH _DefaultDomain_0?hash=item4148815260&_trksid=p3286.c0.m14
3) Input into the stopwatch, the time it took from step 1
4) Glue that stopwatch to the side of the screen.
The only slight inconvenience with this method is that you MUST remember to pause the stopwatch when you shutdown the computer.
I was going to say get a stop watch with a slow motion function for when you put the computer in hibernate / suspend but that wont work without acpi / apm anyways :)
I look forward to reading the updated handbook in the acpi problems section.
Hope this helps.
You know what? As ludicrous and sarcastic as this suggestion is, it's actually the only one that WOULD work. :) And it would probably be accurate to about 5 minutes.
Well, here's hoping that 8.0 fixes the ACPI issue...
aragon
September 4th, 2009, 07:41
High tech computer and you need to glue a stopwatch to your screen
With broken ACPI, maybe it's not so high tech after all. :)
Eponasoft
September 4th, 2009, 20:04
With broken ACPI, maybe it's not so high tech after all. :)
Nah, it's just an Acer...'nuff said. :)
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.