yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] bemymonkey:
Has anyone got this working on the Dream with the MT3G Froyo ROM? I get values, but they're unbelievable - 4mA in standby even though the battery is draining at about 10% per hour... :confused:
[Nexus One Android Development] rm9:
CurrentWidget takes the values from the battery driver output.

So if the values are wrong, maybe the driver is giving out the wrong values..
[Nexus One Android Development] bemymonkey:
That's very likely... but there's no chance it's reading the wrong file, right?
[Nexus One Android Development] rm9:
There is a chance but I haven't seen a device that gives bad values in one file and good values in another. :)

You can post here (or PM me) the files you have in /sys/class/power_supply/battery just to be sure.

You can also try to talk with the developers of the ROM, maybe they can fix this.
[Nexus One Android Development] Arise:
What exactly should be exported? Can you give a sample or something?
[Nexus One Android Development] rm9:
Some devices create a file with the value of th current .

N1 uses current_now for example.

Other devices creates a big file with all kind of info in the format "field: value" and some where there is a current value...

I don't understand why can't everyone do the same. :)
[Nexus One Android Development] Arise:
As far as I can tell both Vibrant and Captivate have the file: batt_chg_current.

The international (I9000) version does not.

Maybe we can add support in the kernel... :)
[Nexus One Android Development] rm9:
Funny, a few days ago I looked at this exactly.

Samsung released the source code to for the Galaxy rom and kernel but you can't commit back changes to them, so we can't change anything.

However, you can ask the custom ROM developers to add it.
[Nexus One Android Development] 3c:
Hello,

Please note that CurrentWidget if set to refresh every 5 minutes it will be very inaccurate and will not show actual consumption in between!

Use Battery Monitor Widget, it's much more accurate, provides more data and ways to investigate while consuming less battery! Verified on my HD2 under various builds, see screen-shot of a test in identical conditions: saving log and refreshing every minute.

As pointed out anyhow, if the drivers provide wrong information no Widget will be able to cope with it!
[Nexus One Android Development] 3c:
Droid Pro - anybody

Hello

I've noticed some user having a Droid Pro don't seem to get the current drain, always 0mA?

Also most Samsung phones do not report mA current?

Anyone having such phone with spare-time to help investigate this???
[Nexus One Android Development] Forge94:
I've been noticing my N1 being extremely laggy lately, especially ADW launcher EX (which takes at least 2 seconds to respond to a swipe.)

So I downloaded current widget to try and find the cause.

According to everyone else's observations on how they only are seeing a drain of 5-6 ma, there's definitely something wrong with mine.

As I'm typing this, its at 341mA on standby!

The battery dies extremely quick and the phone lags like crazy. I can't seem to find the source of the drain, since all my running services are the same as they were last week (when I had no issues.)

Any suggestions?
[Nexus One Android Development] dextroz:
When people say 5-6mA it is idle drain when the screen is off and no active download/app is running besides regular background processes.

Your figure sounds like that is active use drain when screen is on.
[Nexus One Android Development] OldMike60:
Log??

Just downloaded the CurrentWidget; great app, just what I was looking for. But I can't seem to get to the data. I left the log location in the default, but app says it cannot find the log. Tried specifying a name; no different.
[Nexus One Android Development] rm9:
do you see the mA value on the widget on your home screen?
[Nexus One Android Development] OldMike60:
Work on HTC Inspire?

I just noticed this thread is in the Nexus area. Will the app work on an HTC Inspire?
[Nexus One Android Development] rm9:
Till now it usually worked on HTC devices, so it might work.

let me know if you see the values on the widget...
[Nexus One Android Development] OldMike60:
I get the GUI, but no numbers displayed anywhere. I see at the Market that there is a transparent pop up; is that automatic? I don't see a selection for that.
[Nexus One Android Development] rm9:
You need to add the widget to your home screen.

When viewing the home screen, hit the menu button and then touch 'Add'.

Select widgets and then CurrentWidget.
[Nexus One Android Development] OldMike60:
Yep!

Works fine now. I saw some comments and maybe a screen shot about the widget popping up over a running app, which would allow changing settings and taking readings. Can't find a menu for that.
[Nexus One Android Development] rm9:
You can access the widget's preferences and log using the launcher (there's a CurrentWidget icon).
[Nexus One Android Development] rm9:
CurrentWidget 0.27

Hi all,

