Vattery+IBAM

Miscellaneous tools
Message
Author
User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

Vattery+IBAM

#1 Post 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.
Attachments
ibam-0.5.2.pet
(19.14 KiB) Downloaded 1651 times
traytemp-0.7.pet
(56.08 KiB) Downloaded 1724 times
vattery-ibam-0.7.pet
(56.73 KiB) Downloaded 1915 times
systrayApplets.jpg
(2.38 KiB) Downloaded 10267 times
trayclock-0.33.pet
(18.4 KiB) Downloaded 1457 times
Last edited by jemimah on Thu 29 Apr 2010, 13:41, edited 9 times in total.

Shel
Posts: 103
Joined: Sat 11 Apr 2009, 17:33
Location: Seattle, WA, USA, or Southern France

#2 Post 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
Last edited by Shel on Thu 31 Dec 2009, 10:20, edited 1 time in total.

Dromeno
Posts: 534
Joined: Fri 12 Sep 2008, 07:01

Not working on AsusEEE 900

#3 Post by Dromeno »

same on AsusEEE 900:

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

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#4 Post 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.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#5 Post 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.

Shel
Posts: 103
Joined: Sat 11 Apr 2009, 17:33
Location: Seattle, WA, USA, or Southern France

#6 Post 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

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#7 Post 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.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#8 Post 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.

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#9 Post 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
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

Shel
Posts: 103
Joined: Sat 11 Apr 2009, 17:33
Location: Seattle, WA, USA, or Southern France

#10 Post 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

Shel
Posts: 103
Joined: Sat 11 Apr 2009, 17:33
Location: Seattle, WA, USA, or Southern France

#11 Post 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

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#12 Post by jemimah »

That I don't know, hardware design flaw maybe? Perhaps you'll have to remove the battery when it's off.

OverDrive
Posts: 178
Joined: Mon 02 Jan 2006, 05:07
Location: Cleveland, OHIO,USA

#13 Post 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
Instant Puppy Fan!!!

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#14 Post 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.

OverDrive
Posts: 178
Joined: Mon 02 Jan 2006, 05:07
Location: Cleveland, OHIO,USA

#15 Post 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
Instant Puppy Fan!!!

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#16 Post by jemimah »

Yeah fixing that is on my todo list. Perhaps a third color for 'fully charged'.

OverDrive
Posts: 178
Joined: Mon 02 Jan 2006, 05:07
Location: Cleveland, OHIO,USA

#17 Post 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
Instant Puppy Fan!!!

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#18 Post by jemimah »

I've posted a new version that uses the charging color for fully charged batteries instead of the discharging color.

OverDrive
Posts: 178
Joined: Mon 02 Jan 2006, 05:07
Location: Cleveland, OHIO,USA

#19 Post 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
Instant Puppy Fan!!!

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#20 Post 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.............
Spup Frugal HD and USB
Root forever!

Post Reply