Active Topics

 


Reply
Thread Tools
Posts: 64 | Thanked: 130 times | Joined on Dec 2009
#1
N900 allows one to check full detailed information about the battery.

The basic way to get everything is to open the X terminal and type "lshal|grep bat". There is also another way to get the information, but the output isn't well sorted. It is "hal-device bme" which is executed much faster and as such is used in the aliases later on.

Note. The commands don't show anything useful while charging.

You will get following output (numbers on front of lines have been added for easier explaining):
Code:
~ $ lshal|grep bat
1  battery.charge_level.capacity_state = 'ok'  (string)
2  battery.charge_level.current = 2  (0x2)  (int)
3  battery.charge_level.design = 8  (0x8)  (int)
4  battery.charge_level.last_full = 0  (0x0)  (int)
5  battery.charge_level.percentage = 12  (0xc)  (int)
6  battery.charge_level.unit = 'bars'  (string)
7  battery.is_rechargeable = true  (bool)
8  battery.present = true  (bool)
9  battery.rechargeable.is_charging = false  (bool)
10  battery.rechargeable.is_discharging = true  (bool)
11  battery.remaining_time = 0  (0x0)  (int)
12  battery.remaining_time.calculate_per_time = false  (bool)
13  battery.reporting.current = 160  (0xa0)  (int)
14  battery.reporting.design = 1248  (0x4e0)  (int)
15  battery.reporting.last_full = 0  (0x0)  (int)
16  battery.reporting.unit = 'mAh'  (string)
17  battery.type = 'pda'  (string)
18  battery.voltage.current = 3753  (0xea9)  (int)
19  battery.voltage.design = 4200  (0x1068)  (int)
20  battery.voltage.unit = 'mV'  (string)
21  info.capabilities = {'battery'} (string list)
22  info.category = 'battery'  (string)
1. Shows "full" at 8 bars. Possibly still full at 7 bars. "Low" at 1 bars or something and elsewhere "ok". Quite useless.
2. Remaining battery life in bars (number representation of the battery bar shown on top left of the screen just right of programs button).
3. Bar value of full charged new battery.
4. Bar value the battery had last time it was fully charged. Typically 8 for quite new battery. Seems to reset to 0 in a few minutes after taking off the charger.
5. Percentage of battery charge remaining. This is the most useful value for most users.
6-10. Self explanatory.
11. Very inaccurate time remaining on battery charge at current usage. Supposed to be in seconds (I recall reading that from somewhere) but is far from reality and updates very rarely.
12. Not sure what this should mean. Always shows false for me.
13. Current remaining battery charge in mAh.
14. Capacity of the current battery when it was manufactured.
15. Full charge mAh value from last full charge. Seems to reset to 0 in a few minutes after taking off the charger.
16-17. Self explanatory.
18. Current battery voltage. Depends on recent usage level and battery charge level. Only useful for advanced users.
19. Voltage of the battery when fully charged. The value is for when manufactured, but this does not change for old batteries.
20. Self explanatory
21-22. Useless.

So, all in all, the lines 5, 13, 14 and 18 are of more use. And the line 14 can be easily remembered approximately and as such is generally useless in long term.

The only useful value shown while charging, is the line 18 (voltage). After getting used to the voltage behavior of rechargeable Li-Ion battery, you can approximate the remaining charge time from the voltage value.

Here are some aliases premade for various people to ease the life. They are put into a file ".profile" in the home directory (the directory X terminal puts you on at start). A quick newbie quite for how to use vi (the only editor I found on the X terminal). Start editing the file with "vi .profile". Type "a" to enter editing mode. Edit the file normally (do not press anything strange such as keys with CTRL or ESC etc). If something strange happens, close the X terminal and start from beginning. Once ready, click ESC, type ":write" and type ":q". To get "|" symbol, use secondary function of CTRL-key on the keyboard.

Aliases work as such that the word before "=" does the command between parenthesis. You can easily customize the aliases to be done with other commands. Eg. following 2 aliases do same thing, except first is executed with foo and second with bar.
alias foo="echo test"
alias bar="echo test"

Some basic aliases to simplify the rest of the aliases. Grep is a command used to look for given pattern from the lines. Matching lines are left remaining. With -v parameter the behavior is reverse, thus only lines not matching are left remaining.
alias lg="hal-device bme|grep"
alias g="grep"
alias gv="grep -v"