I'm no longer updating this thread with new versions.

The latest version added support for the new battery driver in CyanogenMod (and pershoot kernel, I think) for Nexus One.

It allows the current value to be updated every 2.5 seconds (instead of 30-50 seconds now).

Please follow updates at Android Market (link) or at my blog (link).
[Nexus One Android Development] pr0xZen:
I wasn't sure how to proceed regarding this app/widget, as this is years old and support might be non-exsistant now.

I can't get this to work for my phone (Jiayu G3), but looking at the CurrentReaderFactory java, it seems the Zopo 900 gets the value from /sys/class/power_supply/battery/BatteryAverageCurrent - I checked and the file is there in the Jiayu G3 too, values updated every whole minute it seems. It might be down to both being MTK6577 SoC sets. Might be they're all the same..

I wasn't really sure how to proceed, so I baksmali'd the classes.dex, and edited the only instant my search would find for "zp900", wich was in classes/com/manor/currentwidget/libary/CurrentReaderFactory.smali . In line 143 i changed tha value from "zp900" to "jy-g3" (JY-G3 is model tag), packed up the classes.dex again with "java -Xmx512M -jar smali.jar classes -o classes.dex" and replaced it in the .apk.

However, the .apk fails installation ("App not installed"). I re-did it twice to make sure I didn't forget something.

Any pointers?

EDIT: I see now that the old classes.dex is 1 482 556 bytes, the new one is 527 884 bytes. Can't for the life of me figure out whats missing :/
[Nexus One Android Development] rm9:
Hi, support still exists. :)

E-mail me to rmdroider@gmail.com and I will send you a test version to try out.

If it works then I'll release it to the play store.

Thanks.

btw, CurrentWidget is open source so no need to work hard to get the code, just go to https://code.google.com/p/currentwidget/ .
[Nexus One Android Development] pr0xZen:
Thanks alot rm9 :) It works better than I dared hope for - superb for my need :)
[Nexus One Android Development] rm9:
Great, it will be in the play store shortly.
[Nexus One Android Development] clustered:
Thanks! ;)
[Nexus One Android Development] krucifix85:
Hi I have a PiPo M6 that I'm having battery issues with, and the widget doesn't work.

I looked in /sys/class/power_supply and there are 2 files: 'ac' and 'battery'. However they are completely empty files.

Is there anywhere else I may look for it, or is it more likely my tablet just doesn't report the amperage?
[Nexus One Android Development] rm9:
battery is actually a folder and not a file.

Try to use Astro file manager to view it.
[Nexus One Android Development] krucifix85:
Oh thank you. I was using Root Explorer - fail.

ASTRO won't bring up my local storage, it says it can't find any local storage locations - weird.

ES has worked, and I'm in the shortcut now.

Nothing for Current in there, just a whole heap of min/max/present Voltage files.

Ah well, no luck for me I'll take my search elsewhere. Thanks.
[Nexus One Android Development] rm9:
First, thanks to pgwipeout for the idea.

Updated (12/10/10) the application:

Samsung Vibrant support (charge current only)

xdandroid support

View log button

Optional operation on value

Updated look

If the widget isn't working after update, try removing it from the home screen and adding it again.

Design thanks to Orel Bob.

The widget is on the market.

market link

Code:

http://code.google.com/p/currentwidget/

Screenshot:
[Nexus One Android Development] pzumk:
There's only 1 thing I actually HATE on this community:

You never post screenshots

WHHHYY?! It isn't that hard :(
[Nexus One Android Development] stealth658:
Understand your point, but rather than whine about it, I decided to be proactive:
[Nexus One Android Development] pzumk:
Thank you! Now I know what this thread is about :P Didn't understand it before. Thanks
[Nexus One Android Development] rm9:
never say never. :)
[Nexus One Android Development] B1ny:
I am running it now.

Thanks :)
[Nexus One Android Development] B1ny:
It doesn't seem to update.....
[Nexus One Android Development] nicandris:
well refresh rate of 5 minutes is a bit toooo much! well let's wait for the new version
[Nexus One Android Development] B1ny:
I have added another widget, and see that they actually do refresh. Since they seem to do at different times. Now one say 5 and the other 275mA. The first one must have locked on the same mA each time I looked at it :)
[Nexus One Android Development] B1ny:
It seems to stop updating after a while, maybe one hour or so.
[Nexus One Android Development] pgwipeout:
Brilliant, one minute refresh and a little prettier and it will be perfect, are you parsing current_now or dmesg?
[Nexus One Android Development] rm9:
Working on it. :)

