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)

arrrghhh 04-19-2011 01:48 PM

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

Originally Posted by manekineko (Post 2087146)
Rhodium 400, original battery

Booted up, charged it to full, then ran it down to 7% with a mix of sleeping, wifi tethering and games before charging it all the way back to full.

cc=0.069308073
cb=115.604675265
rc=0.842694823
re=0.228095166
vf=1.098000000
cf=0.312500000
lr=0.000001000
sl=16.619811388
se=0.010055974

Has anyone collect data multiple times to see how constant these numbers remain between between runs? That would seem to indicate how accurate they really are.

Does SCBS continue generating new logs so we can do that after a model has already been accepted?

Model looks fine to my untrained eyes.

Yes, it will keep generating logs to be analyzed. You can re-run it as much as you want, you can even use multiple logs in the algo.

What I'm wondering is how to stop it? Does it just perpetually take logs? I guess I'm not sure how this is going to be permanently implemented, there obviously has to be some way to automate the process...

fishingmedic 04-19-2011 02:29 PM

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

Originally Posted by ndno (Post 2086489)
I think he doesn't know how to "do" so, especially if he doesn't know Linux; he probably wants the rootfs.img updated with it ;)

@iiinycboi, do you know Linux? If so, you can mount jonpry's rootfs.img under Linux (Ubuntu, Fedora, etc), and copy the navipad.kl from F22's rootfs over as Nate suggested.

If not, you can try this:
  1. Boot into android, using F22's rootfs
  2. Use a file explorer and navigate to /init.etc/keymaps and copy the navipad.kl file to your /sdcard directory
  3. Boot back to WinMo and use a text editor to edit /conf/froyo.user.conf to add the following line in the custom_shells section at the bottom:
  4. Replace F22's rootfs.img with jonpry's rootfs.img and you should get the button mapping the next time you boot into android; you should have SCBS feature working as well as the F22's button mapping.
I haven't tried this myself but it should work.

I took a look using root explorer and couldn't find a navipad.kl file. There were a few RHOD files B1HOME, etc, but wasn't sure if any of the RHOD400 files were correct and didn't see just navipad.kl file.

ndno 04-19-2011 02:57 PM

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

Originally Posted by fishingmedic (Post 2087156)
I took a look using root explorer and couldn't find a navipad.kl file. There were a few RHOD files B1HOME, etc, but wasn't sure if any of the RHOD400 files were correct and didn't see just navipad.kl file.

Hi Fishingmedic,

Sorry I didn't specify the exact files in my instructions; I believe Nate just mentioned the generic "navipad.kl" one and you're supposed to grab the one(s) for your device. So save the 4 files that starts with rhod400_* for your Sprint TP2. In froyo.user.conf, add a mount --bind for each of those files, like the example I showed above. Hopefully that will work.

quid246 04-19-2011 04:07 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Any chance of the code being GPL'd?

Would be nice to export the logs and analyze them on a desktop PC... would definitely cut down on the .conf build time!

arrrghhh 04-19-2011 04:18 PM

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

Originally Posted by quid246 (Post 2087199)
Any chance of the code being GPL'd?

Would be nice to export the logs and analyze them on a desktop PC... would definitely cut down on the .conf build time!

I think jonpry has made an x86 binary of SCBS.

Not sure if BABS will be GPL'd, but the kernel code will be, don't worry 'bout that. Perhaps we can coax jonpry into giving up his x86 version :D.

jandyman 04-19-2011 05:49 PM

Any chance of gettn the changes and files in your rootfs so it can be pushed and used in a partition build?
Ie) init changes? Binaries, etc . . . :)

quid246 04-19-2011 06:05 PM

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

Originally Posted by arrrghhh (Post 2087212)
I think jonpry has made an x86 binary of SCBS.

Not sure if BABS will be GPL'd, but the kernel code will be, don't worry 'bout that. Perhaps we can coax jonpry into giving up his x86 version :D.

x86 EXE would be nice... don't need source, one less step if it's an EXE. :)

I ran the analyzer, but came back 45 minutes later to find my TP2 rebooted back into MightyRom. :angry1:

arrrghhh 04-19-2011 07:23 PM

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

Originally Posted by jandyman (Post 2087252)
Any chance of gettn the changes and files in your rootfs so it can be pushed and used in a partition build?
Ie) init changes? Binaries, etc . . . :)

The binary is in the first post. Just pull out scbs and add the change to init... done.

ndno 04-19-2011 08:56 PM

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

