PPCGeeks

PPCGeeks (http://forum.ppcgeeks.com/index.php)
-   Android On TP2 Development (http://forum.ppcgeeks.com/forumdisplay.php?f=319)
-   -   [TESTING] SCBS: Improved battery meter system (http://forum.ppcgeeks.com/showthread.php?t=142555)

jonpry 04-06-2011 04:06 PM

[TESTING] SCBS: Improved battery meter system
 
Intro:

Hopefully this stuff will fix your battery woes once and for all. You will need to download and install 4 files. Kernel, modules, rootfs, and an APK. The kernel is an up to date Wistilt2 esque contraption that should support camera and all the latest goodies but no bluetooth support as that seems to interact badly with this setup.

Edit: Now that Wistilt2's kernel pack includes SCBS support you can choose to use his kernel pack. In that case only download the rootfs and BABS.apk. You do not need the kernel or modules.

Instructions:

1. Download the 4 files from the links at the bottom on this post.
2. Copy zImage, modules******.tar.gz, and rootfs.img to the andboot folder of your sd card.
3. Edit STARTUP.TXT and make sure pm.sleep_mode=1 is in there.
4. Boot android
5. Use whatever method you like to install BABS.apk. I use "adb install BABS.apk" from the command line.
6. While should notice improvements right away, SCBS will need to generate a model of your particular battery for maximum correctness. Charge your phone all the way up, and then discharge it to at least 20% with a mixture of sleep and heavy use. Then charge it up again. The more varied use and charge your log has, over a wider range of charge, the better the model will turn out.

Edit: I believe that you will need many hours of sleep, not necessarily all at once for it to work right. Say 8 for now.

7. Open up the Ba Tree App, go to analyze logs. Select the file that represents your charge/discharge data from step 6. If you have not rebooted, this will simply be SCBS.log.
8. Select analyze now. This will use lots of power so have it plugged in, and it won't process while sleeping, so either wake it up periodically until its done, or set the timer. When the process is completed it will show you the model on the screen and ask if you would like to use it.

This is an example from my phone:

cc=0.278898
cb=145.042435
rc=0.663357
re=0.150437
vf=1.098000
cf=0.312500
lr=0.000001
sl=36.714553
se=0.007000

Make sure that your numbers are sort of like this. If they are not, please post your result and log file used to generate it. The result is found in /sdcard/scbs.conf.temp.

If you like the model, then hit yes and enjoy your new meter.

Comments:

There are a couple of constants we are using that just don't appear the same on different models of TP2. Some adjustment of those may be necessary as data is gathered.

Credits:

Jonpry for lots of stuff. Wistilt2 for writing some early kernel mode drivers and doing lots of testing and log generating. Arrrghhh and rpierce99 for testing and log data.

Links:

http://www.prymfg.com/kernel/zImage
http://www.prymfg.com/kernel/modules...3-dirty.tar.gz
http://www.prymfg.com/kernel/rootfs.img
http://www.prymfg.com/kernel/BABS.apk

arrrghhh 04-06-2011 04:08 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I was hopin this would make it to the outside world soon!

Great job ;).

ndno 04-06-2011 04:30 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Thanks!!! Was waiting something like this for a long time. Wow, too many things to test at once. ;)

r^7z 04-06-2011 04:41 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Would this only apply to/work with the TP2 or should this also work with the TP?

steveholtam 04-06-2011 04:48 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Awesome work guys. I'll share my results in a few days!

jonpry 04-06-2011 04:48 PM

Re: [TESTING] SCBS: Improved battery meter system
 
It probably can work, but there are at least 2 numbers that have to be calculated for each device. The process for that is pretty straightforward. There is one person trying to get it to work on Topaz right now, and there are some difficulties getting measurements in a suitable format.

I can get you the instructions, but if it doesn't work the first try it probably will involve getting help from one of the kernel devs with a raph.

ndno 04-06-2011 04:56 PM

Re: [TESTING] SCBS: Improved battery meter system
 
jonpry, I use a couple batteries so I assume the "model" is learning about a specific battery, correct? So it won't be the same for the two batteries, correct? I'll just use my "newer" battery.

jonpry 04-06-2011 04:58 PM

Re: [TESTING] SCBS: Improved battery meter system
 
That's correct ndno. Eventually I want to try and identify the battery that is installed, so you can have a model for each of them.

r^7z 04-06-2011 05:01 PM

Re: [TESTING] SCBS: Improved battery meter system
 
+1 on fav thread :cool:
Will check it out and post back if additional instruction is needed

ndno 04-07-2011 03:23 PM

Jonpry, how many charge/discharge cycles do you recommend to get an accurate model? I'm on my 3rd cycle now since using your files. Should this be run at stock speed or does it not matter? Thanks!

Sent from my FRX06-ized TP2 using Tapatalk

jonpry 04-07-2011 03:28 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I'm not really sure what it takes to get a good model. That is part of the reason for this thread. But i think 3 cycles is more than I have ever done. You should be good to go. I'll be posting a new rootfs shortly that will be able to generate more accurate models.

rpierce99 04-07-2011 03:30 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by ndno (Post 2081434)
Jonpry, how many charge/discharge cycles do you recommend to get an accurate model? I'm on my 3rd cycle now since using your files. Should this be run at stock speed or does it not matter? Thanks!

Sent from my FRX06-ized TP2 using Tapatalk

I'm not nearly as knowledgable about all this as jonpry but I'll take a stab at it.
The way the model works is the more information it has, the better, so you can generate a model today and then generate a model in 3 weeks and the new one will be better than the old one, assuming you used the logs from the whole available time. The important things are that it got charge and discharge at varying levels of battery, make sure you got your battery fairly low before charging it, at least one time.

The speed you use during logging should match the speed you're going to use during use. You are more or less training the app what your battery will do under varying circumstances.

ndno 04-07-2011 04:35 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Hmmm... I got the following results after 3 cycles (charged fully under FRX06 OCed at 650mhz, discharged with normally usage: some texting, some voice calls, a lot of browser surfing, some tapatalk, some youtube, a lot of sleeping in between)

cc=0.353938423
cb=115.441281066
rc=0.454638059
re=0.131118549
vf=1.098000000
cf=0312500000
lr=0.000001000
sl=7.535142851
se=0.007000000

Defintely do not resemble anything in the first post. Unfortunately, these values are Latin to me. The most current scbs.log file I have is 803Kb big. I have like 5 other scbs.log files (.1, .2, ..., .6) which I didn't include in the analysis, should I include them also?

jonpry 04-07-2011 04:40 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Ndno,

Imho those numbers are great. Use them and let us know how it goes.

ndno 04-07-2011 04:59 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by jonpry (Post 2081494)
Ndno,

Imho those numbers are great. Use them and let us know how it goes.

Thanks... I will do so. :)

