Page 1 of 2

Vattery+IBAM

Posted: Thu 31 Dec 2009, 03:28
by jemimah
I've modified Vattery, a lightweight battery meter for the system tray and modified it to use IBAM as the backend. You can read about IBAM's coolness here: http://ibam.sourceforge.net/

Vattery also will warn you when your battery is getting low so you know you need to save your data. I changed it to use Xdialog instead of xmessage. You can change it to have it run any script you like when the battery gets low.

I've only tested this on 4.3.1 so there's some chance Vattery won't work with other versions or it may have dependencies.

Edit: updated to not need /proc/acpi/battery/BAT0
Edit: 1/19/10 updated to use the charging color for fully charged battery
Edit: 1/20/10 Added trayclock, an analog clock for the systray by the same developer.
Edit 1/26/10 Cosmetic updates to Vattery, and added traytemp for monitoring your Cpu temperature.
Edit:4/29 Apparently I unintentionally removed ibam from the Vattery pet last time I uploaded it, so I've attached the ibam pet here. Sorry about that.

Posted: Thu 31 Dec 2009, 08:34
by Shel
No tickee, no workee, at least on my Toshiba Portege R100:

Code: Select all

flatso:/root # vattery
can not read /root/.config/vattery/config: File is empty

** (vattery:25899): CRITICAL **: file main.vala.c: line 1276: uncaught error: Failed to open file '/proc/acpi/battery/BAT0/state': No such file or directory

** (vattery:25899): CRITICAL **: file main.vala.c: line 1276: uncaught error: Failed to open file '/proc/acpi/battery/BAT0/state': No such file or directory
It doesn't create the config file, which I can certainly do if I know the format, and the second error may be resolved with proper configuration, as my machine has two batteries, BAT1 and BAT2.

However the 'state' files for the batteries are empty ...

-Shel

EDIT: Also, it doesn't uninstall cleanly. I installed it by download/save, then clicking on the .pet file. It installed fine: vattery and ibam went into /usr/local/bin, and a startup script into /root/Startup. Uninstalling from the package manager, although it reported no error, did nothing; all the files were still present.

I'll give it another go on the next rev, though, as I really want better power management on this laptop.

-S

Not working on AsusEEE 900

Posted: Thu 31 Dec 2009, 08:44
by Dromeno
same on AsusEEE 900:

can not read /root/.config/vattery/config: File is empty

Posted: Thu 31 Dec 2009, 13:30
by jemimah
The config file error is normal for the first run. It will create the config file automatically if you click on the preferences.

It needs acpi battery support in the kernel so it won't work work without a /proc/acpi/battery directory. It probably also assumes you have only one battery.

I will look into the uninstall thing.

Posted: Thu 31 Dec 2009, 13:52
by jemimah
Ok I rebuit the pet.spec file and just tested and an a fresh 4.3.1 install and the uninstaller worked. The only files this pet installs are /usr/local/bin/vattery /usr/local/bin/ibam and /root/Startup/vattery.

Posted: Thu 31 Dec 2009, 15:06
by Shel
jemimah wrote:The config file error is normal for the first run. It will create the config file automatically if you click on the preferences.
Maybe, but it never got far enough for me to have anything on which to click.
It needs acpi battery support in the kernel so it won't work work without a /proc/acpi/battery directory. It probably also assumes you have only one battery.
I'm using the supplied kernel that came with 4.3.1. Your 'acpitool' works, at least as far as checking the battery:

Code: Select all

flatso:/root # acpitool -b
  Battery #1     : charged, 100.0%, 00:00:00
  Battery #2     : charging, 54.19%, 03:10:36
How can I check for the acpi stuff in the kernel?

If it only checks one battery, but I can tell it which one, that would be OK.

The /proc/acpi/battery directory exists, as do the state files for BAT1 and BAT2. The files are zero-length, however:

Code: Select all

flatso:/root # ls -la /proc/acpi/battery
total 0
dr-xr-xr-x  4 root root 0 2009-12-31 16:02 .
dr-xr-xr-x 12 root root 0 2009-12-31 15:17 ..
dr-xr-xr-x  2 root root 0 2009-12-31 16:02 BAT1
dr-xr-xr-x  2 root root 0 2009-12-31 16:02 BAT2
flatso:/root # ls -la /proc/acpi/battery/BAT1
total 0
dr-xr-xr-x 2 root root 0 2009-12-31 16:02 .
dr-xr-xr-x 4 root root 0 2009-12-31 16:02 ..
-rw-r--r-- 1 root root 0 2009-12-31 16:02 alarm
-r--r--r-- 1 root root 0 2009-12-31 16:02 info
-r--r--r-- 1 root root 0 2009-12-31 16:02 state
flatso:/root # ls -la /proc/acpi/battery/BAT2
total 0
dr-xr-xr-x 2 root root 0 2009-12-31 16:02 .
dr-xr-xr-x 4 root root 0 2009-12-31 16:02 ..
-rw-r--r-- 1 root root 0 2009-12-31 16:02 alarm
-r--r--r-- 1 root root 0 2009-12-31 16:02 info
-r--r--r-- 1 root root 0 2009-12-31 16:02 state
Thanks.

-Shel

PS: As a quick battery check, this one-line script, attached to a desktop icon, isn't all bad:

Code: Select all