Originally Posted by arrrghhh (Post 2087298)
The binary is in the first post. Just pull out scbs and add the change to init... done.

CWM should allow us, the users, to create an update.zip to patch any distribution with this and share it with the other users.

arrrghhh 04-19-2011 09:08 PM

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

Originally Posted by ndno (Post 2087327)
CWM should allow us, the users, to create an update.zip to patch any distribution with this and share it with the other users.

Yes, assuming they are also running cwm :p

jonpry 04-19-2011 11:58 PM

Re: [TESTING] SCBS: Improved battery meter system
 
The code for scbs is here scbs in scbs - Gitorious

There is just a stupid build script for making it under ubuntu assuming you already have meschach installed. I'm sure it could be built for win32, but I haven't tried. I have a feeling the code could be made several times faster by removing meschach. At least it would be several times faster on x86, on arm novfp its not clear how much time is wasted with memory allocation because the math is just oh so slow anyways.

I have limited data on the consistency of the numbers. From my own experience, the numbers i get all "work", ie my battery meter is always accurate enough that I cannot prove it to be wrong. But there is a great deal of variation in them. Say +/- 25%. That may seem like a lot but its really only -6dB of noise.

It would be nice to get them more consistent, and i have some ideas on how to do it. But none of it is easy, and I wonder what the purpose of getting battery readings accurate to 6 decimal places really is.

manekineko 04-20-2011 11:46 AM

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

Originally Posted by jonpry (Post 2087430)
The code for scbs is here scbs in scbs - Gitorious

I have limited data on the consistency of the numbers. From my own experience, the numbers i get all "work", ie my battery meter is always accurate enough that I cannot prove it to be wrong. But there is a great deal of variation in them. Say +/- 25%. That may seem like a lot but its really only -6dB of noise.

It would be nice to get them more consistent, and i have some ideas on how to do it. But none of it is easy, and I wonder what the purpose of getting battery readings accurate to 6 decimal places really is.

Cool, is there any explanation anywhere on what each of these numbers means? So +/- 25% is still within a few percentage points on the battery meter?

Unrelatedly, just got hit be the connected-to-charger-battery-suddenly-drained-out bug. I'd really been hoping that one would have gotten taken care of by having more accurate readings on the battery meter. Battery drained down to nothing over the course of 4000 ticks of the log, all while it was connected to the charger, and had been connected for like 15000 ticks. Not sure if it's helpful for anybody, but on the off chance it is, I attached my scbs log.

arrrghhh 04-20-2011 12:09 PM

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

Originally Posted by manekineko (Post 2087607)
Unrelatedly, just got hit be the connected-to-charger-battery-suddenly-drained-out bug. I'd really been hoping that one would have gotten taken care of by having more accurate readings on the battery meter. Battery drained down to nothing over the course of 4000 ticks of the log, all while it was connected to the charger, and had been connected for like 15000 ticks. Not sure if it's helpful for anybody, but on the off chance it is, I attached my scbs log.

I've heard this happening to people on WinMo - I've had it literally happen once - you seem to get it much more frequently - for that reason, I think this is a hardware issue, not a software issue.

manekineko 04-20-2011 12:14 PM

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

Originally Posted by arrrghhh (Post 2087627)
I've heard this happening to people on WinMo - I've had it literally happen once - you seem to get it much more frequently - for that reason, I think this is a hardware issue, not a software issue.

Interesting, didn't know it happened on WinMo.

Yeah, I do seem to get hit by this annoyingly often, maybe once every month or two.

It is solved by a reboot, though, which makes it seem like it might be a software issue, but at the very least seems to suggest it can be solved by software.

jonpry 04-20-2011 08:08 PM

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

Somewhere in this thread there is an explanation of the parameters. What scbs.conf were you using when this discharge happened? Do you know of the battery really did discharge or is it possible the readings were wrong?

manekineko 04-20-2011 09:41 PM

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

Originally Posted by jonpry (Post 2087962)
Manekineko,

Somewhere in this thread there is an explanation of the parameters. What scbs.conf were you using when this discharge happened? Do you know of the battery really did discharge or is it possible the readings were wrong?

scbs conf was using the values I posted here:
http://forum.ppcgeeks.com/android-tp...ml#post2087146

Battery really did discharge, when I turned it off, the light was orange indicating charging rather than green indicating charged, and when I rebooted into WinMo battery percentage was consistent with Android, indicating something like 2% charge remaining.