BTW, I like how you have this in the first post :mrgreen: Deservingly so ;)

Quote:

Credits:

Jonpry for lots of stuff...
Edit: what is the best way to check if my battery meter is accurate besides rebooting to winmo and comparing it against winmo?

jonpry 04-08-2011 11:31 AM

Re: [TESTING] SCBS: Improved battery meter system
 
Ndno,

Unfortunately the winmo battery meter is not terribly accurate. Wistilt2 has been doing lots of "reboot to winmo" experiments anyway, and he says it is consistently within 1%. The things that make this a lot better are that:

1. Plugging in the charger won't cause the level to jump 60%
2. 100% should actually be fully charged.
3. zero, its well empty.
4. Heavily loading the phone won't cause a dip of 10%
5. Putting the phone in sleep doesn't make it apparently charge
6. Thing should be fairly linear.

If your charge only goes up to 98% or so, let me know, there is fix for that.

Starfox 04-08-2011 12:34 PM

Re: [TESTING] SCBS: Improved battery meter system
 
What's the likelyhood of you being able to cordinate with F22/WisTilt to push the required changes to run the apk with the latest development kernel bits/rootfs? I'd imagine that you need both to read the values off battery, and shouldn't interfere if not running the apk. That way you get a good base of guin^H^H^H^Husers and we get to keep the new keymaps etc.

-- Starfox

jonpry 04-08-2011 12:54 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I am working on something with wistilt2 atm. He kind of wants to keep the kernels seperate so that any problems scbs itself can be identified. That being said he is using scbs on his phones and seems to like it. So i'm guessing wistilt2 kernels will be getting scbs added shortly. If F22 wants to integrate my stuff into his rootfs, more power to him.

ndno 04-08-2011 01:22 PM

Quote:

Originally Posted by jonpry (Post 2081931)
Ndno,

Unfortunately the winmo battery meter is not terribly accurate. Wistilt2 has been doing lots of "reboot to winmo" experiments anyway, and he says it is consistently within 1%. The things that make this a lot better are that:

1. Plugging in the charger won't cause the level to jump 60%
2. 100% should actually be fully charged.
3. zero, its well empty.
4. Heavily loading the phone won't cause a dip of 10%
5. Putting the phone in sleep doesn't make it apparently charge
6. Thing should be fairly linear.

If your charge only goes up to 98% or so, let me know, there is fix for that.

Thanks. The battery meter does look more accurate now, especially when I use it heavily, there is no drastic dipping as you indicated. Gonna run this longer and apply the latest log file to get an even more accurate model. Yes, my charge only goes up to 97 or 98% before it stops charging; what is the fix your mentioning?

Sent from my FRX06-ized TP2 using Tapatalk

jonpry 04-08-2011 08:21 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Ndno,

Edit /sdcard/scbs.conf and change Vf to 1.103. Then either reboot the phone or "killall -HUP scbs" What model are you running, ie RHOD100 etc?

ndno 04-08-2011 08:28 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by jonpry (Post 2082241)
Ndno,

Edit /sdcard/scbs.conf and change Vf to 1.103. Then either reboot the phone or "killall -HUP scbs" What model are you running, ie RHOD100 etc?

Thanks. I have the Sprint TP2: RHOD400

Boominsvx 04-08-2011 10:11 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Analysis finished. Candidate is:
cc=0.171811426
cb=72.369357367
rc=0.452867817
re=0.248552169
vf=1.098000000
cf=0.312500000
lr=0.00000100
sl=0.036095755
se=0.007000000

Looking good so far. Any red flags?

ndno 04-08-2011 11:26 PM

