Go Back   Android Forums > Android Phones > Motorola Droid X > Droid X - All Things Root
Droid X - All Things Root Rooting, ROMS, Overclocking, etc.

test: Reply
 
LinkBack Thread Tools
Old August 5th, 2011, 11:02 PM   #51 (permalink)
Senior Member
 
darkcyber's Avatar
 
Join Date: Nov 2009
Location: North Alabama
Gender: Male
Posts: 1,565
 
Device(s): Samsung Note 3
Carrier: Verizon

Thanks: 800
Thanked 150 Times in 110 Posts
Default

Quote:
Originally Posted by bouchigo View Post
The inconsistencies are there because you are not wiping the battery stats every time you switch batteries. Either do it in CWR or download BatteryCalibration from the Market.

It's going to be difficult for you to get an accurate reading since you switch out batteries so often.

bouchigo,

So, what are you wiping in CWR...the cache/data? Or is there an actual battery stats wipe? Next, does this BatteryCalibration wipe out the stats as well?

Advertisements
darkcyber is offline  
Reply With Quote
sponsored links
Old August 19th, 2011, 07:13 PM   #52 (permalink)
Junior Member
 
Join Date: Dec 2010
Location: Michigan
Posts: 50
 
Device(s): Droid X
Carrier: Not Provided

Thanks: 9
Thanked 4 Times in 4 Posts
Default

My quest continues for an understanding of battery reporting. I have done the battery calibration, both from the app and from CWR, with a full battery, followed by allowing it to fully drain until it shuts itself down and won't come back on, then replacing the battery with a fully charged one from the separate charger, but yet my same problems persist.

I'm looking for info on exactly what such battery reporting is really measuring. In my quest, I have found some other apps that others may find interesting.

One is called Battery Circle, which also gives 1% increment readings, but also shows the info in the notification/status bar instead of as a widget. The notification bar icon shows a colored circle indicator with a number inside.

The other is Battery Monitor Widget, which offers a plethora of information. This showed me that the phone still thinks I'm using a 1500 mAh battery, which is not correct. It also has a place to manually enter your battery's total capacity, and min and max voltages.

Also nice is the fact that I'm running SSX rom, which offers an option to hide the normal battery icon from the status bar, which only did 10% increments and is redundant with Battery Circle.

I hope someone finds this info useful, and if anyone can point me to info regarding what the battery reporting is actually measuring, I'm all ears.
3club is offline  
Reply With Quote
Old August 19th, 2011, 08:32 PM   #53 (permalink)
not really so scary
 
scary alien's Avatar
 
Join Date: Mar 2010
Location: Indy
Posts: 17,297
 
Device(s): LG Nexus 5, Samsung Galaxy Nexus, Asus Nexus 7, Moto Droid X, HTC Droid Eris
Carrier: T-Mobile

Thanks: 32,672
Thanked 14,906 Times in 7,295 Posts
Default

Quote:
Originally Posted by 3club View Post
My quest continues for an understanding of battery reporting. I have done the battery calibration, both from the app and from CWR, with a full battery, followed by allowing it to fully drain until it shuts itself down and won't come back on, then replacing the battery with a fully charged one from the separate charger, but yet my same problems persist.

I'm looking for info on exactly what such battery reporting is really measuring. In my quest, I have found some other apps that others may find interesting.

One is called Battery Circle, which also gives 1% increment readings, but also shows the info in the notification/status bar instead of as a widget. The notification bar icon shows a colored circle indicator with a number inside.

The other is Battery Monitor Widget, which offers a plethora of information. This showed me that the phone still thinks I'm using a 1500 mAh battery, which is not correct. It also has a place to manually enter your battery's total capacity, and min and max voltages.

Also nice is the fact that I'm running SSX rom, which offers an option to hide the normal battery icon from the status bar, which only did 10% increments and is redundant with Battery Circle.

I hope someone finds this info useful, and if anyone can point me to info regarding what the battery reporting is actually measuring, I'm all ears.
3club,

I can tell you a little of what I know (or think I know ).

From how I think things work, you've got the information that the circuitry in the battery reports (voltage, temperature info, etc.) back to the Android operating system. Android records this information in the batterystats.bin file (located for the Droid X in /data/system/batterystats.bin -- that's the file that gets deleted when you do a "wipe battery stats").

Additionally, Android records this information in a set of files that are a little more palatable for external viewing (or more likely, various APIs) in the /sys/devices/platform/cpcap_battery/power_supply/battery directory (on the Droid X, at least--this directory varies by phone and manufacturer).