I'm planning on publishing the source after the next version, so if anyone will have more ideas he can continue from there.

I'm using current_now.
[Nexus One Android Development] RogerPodacter:
i LOVE the idea of this widget. anyway i installed this yesterday, and it never updates, not even every 5 minutes. it just stays at the first value since yesterday. i'll try re-downloading it if i'm using an older version.
[Nexus One Android Development] rm9:
I saw it happening on my device as well.

Will fix towards the weekend.

And thanks to pgwipeout for the idea...
[Nexus One Android Development] britoso:
Could you post the math you used to get the mA value, thanks. Otherwise I will wait for the src :)
[Nexus One Android Development] rm9:
The value in current_now is in micro amperes so I just divided by a 1000.

I wouldn't call it math. :)
[Nexus One Android Development] britoso:
I asked because I get strange values. ( cat sys/class/power_supply/battery/current_now )

For example:

Idle, charging via USB: 239257

Starting up a game: 204082

Playing a game (85+% CPU): 88038

Any idea why the power draw is decreasing instead of increasing? (I'm pretty sure I've also seen a negative number)

Maybe its the amount of power being used for charging, not the power draw.
[Nexus One Android Development] pgwipeout:
current_now shows the current going in or out of the battery, if it is plugged in, current_now will show a positive value as long as your phone isnt pulling more power then your power supply can provide. When it isn't plugged in it will show a negative number because the phone is pulling power from the battery.
[Nexus One Android Development] B1ny:
When its stable and you can set a faster update interval, it will be very handy to check if its charging or decharging, under heavy use while connected in the car.
[Nexus One Android Development] B1ny:
Can you fix so that it's possible to see the numbers when they are green(charging), and you are using the red render effect?

Maybe let the user change colours and add +/- signs?
[Nexus One Android Development] RogerPodacter:
I can't wait for this to be working cause I want to do some tests regarding the screen power draw in various conditions, such as browsing web pages with white colors vs using an app like The xda app with all black background. Some times I don't feel like I'm seeing the power draw savings of using an all black screen. Theoretically all black should drop the screen power draw significantly.
[Nexus One Android Development] RogerPodacter:
ok i have an update. the widget IS actually working, it just needed a reboot. since i only reboot once a week, i hadnt noticed. so now that its working, i have a couple minor suggestions.

1. could a timestamp be added to the widget that shows the time the last reading was given? i want to do tests, but when i see the number, i only know it happened some time in the past 5 minutes. i'd like to be able to see exactly what i was doing at the time the reading was taken, i.e. was i web browsing? was the screen on or off? black or white screen? etc.

2. if possible, could we be able to set the interval, maybe a mini settings menu? set it for say 30 sec, 1 min, 5 min intervals or somthing like that.

i'd like to be able to use it for testing. i guess i can always use OS monitor dmesg log filtered for BATT, but that might not give enough fine tuning control to be useful.

is there anyway to do that with a logcat?
[Nexus One Android Development] rm9:
Hi,

I fixed the bug and I'm working on the configuration.

Hopefully I'll finish on the weekend.

Timestamp is a good idea.
[Nexus One Android Development] leonnib4:
Could this fantiastic thing be in the status bar?

I'll like to try a few things and have it more often updated within the status bar
[Nexus One Android Development] RogerPodacter:
i just wanted to post some results so far with using this app.

when i'm at home, connected to wifi with average signal, and my phone goes to sleep all night, the typical readings i get are 6mA, 8mA, and they hover around those values. this is with the phone idle in sleep mode.

when i come to work, where there is no wifi so i have it switched off, but using 3G data, and i have a weak signal around 1-2 bars, my readings hover around 12mA, 14mA. this is with the phone idle in sleep mode.

when i take my break outside, with full signal, and i use the phone for web browsing, the readings jump up quite a bit. most of the time i see 200mA, 150mA. the highest i've seen, just now, was 747mA while i was loading a web page with the browser, all white background. that's extremely high.
[Nexus One Android Development] leonnib4:
I'm also seeing 650mA when using 3G network and surfing or playing
[Nexus One Android Development] rm9:
Hi everyone,

I updated the application.