Found the explanation you referenced, in case anyone else was wondering:
http://forum.ppcgeeks.com/android-tp...ml#post2085359

manekineko 04-21-2011 05:04 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Yikes, got hit by the bug again, only this time I didn't catch it in time and it drained the battery flat to the point it couldn't boot or charge normally anymore.

Twice in two days is a lot even for me, hopefully it's a coincidence to when I started to use the improved battery meter.

toadlife 04-22-2011 01:19 AM

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

Originally Posted by arrrghhh (Post 2087147)
What I'm wondering is how to stop it? Does it just perpetually take logs?

By default, it logs to /sdcard/scbs.log, but you can effectively disable logging by making it log to /dev/null

e.g. `scbs -d -co /sdcard/scbs.conf -lf /dev/null`

Here are the command line options...

Code:

# scbs --help
scbs --help
Warning: Failed to open config file /etc/scbs.conf
Super cool battery software, version: 0.04.a

Usage: scbs [OPTIONS]
Start battery daemon or perform maintance functions on data files.

Mandatory arguments for long options are mandatory for short options too.
  -h, --help                display this help and exit
  -v, --version            display scbh version number
  -pn                      print nan warnings to console
  -df PATH                  use device file def:(/dev/scbs0)
  -lf PATH                  use file for logging def:(/sdcard/scbs.log)
  -co PATH                  use file for initial config def:(/etc/scbs.conf)
  -d                        start sbcs in daemon mode
  -s INT                    set the sleep mode data interval def:(5000)
  -w INT                    set the wake mode data interval def:(5000)
  -cf REAL                  set the charge scale factor def:(0.312500000)
  -vf REAL                  set the voltage scale factor def:(1.098000000)
  -se REAL                  set the sleep error constant def:(0.007000000)
  -ln PATH                  open data file and use it to compute linearization
  -n PATH                  open data file and use it to compute Rc,Cc,Re,Cb
  -nr REAL                  set nls learning rate def:(0.000010000)
  -wf                      write the computed battery model out to the config file
  -l PATH                  open data file and generate stream of Cb estimates
  -lr REAL                  set luenberger learning rate def:(0.000001000)
  -rc REAL                  set Rc value def:(0.028796000)
  -re REAL                  set Re value def:(0.130299000)
  -cc REAL                  set Cc value def:(2.064020000)
  -cb REAL                  set Cb value def:(64.219460000)
  -sl REAL                  set Cb slope value def:(0.000000000)


ndno 04-22-2011 02:41 AM

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

Originally Posted by toadlife (Post 2088891)
By default, it logs to /sdcard/scbs.log, but you can effectively disable logging by making it log to /dev/null

e.g. `scbs -d -co /sdcard/scbs.conf -lf /dev/null`

Here are the command line options...

Thanks for the syntax. I think I'm happy with my model now so I'm going to disable logging by redirectly to /dev/null. That should lighten up the writes to the SD card constantly.

toadlife 04-22-2011 09:45 PM

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

I'm having a strange issue with scbs and was wondering if you could shed some light on why this was happening.

I've integrated scbs into F22's latest rootfs and in /init I've integrated the following code, which starts debug logging and scbs

Code:

    logfiledate=`date +%Y%m%d%H%M%S`
    cat /proc/kmsg>"$card"/debuglogs_kmsg_"$logfiledate".txt &   
    logcat -v time >"$card"/debuglogs_logcat_time_"$logfiledate".txt &
    logcat -v time -b radio>"$card"/debuglogs_logcat_time_radio_"$logfiledate".txt &


    dev=$(cat /sys/class/scbs/0/dev | sed -e "s/:/ /g")
    mknod /dev/scbs0 c $dev


    scbs -d -co /sdcard/scbs.conf

The problem I am having is that, if I enable scbs, it causes both instances of logcat to crash with the errors 'unable to access /dev/log/main' and 'unable to access /dev/log/radio'.

I tried starting scbs before the logging and after, and it makes no difference. I also tried some other things like having the script sleep for 5 seconds but the result is always the same. If I start scbs via gscript logcat does not blow up, so it seems like it might have to do with them being fired of in the same tty.

wateverweber 04-24-2011 01:52 AM

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?

Hello, I just switched to wisTilt2's SCBS kernals and am using your roofts and BABs apk. however i am only getting my phone to charge to 99% at most. I found your fix as shown above, however when i went into my sd card i did not have a scbs.conf file, only the logs. I went into Ba Tree app and under SCBS Version is said Warning:Failed to open config file /sdcard/scbs.conf 0.04a