Here's an ls -al output of that directory:

Code:
# ls -a -l /sys/devices/platform/cpcap_battery/power_supply/battery
-rw-r--r-- root     root       4096 2011-08-19 21:05 uevent
lrwxrwxrwx root     root              2011-08-19 21:05 subsystem -> ../../../../../class/power_supply
lrwxrwxrwx root     root              2011-08-19 21:05 device -> ../../../cpcap_battery
drwxr-xr-x root     root              2011-08-19 21:05 power
-r--r--r-- root     root       4096 2011-08-19 21:05 type
-r--r--r-- root     root       4096 2011-08-19 21:05 status
-r--r--r-- root     root       4096 2011-08-19 21:05 health
-r--r--r-- root     root       4096 2011-08-19 21:05 present
-r--r--r-- root     root       4096 2011-08-19 21:05 technology
-r--r--r-- root     root       4096 2011-08-19 21:05 capacity
-r--r--r-- root     root       4096 2011-08-19 21:05 voltage_now
-r--r--r-- root     root       4096 2011-08-19 21:05 temp
-r--r--r-- root     root       4096 2011-08-19 21:05 charge_full_design
-r--r--r-- root     root       4096 2011-08-19 21:05 charge_counter
These files correspond to the values reported when an app listens/subscribes for the BATTERY_CHANGED / ACTION_BATTERY_CHANGEDsystem intent.

Most of the files' purpose is self-evident, but you should know that the charge_counter file is the one that contains the 1% battery percentage delta values (note: the values in this file can exceed 100, probably due to the variation in a battery's actual capacity).

The capacity file is what is referenced by the system in reporting and showing the percentage charge on the notification bar's battery icon on your phone. Of course, its values are reported in 10% increments vs. the 1% values recorded in the charge_counter file. I suspect that this is primarily done by Moto given, again, the variability between batteries and the imprecise nature of what a battery's actual reported charge.

Having an app (like my BattMonX app) report the 1% percent charged delta requires directly reading the charge_counter file.

For more details on what and the format reported by the aforementioned system intent, see this page:

BatteryManager | Android Developers.

Also, you might gain some insight on your particular problems from here:

Phone not charging when dead. Unable to find help anywhere!

Do You Know Everything There Is To Know About Lithium Ion Batteries? If Not, Read This… | xda-developers

Things You Should Know About Lithium Ion Battery - xda-developers

Hope that helps.

Cheers!
scary alien is online now  
Reply With Quote
The Following 2 Users Say Thank You to scary alien For This Useful Post:
Android Al (August 20th, 2011), XBarbarian (August 23rd, 2011)
Old August 19th, 2011, 10:57 PM   #54 (permalink)
Junior Member
 
Join Date: Dec 2010
Location: Michigan
Posts: 50
 
Device(s): Droid X
Carrier: Not Provided

Thanks: 9
Thanked 4 Times in 4 Posts
Default

Thanks Scary, that's all good info. I'll try your app out too.

So if I understand what you've taught me, it seems like all the programs either read the capacity or charge_counter file, and the capacity file is really just the rounded off value from charge_counter. So none of these programs are really measuring or calculating the remaining battery life, just reporting what the phone itself puts into that file, right?

So I guess I'm still wondering how the value in the charge_counter file gets figured.
3club is offline  
Reply With Quote
Old August 19th, 2011, 11:11 PM   #55 (permalink)
not really so scary
 
scary alien's Avatar
 
Join Date: Mar 2010
Location: Indy
Posts: 17,297
 
Device(s): LG Nexus 5, Samsung Galaxy Nexus, Asus Nexus 7, Moto Droid X, HTC Droid Eris
Carrier: T-Mobile

Thanks: 32,672
Thanked 14,906 Times in 7,295 Posts
Default

Quote:
Originally Posted by 3club View Post
Thanks Scary, that's all good info. I'll try your app out too.

So if I understand what you've taught me, it seems like all the programs either read the capacity or charge_counter file, and the capacity file is really just the rounded off value from charge_counter. So none of these programs are really measuring or calculating the remaining battery life, just reporting what the phone itself puts into that file, right?

So I guess I'm still wondering how the value in the charge_counter file gets figured.
Well, I would actually guess that most apps actually use the system intents to get these corresponding values vs. reading the files directly. The early versions of my app actually did read these files directly before I realized I could use the system intent (although I still have to read the charge_counter file directly in order to get the 1% charge delta value).