Still no configuration (although it's showing) but I wanted to make sure I fixed the updating bug. Seems fine on my device, please let me know.

Besides that, new icons (thanks to Orel Bob) and refresh interval is one minute.
[Nexus One Android Development] B1ny:
Seems to work fine on mine as well, thanks :)
[Nexus One Android Development] B1ny:
Thanks for making the colour changes that makes it possible to read while in red render setting :)

As mentioned earlier, having this in the status bar would be awesome.

Ran a test now, facebook mobile in no render: 147mA, red render 127mA.
[Nexus One Android Development] rm9:
Updated again.

Configuration is working now and added last update time.

I think that "current_now" isn't updated fast enough.

Maybe I'll look for another source.
[Nexus One Android Development] B1ny:
Great improvements :)
[Nexus One Android Development] rm9:
thanks.

Next week I'll upload it to the market and put the source at google code.
[Nexus One Android Development] nicandris:
hmmm can you ask the OP or a MOD to place the app in the first post? we have to search for it every time in the older post
[Nexus One Android Development] RogerPodacter:
Why would current_now not be fast enough? The widget reading seems dead on when compared to the dmesg log in OS monitor every time:-)

Anyway nice work and thanks for this. Can I give a donation somehow?
[Nexus One Android Development] RogerPodacter:
I see what "not fast enough" means. I just changed the setting to every 5 seconds but it seems like the actual current reading doesn't keep up, it only changes about every 30 seconds. I'll try a reboot to be sure.
[Nexus One Android Development] rm9:
Maybe current_now isn't updated every time.

I'll try to find some information about it.

Maybe I'll try reading from dmesg, see if it works better.

Thanks, I really didn't expect donations. :)

I have a previous paypal link I made for some other program I wrote..

you can find the link at http://gsn.kipmi.com
[Nexus One Android Development] rm9:
Yes, exactly.

I thought it was my bug but I read current_now manually and sometimes it's really not updating.

I'll try to find more information about it.
[Nexus One Android Development] andycted:
Hi ! Coming from winmo, I've been looking for this for a looooong time, also tried to see if it could be done, asked around, etc. I then found the setting:

/sys/class/power_supply/battery/current_now

and landed on this page when searching. Now I also realized that there is something wrong with it, it doesn't update so often as you would like it, but if I remember correctly BatLog in WinMo experienced the same lag.

However looking on modaco in the desire section, I've found a guy that found:

batt_attr_text

inside the same directory. It might be something from HTC Sense and I can't see it on my Desire now, because I have an AOSP rom.

It could just be a textual rappresentation of those other values though

Edit: thank you, thank you, thank you, thank you. It works perfectly, just like the winmo counterpart, it shows values from about 40 seconds before, but that can sometimes be even useful, for example on screen off. I'm doing 1000s of tests, but on a desire, don't have a nexus one.

You can find the results over here http://xdaforums.com/showpost.php?p=7566751&postcount=54 and probably in later posts
[Nexus One Android Development] dvgrhl:
I decided to write this widget on my own for fun, and that's what I noticed with the current_now update interval as well. It doesn't seem consistent, as some times it updates quicker than others. But 30 seconds seems about the longest it ever takes to update.

So I don't think it is possible to have "real-time" power draw using this method. But updating every 30s isn't really that bad in my opinion. If you find another method, I'd be interested to hear.
[Nexus One Android Development] andycted:
Hardware should be similar to WinMo devices probabl, so it's probably going to work similarly. No problems it's excellent this way, maybe the only problem is that sometimes it skips brief (less than 5 seconds) alterations.
[Nexus One Android Development] leonnib4:
Is it not possible on Android to get a trigger on an opened file?

To get its value everytime its updated?

Too bad if it doesn't.
[Nexus One Android Development] dvgrhl:
I'm not sure on that. One weird thing is that the modified time of the file isn't updating even though the contents of it are. Check out this output run at :

bash-3.2# date
Sun Aug 8 16:51:27 PDT 2010
bash-3.2# stat current_now
File: "current_now"
Size: 4096 Blocks: 0 IO Block: 4096 regular file
Device: 0h/0d Inode: 3856 Links: 1
Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2010-08-08 16:27:06.000000000
Modify: 2010-08-08 16:27:06.000000000
Change: 2010-08-08 16:27:06.000000000