Alias suited for most users showing only line 5 (charge percentage):
alias b="lg erc"
(or alias b="hal-device bme|grep erc" )

Alias giving a bit more info for more advanced users and for battery usage testing. Shows lines 5, 13 and 18 (charge percentage, mAh remaining and voltage):
alias ba="lg erc;lg rr|gv h"

Alias for same as above except with line 14 (design charge in mAh) as well:
alias bat="lg erc;lg g.des;lg rr|gv h"

Alias for generally everything at least somewhat useful (lines 1-5, 13-15 and 18-19):
alias battery="lg bat|gv nf|gv pr|gv yp|gv un|gv is|gv lc|gv im"

As for advanced info about how charge remaining in mAh and voltage vary depending on power usage. Voltage tends to drop somewhat below the normal level when you do something intensive. More than when the charge is lower. The remaining charge shouldn't raise, but it seems the logic used in determining battery charge is a bit simplified, and as such there are some differences there. After a period of intensive usage, the charge remaining may actually raise around 10-20 mAh while the device is at idle for 5-20 minutes. It is crucial to experiment around with this a bit for more accurate results on battery usage tests.


In case you have something to add (or perhaps found an error), feel free to comment. I will be updating this post to match latest information and answering all possible questions people might have.

Last edited by Phantasm; 2009-12-11 at 15:27.
 

The Following 35 Users Say Thank You to Phantasm For This Useful Post:
msa's Avatar
Posts: 909 | Thanked: 216 times | Joined on Nov 2009 @ Bremen, Germany
#2
um... thanks?

is it possible to make a script or something like that which only outputs specific values?

(and then, consequently, create some kind of shortcut for the desktio so you can just click/push on it and get all intersting information for you output on the screen)
 
Posts: 64 | Thanked: 130 times | Joined on Dec 2009
#3
Originally Posted by msa View Post
um... thanks?

is it possible to make a script or something like that which only outputs specific values?

(and then, consequently, create some kind of shortcut for the desktio so you can just click/push on it and get all intersting information for you output on the screen)
For the script, sure. Go ahead and experiment with grepping on the X terminal. Not sure about making such shortcut.
 
Posts: 462 | Thanked: 550 times | Joined on Sep 2008 @ Moscow
#4
A small hint: "hal-device" will give you the output much faster. As I still have no n900 I can propose "hal-device bme"
 

The Following User Says Thank You to 412b For This Useful Post:
Posts: 64 | Thanked: 130 times | Joined on Dec 2009
#5
Originally Posted by 412b View Post
A small hint: "hal-device" will give you the output much faster. As I still have no n900 I can propose "hal-device bme"
Ah yes. Seems to work just fine and is much faster, thanks. Though, the output isn't organized as well. Will update the first post accordingly.
 
Posts: 32 | Thanked: 9 times | Joined on Nov 2009 @ Norway
#6
Originally Posted by Phantasm View Post
Alias for same as above except with line 14 (design charge in mAh) as well:
alias bat="lg erc;lg g.des;lg rr|gv h;
Thanks for this - one tiny thing, missing " from end of this alias.
 

The Following User Says Thank You to adrianp For This Useful Post:
Posts: 64 | Thanked: 130 times | Joined on Dec 2009
#7
Originally Posted by adrianp View Post
Thanks for this - one tiny thing, missing " from end of this alias.
Ops. Fixed and thanks for pointing it out.
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#8
Wouldn't it be possible to create a widget with detailed battery info?

I have to admit I have yet to take a look at the sdk/docs etc.
 
Posts: 64 | Thanked: 130 times | Joined on Dec 2009
#9
Originally Posted by M289 View Post
Wouldn't it be possible to create a widget with detailed battery info?

I have to admit I have yet to take a look at the sdk/docs etc.
I'm sure it is. Just takes some random Maemo coder 15 minutes or so prolly.

Would be neat to have a widget that replaces the normal battery bar with battery charge percentage number.

Last edited by Phantasm; 2009-12-11 at 23:17.
 
Posts: 462 | Thanked: 550 times | Joined on Sep 2008 @ Moscow
#10
Originally Posted by Phantasm View Post
I'm sure it is. Just takes some random Maemo coder 15 minutes or so prolly.
LOL
Originally Posted by Phantasm View Post
Would be neat to have a widget that replaces the normal battery bar with battery charge percentage number.
There is, but not for Maemo 5 at the moment Porting is in progress
 

The Following 2 Users Say Thank You to 412b For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 11:39.