Did i do something incorrectly? or is there a fix to this

I am using a RHOD400 on BLAZN 2.2.2

Thanks

toadlife 04-25-2011 02:14 AM

Re: [TESTING] SCBS: Improved battery meter system
 
I solved my problem of scbs blowing up logcat by starting scbs as a service...

I created a shell script called scbs.sh and placed it in /bin

Code:

#!/bin/sh   
scbsargs=`cat /sdcard/scbsargs.conf`
if [ ! "$scbsargs" == "" ] ; then
    if [ ! -f /dev/scbs0 ] ; then
        dev=$(cat /sys/class/scbs/0/dev | sed -e "s/:/ /g")
        mknod /dev/scbs0 c $dev       
    fi
    scbs $scbsargs
fi

I created a file called scbsargs.conf and placed it in the root of my sdcard...

Code:

-d -co /sdcard/scbs.conf -lf /dev/null
And finally, edited /init.cfg/init.froyo.rc and added scbs.sh as a service...

Code:

service scbs /bin/scbs.sh
oneshot


teemo 04-25-2011 07:29 AM

Re: [TESTING] SCBS: Improved battery meter system
 
Before this SCBS, I used voltage as health indicator: 4.25V=100%
Now my Battery Monitor can't read Voltage, a fully charged battery return 0.100V
What happened ?

FRX06 + arrrghhh's 4/15/11 SCBS

jonpry 04-25-2011 08:53 AM

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

you haven't generated a model yet, so there is no conf file. Also 99% might be more correct than not. Thing is that charging starts to get exponentially slower after 80%. Afaict it can literally take days to get the last 1%,

toadlife,

Is there any particular reason you want to run it as a service? Atm scbs cannot be killed reliably, very bad thing can happen. For restarting we use killall -HUP scbs which just sends a signal to scbs to manage its own restart. Also for those trying to cookup a rootfs, there is a script in /sbin that you will need. Its called updatescbs or something.

teemo,

That is a known bug, still working on it.

toadlife 04-25-2011 12:19 PM

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

Originally Posted by jonpry (Post 2090595)
toadlife,

Is there any particular reason you want to run it as a service? Atm scbs cannot be killed reliably, very bad thing can happen. For restarting we use killall -HUP scbs which just sends a signal to scbs to manage its own restart. Also for those trying to cookup a rootfs, there is a script in /sbin that you will need. Its called updatescbs or something.

Yeah, I posted a few posts back. I've been launching logcat from /init and whenever I would launch scbs logcat would die.

http://forum.ppcgeeks.com/android-tp...ml#post2089505

The service I created only runs once and all it does it launch scbs.

killall -HUP still works AFAIK.

hlo 04-25-2011 11:22 PM

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

Originally Posted by ndno (Post 2088961)
Thanks for the syntax. I think I'm happy with my model now so I'm going to disable logging by redirectly to /dev/null. That should lighten up the writes to the SD card constantly.

I probably missed a post about this but what file do I edit to redirect to /dev/null? Thanks.

manekineko 04-26-2011 01:35 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Just checking, but once scbs.conf has been generated and placed in the root of the SD card, that's all that must be done to install a battery configuration, right?

I'm starting from a clean data.img, and I see in the boot text that the SCBS battery daemon is starting, just wanted to make sure I didn't have to do anything like run BABS again to get it to use the conf file.

steveholtam 04-26-2011 01:40 PM

Re: [TESTING] SCBS: Improved battery meter system
 
Another question for you Jon. At what point do we have enough data to stop running SCBS? After a few weeks your software should have a pretty good model correct? Why would we want to continue running the software, which uses the phones resources and memory?

jonpry 04-26-2011 02:18 PM

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

you don't need to run the app once you are happy with the model and have the conf. the daemon will startup with the phone and will take care of everything else.

steveholtam,

i suppose you can log to /dev/null as others have suggested, but the daemon still needs to run as it does all the battery calculations. I don't think it takes significant cpu to figure out the battery stuff, maybe a fraction of a percent. Imho the sdcard writes are not a big deal either. After all I use sd card as swap space. Others will tell you this is not sane. Its a matter of preference i suppose. Its probably a good idea to set the priority of scbs to absolute minimum. Its rarely going to be critical that the battery meter update right on the timer tick.

toadlife 04-26-2011 04:09 PM

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

Originally Posted by hlo (Post 2091287)
I probably missed a post about this but what file do I edit to redirect to /dev/null? Thanks.