Also, on better testing using the output of "date", I realize that current_now seems to only be updating every 60s. I think I just wasn't paying that close of attention before to the intervals, and when it seemed to happen quickly it was really just because I checked right before and right after a 60s interval.
[Nexus One Android Development] pgwipeout:
It would appear current_now updates from dmesg, and it wouldn't make sense for the file to update every second, as that would pull a lot of extra cpu cycles, a 30 second to one minute update time is good for both accuracy and battery life.
[Nexus One Android Development] pgwipeout:
Done. I have added links to the file and rm9's original post.
[Nexus One Android Development] jak3z:
I've modified the APK and changed the file to read to batt_current, and since my value is already divided into 1000 I changed the line that makes the division to make it by 1. I didn't understand a single thing of the code so I did my best.

My HTC Desire doesn't have current_now, but does have batt_current and the value it's already in mA. Just had to edit the file and remove the division.

Hope the autor doesn't care :)
[Nexus One Android Development] rm9:
Hey,

Does it work better with batt_current ?
[Nexus One Android Development] jak3z:
It does work for me.

I had to change the line of the file to batt_current and then where you make the division / 1000 I change to 1.

I have no idea of java but I know some php, sql and .net So after some intuitive names and some hexadecimal values conversion I found the line hehe.

The value of batt_current looks to be already in mA.
[Nexus One Android Development] pgwipeout:
What phone are you using, I do not have batt_current on my file system.
[Nexus One Android Development] jak3z:
Forgot to mention sorry, Desire with stock 2.2 rom.
[Nexus One Android Development] pgwipeout:
Haha yeah that wont work with the vanilla roms, sorry.
[Nexus One Android Development] mtw4991:
Cool app guys..just an observation I've seen: When I monitor batt in OS Monitor, it updates itself every 65 seconds on CM6 latest nightly/kernel. Before when I was using an AVS kernel on RC1, the update time was 54 seconds. Don't know if the ROM or ROM/Kernel combination makes a difference on when it updates itself???
[Nexus One Android Development] TheShoura:
an option to add charging rate would also be quite cool

IE: plug in and it shows how much phone is consuming + how much is being charged from plug

Subbed to thread, im gonna test it out (Kang o rama ROM user)
[Nexus One Android Development] pgwipeout:
I'll continue to peek through the OS for a way to add that in.
[Nexus One Android Development] pgwipeout:
I just noticed mine updates every 50 seconds on CM 6.0 - RC2 with the default kernel.
[Nexus One Android Development] dvgrhl:
Also, if you cat /sys/class/power_supply/usb/online you get an int for if the usb is providing power or not. If you cat /sys/class/power_supply/ac/online you get an int for if the usb is being powered by the ac charger or not. So from those two values you can determine what the input power source is (if any).

Since the inputs are constants (480mA for usb, and 980mA for ac), can't we just subtract from that the value of /sys/class/power_supply/battery/current_now to get what the phone power usage is?
[Nexus One Android Development] pgwipeout:
Under most circumstances yes, but I have a power supply capable of providing 1.5 amps to the phone, if the widget doesn't take that into account it would give some seriously wacked out usage readings.
[Nexus One Android Development] dvgrhl:
Ah, yeah I didn't even think of those cases. I'll keep digging around - there has to be a way to tell how much power is coming in.
[Nexus One Android Development] Evans_Prophet:
Hi! I have tried this widget on my Galaxy S 9000. It gives an "open error" instead of a reading. Does it work only for froyo? I have 2.1).

Thank you!
[Nexus One Android Development] rori~:
CurrentWidget (v0.12) smoked

..smoked it, fits better to my theme :)
[Nexus One Android Development] spiicytuna:
I got the same thing on my evo running cm6.

Edit: I figured out why. In froyo its: cat sys/class/power_supply/battery/batt_current NOT cat sys/class/power_supply/battery/current_now

Is it possible to have the user select 2.2 vs. 2.1 in the widget, or have it determine this automatically?
[Nexus One Android Development] pgwipeout:
I am running CM6 on the Nexus One and it is current_now. Most likely it is based on the phone which file is used.
[Nexus One Android Development] rm9:
It's not froyo , but on some devices .

I will add a fix soon .
[Nexus One Android Development] spiicytuna:
Ok. My mistake. I am on the EVO 4G. Thanks for the clarification :D

That would be great! Thanks! :-D I'll keep checking back....
[Nexus One Android Development] nicandris:
well share it :P