From what I understand, the charge_counter file is actually populated by the kernel in the ../kernel/drivers/power/cpcap-battery.c source file. Some devs have tried to re-direct the value of this file over to the capacity file, but doing this temporarily "breaks" the reporting of the capacity file (the source code shows that this can happen) until a reboot is performed (I can't find my link to the above source at the moment, but if you want, I'll track it down).

So, its really the kernel that is doing the communication with the battery and reporting that back to the rest of the Android operating system. Unfortunately, we can't replace the kernel on the Droid X, so we're stuck with these work-arounds at this point.

Cheers!
scary alien is online now  
Reply With Quote
Old August 19th, 2011, 11:48 PM   #56 (permalink)
not really so scary
 
scary alien's Avatar
 
Join Date: Mar 2010
Location: Indy
Posts: 17,297
 
Device(s): LG Nexus 5, Samsung Galaxy Nexus, Asus Nexus 7, Moto Droid X, HTC Droid Eris
Carrier: T-Mobile

Thanks: 32,672
Thanked 14,906 Times in 7,295 Posts
Default

3club,

BTW, here's a link to the XDA thread that links to some posted pastebin's of the cpcap-battery.c source:

http://forum.xda-developers.com/showthread.php?t=950888&page=2

cpcap-battery.c source: http://pastebin.com/TnZ3P8CN

Interesting stuff...wish we could recompile and replace the kernel, though.

Cheers!
scary alien is online now  
Reply With Quote
The Following User Says Thank You to scary alien For This Useful Post:
XBarbarian (August 23rd, 2011)
Old August 19th, 2011, 11:49 PM   #57 (permalink)
Junior Member
 
Join Date: Dec 2010
Location: Michigan
Posts: 50
 
Device(s): Droid X
Carrier: Not Provided

Thanks: 9
Thanked 4 Times in 4 Posts
Default

Quote:
Originally Posted by scary alien View Post
From what I understand, the charge_counter file is actually populated by the kernel in the ../kernel/drivers/power/cpcap-battery.c source file. Some devs have tried to re-direct the value of this file over to the capacity file, but doing this temporarily "breaks" the reporting of the capacity file (the source code shows that this can happen) until a reboot is performed (I can't find my link to the above source at the moment, but if you want, I'll track it down).

So, its really the kernel that is doing the communication with the battery and reporting that back to the rest of the Android operating system. Unfortunately, we can't replace the kernel on the Droid X, so we're stuck with these work-arounds at this point.

Cheers!
Well, I think I found the source here [C] cpcap-battery.c - Pastebin.com

lol, too bad I'm not a programmer who can read what it says! lol

It doesn't look much like the BASIC programming we did in school 25 years ago!
3club is offline  
Reply With Quote
The Following User Says Thank You to 3club For This Useful Post:
scary alien (August 19th, 2011)
Old August 19th, 2011, 11:51 PM   #58 (permalink)
Junior Member
 
Join Date: Dec 2010
Location: Michigan
Posts: 50
 
Device(s): Droid X
Carrier: Not Provided

Thanks: 9
Thanked 4 Times in 4 Posts
Default

lol, you type faster than I do!
3club is offline  
Reply With Quote
The Following User Says Thank You to 3club For This Useful Post:
scary alien (August 19th, 2011)
Old August 19th, 2011, 11:57 PM   #59 (permalink)
not really so scary
 
scary alien's Avatar
 
Join Date: Mar 2010
Location: Indy
Posts: 17,297
 
Device(s): LG Nexus 5, Samsung Galaxy Nexus, Asus Nexus 7, Moto Droid X, HTC Droid Eris
Carrier: T-Mobile

Thanks: 32,672
Thanked 14,906 Times in 7,295 Posts
Default

Quote:
Originally Posted by 3club View Post
lol, you type faster than I do!
LOL right back at cha! .

Yeah, I was busy answering Introduction threads and I took a break and did a quick search for it...it was the original thread that I saw this in a while back. I've downloaded the Moto source, too, but I'm assuming its the same or similar code to what's in the pastebin (the source is massive, LOL, haven't unpacked it yet).

Anyway, like I said, its interesting reading, but is a academic exercise at this point .

Cheers!
scary alien is online now  
Reply With Quote
Reply


Go Back   Android Forums > Android Phones > Motorola Droid X > Droid X - All Things Root
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:41 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.