Loving this kernel with the SCBS feature. My battery meter is so stable; no crazy percentage jumps or dips, especially when I decide to use data a lot, just very steady discharging percentage. Going swap out my new battery (seller said it's OEM but it sucks, more like a cheap generic) with my old one and redo the model again. My old battery is still very good.

By the way, no crashes, SODs, or reboots to WinMo; been running without shutting down Frx06 for over 30 hrs straight with a 3 or 4 charge/discharge cycles.

Only con is the slow panel wake; sometimes I have to wait over 5 seconds before it wakes up.

Sent from my FRX06-ized TP2 using Tapatalk

jonpry 04-08-2011 11:53 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Boominsvx,

Cb and Sl look low to me. I have seen lower Cb though. Maybe your battery is old and on the fritz. Maybe you did not discharge/charge the phone far enough? Anyways if it works then it works. The model isn't weird enough to cause the nuclear effect or anything. Sometimes we get like negative Cb, so it will charge when unplugged and discharge when plugged in. :p

Boominsvx 04-09-2011 02:46 AM

Re: [TESTING] SCBS: Improved battery meter system
 
I'll give it a good run tomorrow with a full discharge.recharge cycle and see if I just got a short log. Testing to many things I guess. You're right though. This battery is about a year and a half old at least. I can try my other one sunday and compare. Will let you know.

ndno 04-10-2011 06:34 AM

Wow, this kernel is so amazingly accurate in terms of the battery meter. I know you said the winmo meter is not really accurate but every time I boot back to winmo, the percentage is just within 2 percentage points if not dead on. I switched back to my old battery and after 3 charge/discharge cycles, here are my new values:

cc=0.192870918
cb=128.659464784
rc=0.766339117
re=0.132407606
vf=1.103000000
cf=0.312500000
lr=0.000001000
sl=9.651638728
se=0.007000000

However, there is one issue with this kernel: I can't get the wifi to work; it keeps saying error. When I switched back to using the 4/4 wiltist2 kernel posted by arrrghhh, wifi works fine. Can I use the wifi module from that kernel with this kernel? Other than that, this kernel is solid.

Sent from my FRX06-ized TP2 using Tapatalk

jonpry 04-10-2011 10:32 AM

Re: [TESTING] SCBS: Improved battery meter system
 
Ndno,

Your new model looks good. There is a new kernel and rootfs.img i have uploaded. Need both at the same time, neither are backwards compatible. It will make some attempt to determine se=. right now it is just at the default. I think this will improve sleep accuracy, se should be within 0 - .008

Did you download the modules .tar.gz from the first post? That will be necessary to get working wifi. If its still not working post a dmesg from when you try to enable wifi. Works on my phone, just a module problem one way or another.

ndno 04-10-2011 02:53 PM

Quote:

Originally Posted by jonpry (Post 2082866)
Ndno,

Your new model looks good. There is a new kernel and rootfs.img i have uploaded. Need both at the same time, neither are backwards compatible. It will make some attempt to determine se=. right now it is just at the default. I think this will improve sleep accuracy, se should be within 0 - .008

Did you download the modules .tar.gz from the first post? That will be necessary to get working wifi. If its still not working post a dmesg from when you try to enable wifi. Works on my phone, just a module problem one way or another.

Thanks. I will update the kernel and rootfs.img from the first post; I didnt't realize you updated them since you started the thread. I'm using the modules*.tar.gz from your first post. I will make sure when I get back; I will post the error from dmesg for you.

Had a charge lockup this morning. I went to sleep having my phone hooked up to the charger. When I woke up this morning, the led was blinking green but I couldn't get it to wake up; pulled the battery and rebooted to winmo, which showed a 100% charge; booted back to android and it showed a 98% charge. This is with the 1.103 to one of values in sbcs.conf you recommended because my phone would stop charging at the 95-98% range.

Sent from my FRX06-ized TP2 using Tapatalk

arrrghhh 04-10-2011 02:57 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by ndno (Post 2082940)
Had a charge lockup this morning. I went to sleep having my phone hooked up to the charger. When I woke up this morning, the led was blinking green but I couldn't get it to wake up; pulled the battery and rebooted to winmo, which showed a 100% charge; booted back to android and it showed a 98% charge. This is with the 1.103 to one of values in sbcs.conf you recommended because my phone would stop charging at the 95-98% range

I had a lockup condition exactly like this today as well - phone wasn't hot, LED blinking green... all the lights worked (4-button lights & kbd lights) so kernel was *somewhat*awake... But nothing would get the phone to actually turn on. Phone was on the charger all night.

Very weird condition... I wonder if there's some way to have logs going at all times, that rotate when they need to? Probably won't be able to rotate them when they need to... but maybe we can at least get some logging going with the hope that it catches this crap.

jonpry 04-10-2011 03:19 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I haven't seen this charge lock up thing before. I'll have my phone spend more time on the charger in hopes of catching it.

ndno 04-10-2011 03:22 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by arrrghhh (Post 2082946)
I had a lockup condition exactly like this today as well - phone wasn't hot, LED blinking green... all the lights worked (4-button lights & kbd lights) so kernel was *somewhat*awake... But nothing would get the phone to actually turn on. Phone was on the charger all night.

Yep, exactly like yours. Buttons and keys continue to work. That's the only problem I've seen so far (and maybe the wifi, I need to double check). Been running this kernel for the last 4 days without any SOD or reboot to WinMo.

ndno 04-10-2011 08:13 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by jonpry (Post 2082866)
Ndno,

Your new model looks good. There is a new kernel and rootfs.img i have uploaded. Need both at the same time, neither are backwards compatible. It will make some attempt to determine se=. right now it is just at the default. I think this will improve sleep accuracy, se should be within 0 - .008

Did you download the modules .tar.gz from the first post? That will be necessary to get working wifi. If its still not working post a dmesg from when you try to enable wifi. Works on my phone, just a module problem one way or another.

OK, I just downloaded the files from your first post and they are the same as before (I mean the same as the time you first started this thread). So I already have the latest. You mentioned a "new kernel and rootfs.img" but they look the same as those from the time this thread started. When were these uploaded?

I'm going to test the wifi now and post the dmesg for you.

EDIT: OK, it looks like the kernel you have in the first post has a different "version" than the modules you posted. I ran the "lsmod" command and it shows no modules loaded, meaning the broadcom module for the wifi hardware is not loaded. I did some further investigation:

Quote:

# uname -a
uname -a
Linux localhost 2.6.27.46-01301-g595725b-dirty #167 PREEMPT Wed Apr 6 11:36:31 AST 2011 armv6l GNU/Linux
However the modules you have in the first post is modules-2.6.27.46-01300-g78e70e3-dirty.tar.gz, which has build 1300, not 1301. Will the broadcom module load if the kernel has a different build than the modules?

I tried to force the wifi hardware load as follows:
Quote:

# cd /lib/modules/2.6.27.46-01300-g356b733-dirty # it goes to /data/modules
# insmod bcm4329.ko
insmod bcm4329.ko
insmod: can't insert 'bcm4329.ko': invalid module format
The dmesg has the follow error:
Quote:

[ 6778.379180] bcm4329: version magic '2.6.27.46-01300-g356b733-dirty preempt mod_unload ARMv6 ' should be '2.6.27.46-01301-g595725b-dirty preempt mod_unload ARMv6 '
So it seems like the modules and zImage in the first post don't play nice with either other due to the different build number. Can you post the modules*.tar.gz file for build 1301? Thanks.

jonpry 04-10-2011 10:45 PM

Re: [TESTING] SCBS: Improved battery meter system
 
How are you checking that the files are the same as they used to be? Definitely uploaded new stuff. When you run the app it should say scbs version 0.4.a. I will upload a new modules tar shortly and update this post. I thought it would work as long as the git commit was the same id.

ndno 04-10-2011 10:51 PM

Quote:

Originally Posted by jonpry (Post 2083092)
How are you checking that the files are the same as they used to be? Definitely uploaded new stuff. When you run the app it should say scbs version 0.4.a. I will upload a new modules tar shortly and update this post. I thought it would work as long as the git commit was the same id.

Sorry if I'm incorrectly downloading the files. I just use "diff" under Ubuntu to check if they are the same files as the ones I already have on my SD card and they are. I'll try again.

Edit: OK, I have 0.3.d as the version which is old. Is this from the kernel, modules, or rootfs? I will replace the ones on my SD card with the new ones downloaded from the first post.

Sent from my FRX06-ized TP2 using Tapatalk

Edit2: Ok, my rootfs.img was old so I replaced it and now the version is 0.4.a (the only difference was the scbs binary executable). My zImage and modules I have on my SD card are exactly from the first post; the broadcom module won't load as I stated in my last post, even if I forced it via the insmod command.

jonpry 04-11-2011 12:00 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I spent like an hour trying to edit the first post and it just won't commit for me. Urgh. Here is a link to the new modules.

http://prymfg.com/kernel/modules-2.6...b-dirty.tar.gz

arrrghhh 04-11-2011 12:15 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by jonpry (Post 2083306)
I spent like an hour trying to edit the first post and it just won't commit for me. Urgh. Here is a link to the new modules.

http://prymfg.com/kernel/modules-2.6...b-dirty.tar.gz

I'm not sure what's up with ppcg, but "Quick Edit" doesn't work. Hit "Go Advanced", make your edit, "Save Changes" -> should be good ;).

ndno 04-11-2011 01:02 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by jonpry (Post 2083306)
I spent like an hour trying to edit the first post and it just won't commit for me. Urgh. Here is a link to the new modules.

http://prymfg.com/kernel/modules-2.6...b-dirty.tar.gz

Thanks jonpry! Wifi works like a champ now with the new modules. :notworthy:

jonpry 04-11-2011 11:30 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Ndno,

Do you have any logs generated from the new kernel and 0.4.a combination that you can run an analysis on and tell us the results, specifically the se=.

~Jon

ndno 04-12-2011 12:04 AM

Re: [TESTING] SCBS: Improved battery meter system
 
Quote:

Originally Posted by jonpry (Post 2083587)
Ndno,

Do you have any logs generated from the new kernel and 0.4.a combination that you can run an analysis on and tell us the results, specifically the se=.

~Jon

I will attach my latest scbs.log tomorrow; let me get one more charge/discharge cycle in before I post it for you; I'll post the values for you tomorrow. I only started the combination this morning.

ndno 04-12-2011 04:01 PM

Re: [TESTING] SCBS: Improved battery meter system
 
1 Attachment(s)
Jon,

So I had all of yesteday and overnight to gather some more data for the scbs.log(s). Attached is a rar of the 3 scbs*.logs. I tried 3 hours today to run the analysis and it won't stop. At one point, I had it running for 90 minutes and it still didn't finish. Not sure why. :scratch: I was able to do my previous analysis within 30 minutes. So I'm stuck with my previous values (which was obtained 2 days ago with the latest kernel and older SCBS (0.3.d or something like that)).

EDIT: Not sure what's going on but my TP2 keeps going to sleep after a couple minutes even when I set the display timeout to 30 minutes (so that I can run the analysis without it going to sleep). Hmmm... something's not right with my phone.


All times are GMT -4. The time now is 12:03 PM.

Powered by vBulletin® ©2000 - 2024, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com


Content Relevant URLs by vBSEO 3.6.0