The file /init

It's possible to edit it directly on your phone, but it might be easier to download the file using droid explorer, edit it and re-upload the file.

You have to remount your rootfs so that it is writable in order to change the file

mount -o remount,rw /

Set permisisons on the Remount the fs read only after you're done...

chmod 755 /init
mount -o remount,ro /



If you are confused by any of the above, I would recommend you NOT do this.

steveholtam 04-26-2011 06:04 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I'm trying to stop SCBS by using /dev/null via a terminal emulater. I have set rootfs as writable, but after running the /dev/null code as written above, I get the following error:

Cannot open device: /dev/scbs0

Anyone have a clue on what I should try? THANKS!

toadlife 04-26-2011 06:12 PM

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

Originally Posted by steveholtam (Post 2091650)
I'm trying to stop SCBS by using /dev/null via a terminal emulater. I have set rootfs as writable, but after running the /dev/null code as written above, I get the following error:

Cannot open device: /dev/scbs0

Anyone have a clue on what I should try? THANKS!

You are getting that error because scbs is already running. You can't stop scbs once it's running. In order to change the way it logs you have to edit the file /init and reboot the phone.

You should probably just leave things as they are if you don't understand what that means.

manekineko 04-27-2011 12:20 AM

Re: [TESTING] SCBS: Improved battery meter system
 
If you just don't want the logs anymore after you've setup SCBS, an easy way is to add a line like this to your conf file at the end:
rm -f /sdcard/scbs.log*

steveholtam 04-28-2011 06:30 PM

Re: [TESTING] SCBS: Improved battery meter system
 
I think I am getting reduced battery life because of the SCBS addition to the kernel. Prior to this, I would get to 5pm or 6pm before getting into the red. Since the new addition, I'm getting to about two hours less battery life.

If I can find the prior kernel, I'm just going to switch back.

toadlife 04-28-2011 07:48 PM

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

Originally Posted by steveholtam (Post 2093150)
I think I am getting reduced battery life because of the SCBS addition to the kernel. Prior to this, I would get to 5pm or 6pm before getting into the red. Since the new addition, I'm getting to about two hours less battery life.

If I can find the prior kernel, I'm just going to switch back.

You may want to try just switching to the non-scbs rootfs, as it might be the scbs program (which is in the rootfs) draining your battery and not the kernel changes. I've stopped using scbs myself due to the fact that it seemed to be causing instability in my phone.

jonpry 04-28-2011 09:48 PM

Re: [TESTING] SCBS: Improved battery meter system
 
It definitely uses power, about 2ma by my measurements. I get about 70 hours on my 210.

ndno 04-29-2011 12:44 AM

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

Originally Posted by jonpry (Post 2093289)
It definitely uses power, about 2ma by my measurements. I get about 70 hours on my 210.

Is there any way to reduce its activity? When it runs in daemon mode, does it exchange data with the scbs-supported kernel, "telling" it how to manage the battery meter as well as charging?

jonpry 04-29-2011 08:54 AM

Re: [TESTING] SCBS: Improved battery meter system
 
Not really. The kernel takes battery measurements every 5 seconds, while sleeping or not, and then pipes this data to the daemon which processes the numbers and computes a percentage. The percentage is then sent back to the kernel so it can be presented on the old interface that all htc libhardware's want to use. The measurements have to be fairly often to reduce noise. I really don't see the problem though at 70 hours it is a 10% reduction in life. With more usage, say your only getting 24 hours, its like 3%. At 8 hours its only 1.

manekineko 04-29-2011 05:16 PM

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

Originally Posted by jonpry (Post 2093509)
Not really. The kernel takes battery measurements every 5 seconds, while sleeping or not, and then pipes this data to the daemon which processes the numbers and computes a percentage. The percentage is then sent back to the kernel so it can be presented on the old interface that all htc libhardware's want to use. The measurements have to be fairly often to reduce noise. I really don't see the problem though at 70 hours it is a 10% reduction in life. With more usage, say your only getting 24 hours, its like 3%. At 8 hours its only 1.

How does the previous battery algorithm XDAndroid has been using avoid draining the battery with its calculations? Presumably, it too had to run fairly frequent calculations in order to have something to display.

highlandsun 05-12-2011 06:26 AM

Re: [TESTING] SCBS: Improved battery meter system
 
The previous algorithm woke up every 10 seconds and re-computed everything.


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

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


Content Relevant URLs by vBSEO 3.6.0