yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] RogerPodacter:
So if its a fake why are the mAh numbers showing what they do in his log? It's very confusing to me. I remember when trying to hit learn mode on my nexus the phone would turn off when it reached active empty mAh even though it was still at 3.5 volts, so it had more juice left. It seems like the same is happening with his phone. There's no way it should be turning off at 3.8 volts. It seems like its only reading 1360mAh and actually running out of mAh down to zero and turning off when really there may be much more mAh left. It's just not reading it or something.
[Nexus One Android Development] chowlala:
That's why I said my phone runs on the mAh. It seems to read off that instead of the mV's. Perhaps the mV's guide the mAh. And I have no technical knowledge bout the battery stuff though.

But I think his numbers are reflecting a bad battery or spoofed/faked stuff. Like the thread over in the accessories, the values aren't well represented sometimes. Perhaps there's som disparity between the mV's and mAh?

*shrug*
[Nexus One Android Development] RogerPodacter:
Well they both are related. One thing I learned from all this and the data sheet explains, the phone will shut off at its active empty voltage point. And that point has an estimated active empty mAh point. They are supposed to line up with each other. But they don't always, hence the die at 10% issue we've seen. Crossing either one triggers shut down.

Since he's not using a stock battery something is getting goofed with his phones empty mAh and voltage points. damn we need a way to pull register values easier to trouble shoot this kind of stuff. I bet there's a huge market for this type of battery stuff if we could get that app going.
[Nexus One Android Development] chowlala:
From the looks of it... it almost seems as if your battery has no charge controller to prevent it from overcharging. So when the battery hits the failsafe, it discharges everything.

Does your phone get pretty hot during the 15 mins?
[Nexus One Android Development] dharani1234:
Help with my battery

I think there are some "battery" masters in this thread and was hoping if somebody would help me out with my current issue. I am using the 8/27 Wildmonks kernel with SetCPU set at 1 GHZ/254 mhz and when screen off it's 128/128. This was working fine till oneday the battery drops sudenly. I am attaching the a part of the log file from which if I see; at 6:11 I have 72% battery and by 6:20 it's down to 61 %. I don't understand what's causing this. Any help from the battery masters would be appreciated.
[Nexus One Android Development] yatman60:
Ok - first I'll apologize if this is not the best place to ask this question but since you all seem like battery experts I'm hoping someone can help answer some questions and maybe save me some money.

So the situation is that I moved to a Droid Incredible (Android obviously) from a HTC Imagio (WINMO 6.5). Turns out the extended battery is the same form factor for both phones, same voltage and same amperage.

So the problem I noticed is that when I plug in the Imagio's extended battery into the Incredible, it seems the Incredible can't read any of the battery stat info. Another strange thing is when I plug in the phone with the said battery, the charging light never goes on.

Aren't these batteries all pretty much the same? Why would the "official-Incredible" extended battery work fine and the "official-Imagio" extended battery from the Imagio not work if it has the same power characteristics?

I should note that both batteries are "official" HTC branded batteries.

Thoughts, guidance, suggestions?

Thanks,

Teesh

(2 week old android newbie)
[Nexus One Android Development] RogerPodacter:
Well from what we've learned is all these batteries have in them eeprom chips built in which contain all the stored parameters for that battery. And the device manufacturer writes the driver to read that battery chip. For example the nexus one has the ds2784 battery fuel gauge chip. So does the palm pre. In the palm pre's case, when they pop in an extended battery like a seido or mugen, it seems to use the same ds2784 chip so the phone can correctly read all battery parameters normally.

If your extended battery does NOT use the same standard chip as in your case it seems, then the driver will not be able to read your parameters. That's what's happening in your case it seems. It seems though that most of these well known after market battery makers are indeed using the proper chip, which is why the palm pre guys can swap to extended batteries and still read all proper battery info. I guess your after market battery just doesn't use the right stock chip.
[Nexus One Android Development] theloginwithnoname:
crazy crazy charging

OK so here's one for you lot.

On-charge from dead. Charged to 1251mAh then jump to 1358 (expected). Unplugged at first full=1 flag.

Shut down. Pulled battery. Removed SIM (to do some unrelated GPS reset stuff).

Booted. OS monitor at 1354.