gxmessage -title "Battery Status" "`acpitool -b`"
-S

Posted: Thu 31 Dec 2009, 15:10
by jemimah
Shel, does IBAM work from the command line? I was thinking of changing Vattery to use IBAM get the percent instead of directly reading the BAT0 file. I just have to figure out how to use the regular expression stuff in Vala.

Posted: Thu 31 Dec 2009, 18:47
by jemimah
Ok I've modifed it to use IBAM exclusively to get it's data. This is not thoroughly tested, so let me know how it goes.

Posted: Thu 31 Dec 2009, 19:56
by trapster
acpitool is working well on my eeepc 1005HA using wmii wm.

I symlinked acpitool to acpi and use this for the task bar in wmiirc:

Code: Select all

#Modified by trapster Status Bar Info
status() {
echo -n ' WiFi:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) '|' $(acpi -b | sed 's/.*, \{0,2\}\([0-9]\{1,3\}%\),.*/BAT0: \1 | /') '|' $(uptime |
sed 's/.*://; s/,//g') '|' $(date +%I:%m) 
Image

Posted: Fri 01 Jan 2010, 10:55
by Shel
Shel wrote: ibam works, vattery works, and it seems to reflect the total of both batteries.on my Toshiba Portege R100.

Since this machine fully charges the internal battery before charging the external one, but discharges them more or less at the same time, it'll take me a little while to know how accurate it is.
Kinda-sorta.

At the moment, the vattery icon is showing fully charged, and the mouse-over hovertext reflects that.

ibam reports ...

Code: Select all

flatso:/root # ibam -a
Bios percentage:            100 %
Battery percentage:         100 %
Soft low percentage limit:  5 %
Charge percentage:          100 %
Bios time left:              4:17:51
Battery time left:           5:03:29
Adapted battery time left:   5:03:29
Charge time left:            0:00:00
Adapted charge time left:    0:00:00
Total battery time:          5:03:29
Adapted total battery time:  5:03:29
Total charge time:           8:53:33
Adapted total charge time:   8:53:33
Profile logging enabled.
Current file: /root/.ibam/profile-002-full
However, the real scoop is ...

Code: Select all

flatso:/root # acpitool -b
  Battery #1     : charged, 100.0%, 00:00:00
  Battery #2     : charging, 73.65%, 01:57:09
... so, at least as far as the on-charge accuracy, vattery+ibam is just showing the main battery.

However, if I snatch the AC cord out, vattery's icon+mouseover quickly drops to 83%, which is a reasonable balance between the power stored in the internal battery and the twice-as-large external one.

It looks pretty good to me so far.

-Shel

Posted: Wed 06 Jan 2010, 05:55
by Shel
Just a small further progress report ...

This worksgreat. It reports what the BIOS thinks is the battery life remaining, and that basically reflects the real state of things. It's a little conservative, in that there's a bit more power available than it reports, but I'd rather have a gas gauge that reads low than be standing on the side of the road holding a gas can and waving down a ride.

This with a two-battery Toshiba Portege R100.

Now for the big problem ... why does the battery run down when the machine is nominally "off?"

-Shel

Posted: Wed 06 Jan 2010, 06:19
by jemimah
That I don't know, hardware design flaw maybe? Perhaps you'll have to remove the battery when it's off.

Posted: Mon 18 Jan 2010, 13:12
by OverDrive
This could very well be an improvement over asapm. How do I get the icon to show the blue color when it is charging?

OverDrive

Posted: Mon 18 Jan 2010, 15:41
by jemimah
It's supposed to do that automatically. If it's not can you post the output of 'ibam --percentbattery' both when it's charging and when it's discharging. This is a bug a few people have mentioned but I'm having trouble tracking it down.

Posted: Tue 19 Jan 2010, 01:48
by OverDrive
My bad, I didn't realize that icon is red when the notebook is plugged in and the battery is topped off. Not what I was expecting. I figured as long as it was plugged in it would be in "charging mode". When the battery is discharged some amount and you plug it in, the icon *does* turn blue and then when it tops off it goes back to red even though it is still plugged in. So, like I said, it does change colors, just not in the way I was expecting.

Best Regards

OverDrive

Posted: Tue 19 Jan 2010, 03:51
by jemimah
Yeah fixing that is on my todo list. Perhaps a third color for 'fully charged'.

Posted: Tue 19 Jan 2010, 04:30
by OverDrive
jemimah, That would do it. Then if the user doesn't see that color then they know something is up. Between that and the dialog box popup's, IMHO, we should be good to go. FWIW, I'm using this on my tray instead of asapm just because of the popup's alone.

Best Regards

OverDrive

Posted: Tue 19 Jan 2010, 05:22
by jemimah
I've posted a new version that uses the charging color for fully charged batteries instead of the discharging color.

Posted: Wed 20 Jan 2010, 03:47
by OverDrive
Jemimah, That's perfect. Thank you so much. FWIW, I also tested the dialog box's and they also worked quite nicely on my notebook. Hey, If your ever coming to Cleveland, let me know. I'll take you out for some good local chow..


All the Best

OverDrive

Posted: Wed 20 Jan 2010, 17:56
by DaveS
Using this on a heavily re-mastered 4.3.1. Very very nice thanks. I have been hoping for a replacement for asapm for sometime as it is so darn ugly. Thanks a million.............