Shut down. Pulled battery. Replaced SIM then battery. Charged til green (approx 5-10 mins). Unplugged.

Booted. OS monitor shows 1468!

I think ram130 had this too. So so strange.
[Nexus One Android Development] RogerPodacter:
Sounds exactly like "bump" charging that started all this way back in beginning of the thread. I'm not sure how strange it is since we supposedly have 1452mAh full 40 batteries. But we never did figure out why off charging bumps all the way up that high. Why does the ds2784 pre loaded parameters kick in when on-charging (expected) but not kick in while off-charging (bump charge)?
[Nexus One Android Development] theloginwithnoname:
quite!

On a separate note, I've compiled the kernel that ships with current versions of cyanogenmod minus the code that extends battery charging - it's available here with the same disclaimer as my previous kernel link.

This image is kernel version 2.6.35.4 and stops charging when battery flags "full" only - i.e. it does not use any %age or charge values to stop the on-charge.
[Nexus One Android Development] RogerPodacter:
i just learned about the app called "power tutor" (not sure how i missed it). been using it and its very interesting, i wonder how they are reading the pwoer values. their website explains it somewhat, using approximation, but still its rather interesting to see what each component of your phone is using...
[Nexus One Android Development] ram130:
Yep exactly. Feels like we going in circles..:D
[Nexus One Android Development] computerjunkie:
Was there any progress on this? It seemed like you guys were onto something. I read the first 51 pages then skipped ahead.

I have an HTC Evo and seem to have a similar (althought not exactly) the same problem. I bought a seidio extended battery for my evo but from what i've read, htc hardcoded the 1500 mAh of the stock battery into the kernel.

Is it possible to change this to something else?
[Nexus One Android Development] RogerPodacter:
Yes there is some progress, we JUST got setreg working this weekend, which means we can now write any parameter we want and change its value. From this, just today no name login successfully activated learn mode and it worked just like it should. Refer to the other thread for details:

http://xdaforums.com/showthread.php?t=765609&goto=newpost

So this was the whole key and road block. We are just gonna refine the kernel a bit to get it solid, then you guys can have at it and fix your batteries. There's a few things we can fix on top of learn mode, I'll post them later (their explained in the other thread also).
[Nexus One Android Development] computerjunkie:
Thanks for the quick response! Does this mean that the kernel will be able to learn the capacity of any eligible battery we put into the phone?
[Nexus One Android Development] RogerPodacter:
so like i said above, we finally got setreg functionality working!!! yehh! this means that now we can easily hit learn mode with little difficulty. i first played around and set my age scalar to 100%, and my percentage meter instantly adjusted itself. so now whenever i charge my battery, i reach 1444 mAh at full charge, no matter what. because my battery now thinks it is "brand new" from the factory.

from this point forward, there may be a few things we can do to increase the capacity of our batteries, above and beyond the learn mode thing. i'm gonna experiment and play around with my crap old battery and see if i can raise the full charge voltage, and lower the empty voltage points, which expand the battery's range overall. i'm not talking a huge change, but i'm pretty sure going up to 4.191 volts is totally safe. similarly at the lower end, our battery shuts off at 3.416 volts. i'm not sure if that can go any lower in a safe manner, but who knows.

the <80mA in the code is no longer needed, as we can now hard-set that value inside the battery itself. we can set it to <20, 40mA, whatever value you would want. by doing this, it now "officially" would increase the top end range of your battery. with the current method, we are missing that top portion of our capacity.
[Nexus One Android Development] RogerPodacter:
to answer your previous question, yes i think you could change your extended battery value above 1500 mAh or whatever. i havent seen the EVO kernel code so i dont know what's going on. but on a side note, i always read about the EVO and Incredible having problems where when you take it off the charger, it drops too quickly down to 90%. there's a reason for this, inside the HTC code, check this comment out:

/* We don't move from full to not-full until
* we drop below 95%, to avoid confusing the
* user while we're maintaining a full charge
* (slowly draining to 95 and charging back
* to 100)
* Oddly, only Passion is for 99% cycles, HTC
* set the Bravo to 95%.
* -od of xbravoteam
*
* Set 99 for Passion - pershoot

so what's happening is, the user only sees "100%" all the time, but really the battery is continually dropping down to 95%, then charging back up. notice the nexus one (passion) does NOT do this down to 95%, it only goes down to 99% then charges right back up. this is the reason for all the threads i read on androidcentral about people complaining about this. now we know why.

you definitely could change the code to 99% like the nexus, for starters.

to answer your extended batt question, as long as the extended batt uses the same model chip inside as the stock battery, then yes. we see the palm pre extended batteries do in fact use the correct chip, so they are able to change their values on their extended batteries. i see no reason why the evo would be different. but we wont know till someone tries it.
[Nexus One Android Development] computerjunkie:
I would be willing to try it. How would I know if it uses the same chip?
[Nexus One Android Development] RogerPodacter:
i've never specifically seen the EVO code, let me go look for it. but in the mean time you could use root explorer or astro file manager, and go digging thru your file structure and find the battery driver folder. the name of that folder should tell you the battery model.

so the nexus one, under /sys/devices/platform/ds2784-battery/ - and all the battery files are inside here. however other phones are in slightly different places, so if its not there, its somewhere around there but you will just have to dig around and see. look for folders like "max17040" or "max8925" or "ds2782" etc. those all seem to be different model battery chips.

since its an HTC msm family phone, i bet it might be similar to the nexus.
[Nexus One Android Development] computerjunkie:
I'm using a custom kernal...does that matter?

I have a sys/devices/platform/htc_battery

but none of the files/folder names in that location specify a specific name.

I have looked at the evo code and we have the same ds2784_battery.c file included in our source code.

edit:I'm flashing the stock kernel. Will report back with my findings.
[Nexus One Android Development] RogerPodacter:
well i'm not sure you have to go flash back to stock just yet. which custom ROM do you run? i assume its cyanogen or using pershoot's kernel?

anyway i just downloaded the entire EVO source code from HTC site, but i cannot open the file here at work!! grrr, if you can download from HTC site and open the file and email it to me or post it, we can find out more info.

http://developer.htc.com/
[Nexus One Android Development] computerjunkie:
I have the evo source...which files would you like? here is the list of filename from the \drivers\power location:

\drivers\power\power_supply_core.c
\drivers\power\power_supply_leds.c
\drivers\power\power_supply_sysfs.c
\drivers\power\tosa_battery.c
\drivers\power\w1_ds2784.h
\drivers\power\wm97xx_battery.c
\drivers\power\wm831x_power.c
\drivers\power\wm8350_power.c
\drivers\power\apm_power.c
\drivers\power\bq27x00_battery.c
\drivers\power\da9030_battery.c
\drivers\power\ds2760_battery.c
\drivers\power\ds2782_battery.c
\drivers\power\ds2784_battery.c
\drivers\power\Kconfig
\drivers\power\Makefile
\drivers\power\max17040_battery.c
\drivers\power\olpc_battery.c
\drivers\power\pcf50633-charger.c
\drivers\power\pda_power.c
\drivers\power\pmu_battery.c
\drivers\power\power_supply.h

Also, I flashed back to the stock kernel and still didn't had the htc_battery folder with nothing specific named. I am running the Virus rom with the stock HTC kernel. before that I was running a custom netrachy kernel.

in case you are wondering, here is what I am\was running:

ROM: http://virusrom.com/Roms/VirusROM%20SENSE%20BASE/VirusROM_BASE_SENSE_RC3.zip

Kernel (custom): http://virusrom.com/Kernels/Netarchy/Netarchy-4.1.9.1-havs.zip

Kernel (stock): http://virusrom.com/Kernels/Stock/2.6.32.15_STOCK_KERNEL_3.29_OTA.zip
[Nexus One Android Development] RogerPodacter:
hmmm ok well i would go inside that HTC_BATTERY folder

I have a sys/devices/platform/htc_battery

and see if there are actually populated files anywhere in there, like voltage, current, etc. look thru all the sub folders. this is to determine if that is in fact the active folder, because all over these folders in linux some will be active and some will not. the active ones always output lots of files, the ones not in use are usually empty or only contain a few files.

i'll take a look at those links. me guess is you have identical battery as the nexus, because your power folder is the same as the nexus, identical. we just need to get your .c file!
[Nexus One Android Development] computerjunkie:
the htc_battery folder only has a few files and folders. nothing that specifies a chip name.

Which .c file would you like? I can include them here if you'd like.
[Nexus One Android Development] RogerPodacter:
were there any voltage or current files in there, or in subfolders? sorry i dont think i need any of those .c files because they are all the same as i already have from the nexus. but send my the ds2784 one just to check out be sure. its rogerpodacter AT gmail

i'm gonna check AOSP and see if maybe supersonic is listed threre.

i would keep looking around in different folders, because if that HTC_BATTERY folder is empty, then that is not your active battery folder. which means you still have to find the active one, which will contains extra files. the name of that folder will be the one we may need.
[Nexus One Android Development] RogerPodacter:
honestly the real way to figure this out is download the source code from HTC developer site. they have a link specifically for the EVO which will contain all the .c files.
[Nexus One Android Development] computerjunkie:
Yea. I downloaded it and have all the files extracted. There is are some random files in the htc_battery folder but nothing that is named voltage or anything of the sort. I will keep digging in root explorer. If there is a specific file you would like, let me know and i can email it or attach it here for you.
[Nexus One Android Development] RogerPodacter:
ok i think i got it. go ahead and send me your ds2784.c battery file, and actually all the other ds27XX.c files as well if you can. but i found the HTC Desire ds2784.c file which does in fact list HTC_BATTERY as the folder. so what i mean is that might be it (though there should still be more files inside of it). but anyway let me take a look at the ones you send me.
[Nexus One Android Development] computerjunkie:
Sent the following to your gmail as requested:

bq27x00_battery.c
da9030_battery.c
ds2760_battery.c
ds2782_battery.c
ds2784_battery.c
[Nexus One Android Development] RogerPodacter:
k thx. and i would do one more thing, open up OS monitor, go to the last tab on the right. then click menu button, options, all the way down select dmesg log. then filter(dmesg), select enable filtering. then change TAG FILTER and type in "batt" without the quotes. now go back to the rightmost tab, and tell me what info pops up in your dmesg log. this will get you going for sure.
[Nexus One Android Development] RogerPodacter:
the point of that was on the nexus it shows the name of the battery in the log. yours seems to say SMEM_BATT or M2A_RPC but i have no idea if those could be it.

you know, you have your extended battery inserted right now? i wonder if that makes a difference. i mean, if the stock battery is detected it does one thing vs a different thing with an aftermarket battery.

all you need is to find the correct source code file for your phone! that's it! lol
[Nexus One Android Development] RogerPodacter:
Sorry we haven't been as active in this thread. The captivate driver may be different the way it labels all of its relevant battery info which is what shows up in the dmesg log. But still, filtering for "batt" I'd think would find it.

I also thought you needed to be rooted for the dmesg log output to show up in OS monitor. Not sure why that would matter though.

So in or monitor click options, at the bottom hit dmesg filter, tag filter type "batt" without the quotes. If that really doesn't work experiment with different tags you think it might be.

You could also find the driver source code and look thru that to see how they are labeling system info messages.

Last resort, don't filter your dmesg log at all, and just watch it with all populated messages. You're bound to see a few battery messages in there. Then you could use that text label to filter down only your battery info. Make sense?
[Nexus One Android Development] RogerPodacter:
Also, could you find what type of battery your captivate has? Look thru sys/devices/platform and search around the folder names. It also may be completely other location as we've seen with the evo, so just search everywhere if you have the time. Thanks.
[Nexus One Android Development] RogerPodacter:
Ok so a few options for filtering your dmesg log could be: "battery", "level", "Jupiter", "battery state", or "charging". That might get you in the right direction.
[Nexus One Android Development] Dankenstein:
Will do RP. But I've already tried all the filtering combinations in OS Monitor -- Anal attorney reflex. Tried all and eliminated all. I ONLY get a dmesg for the batt filter if I check Debug or None. Every other setting returns bupkis -- 0 messages.

I'm not educated enough to find anything in the source code yet, i'm sure. But I can definitely sniff around my files as you advised.

And I am definitely rooted. [WARNING . . . proud father type digression ahead] Now running an amazing setup (found through lots of luck and a little trial and error -- only had to flash Odin3-Stock once to get out of trouble). Used DG's OTA for JH7, then flashed the classic S.R.E.v1.2.1a (OC), then OCLF to complete. GPS is amazing now, and it's super snappy. [/END misplaced digression]

No idea if any of that makes any difference either. But off to troll through some sys files . . .

And thanks to my ADD, I also remembered that I got some interesting info from playing with Anycut Activity shortcuts to battery related stuff. Will post those dropcaps also to see if they're of any use.
[Nexus One Android Development] Dankenstein:
Trying these first, RP, now.

Also -- OS Monitor has a box under the heading of Misc/Get Status via File -- below which it says

-- with a check box next to it. I checked it due to info read a while back about Captivate battery info. no idea what it's doing, though, since it seems to make no difference to my dmesg logs if it's checked or unchecked. Again, I went through the anal attorney elimination thing.
[Nexus One Android Development] RogerPodacter:
I never use the filter log option, I always leave it as NONE. so I only use the tag filter and type in the relevant text. However if debug gave you something then I'm not sure. I'd just stick with leaving filter log set to none.
[Nexus One Android Development] Dankenstein:
No dice on any of those -- leaving Filter Log set at "None." -- since this is setting with the most info when I filtered for "batt" and got the jupiter stuff to log.

Also tried filtering for "power_supply" and got nothing. And i even tried filtering for "*" -- based on the /sys/class . . . monitoring option in OS Monitor. The * filter did return stuff. But it looks to have nothing to do with the battery. But what do I know. Will edit this from my Cappy to post that log.
[Nexus One Android Development] RogerPodacter:
Yeah I've noticed that option but never tried it. I'll look into it and see what its all about.

I do know that path has a "battery" file, but I've never been able to pull the info from it. I think its just another place that contains all batt parameters such as voltage, current, etc. Which all that info is available in the battery driver folder anyway. Perhaps Google made that folder a standard location across all devices for simplicity so no matter which device used you can always grab that info.
[Nexus One Android Development] RogerPodacter:
Then we need to find the source code. I've seen that Jupiter battery driver before in the cyanogen ROM source code. I'll go take a look.
[Nexus One Android Development] Dankenstein:
New post is easier for the same of fluidity . . .

So, this is what I got when filtered for "*":

10/16/2010 00:17:36 [DEBUG] *** DEBUG : start mmc_rescan (mmc0)***
10/16/2010 00:17:36 [DEBUG] *** DEBUG : start mmc_rescan (mmc2)***
10/16/2010 00:18:40 [DEBUG] *** DEBUG : start mmc_rescan (mmc0)***
10/16/2010 00:18:40 [DEBUG] *** DEBUG : start mmc_rescan (mmc2)***
10/16/2010 00:27:15 [DEBUG] *** DEBUG : start mmc_rescan (mmc0)***
10/16/2010 00:27:16 [DEBUG] *** DEBUG : start mmc_rescan (mmc2)***

Html format doesn't help with the format/spacing either. had to respace by hand again ---- any way to make sure the log is in proper format, for when I finally succeed (hopefully) and actually have a real log to post? That will take me forever to respace by hand. It annnoys me to look at all the other neat and pretty logs with he [INFORMATION] filters and proper line spacing . . . I want that. Is it too much to ask? :(

And I am definitely sticking with the "None" filter.
[Nexus One Android Development] Dankenstein:
I'm going to take a break from in from of the computer and troll through the sys files now. But I remember looking a while back through the /sys/class, etc. for battery stuff -- and other /sys and /system files in archaeological fashion. There are weird endless loops in those files when you get into them. Or maybe it's just my noobish ignorance again. But I got the hell outta Dodge, as I respect the ROOT and know the ledge.

Seriously -- thanks for even responding.

Back in like 15 minutes or so . . .
[Nexus One Android Development] Dankenstein:
Found nothing that looked useful -- and the many files I could click for text showed nothing at all. And the endless loops almost caught me again. I will keep looking in other files with both Astro and Root Explorer. But it's a quagmire.

*Giggity*
[Nexus One Android Development] RogerPodacter:
Don't worry about the contents of the files, It's just the folder name we're looking for. But yes I've gone very deep into looking into every sub folder that exists! The endless files actually have meaning but I don't have time to go into it:-)
[Nexus One Android Development] ram130:
I'm back..some what..I got the Vibrant with me same way..so if you guys need any help let me know.