yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] bohlool:
suggestion

OnClick refresh the widget instead of opening setting. Let do setting with application icon.
[Nexus One Android Development] Evans_Prophet:
That would be awesome! (possibly make it a widget option). I will provide you with feedback on Galaxy S.

Can't wait! :-)
[Nexus One Android Development] rori~:
CurrentWidget smoked

sorry :)..of course.

CurrentWidget smoked
[Nexus One Android Development] rm9:
very nice. :)
[Nexus One Android Development] rm9:
ok, I updated the file.

Try it & let me know.

Thanks. :)
[Nexus One Android Development] rori~:
Thanx..but it would be better, if you use a 9.png for the widget!

Let me know, if you need one ;)
[Nexus One Android Development] rm9:
What do you mean by 9.png ?
[Nexus One Android Development] rori~:
http://developer.android.com/guide/practices/ui_guidelines/widget_design.html

A strechable file to quarantee

your layout

.
[Nexus One Android Development] Evans_Prophet:
Thank you very much! I tried but still doesn't work. Looks like that the Galaxy's structure is different - I could not find a file displaying the current usage.

I have opened a thread on the matter- http://xdaforums.com/showthread.php?p=7633046#post7633046.

Thank you very much again!
[Nexus One Android Development] MasterBunnyFu:
Is there an option to display a graph-over-time history of power draw?
[Nexus One Android Development] rm9:
not yet.

If anyone wants to contribute:

http://code.google.com/p/currentwidget/
[Nexus One Android Development] rm9:
my mistake
[Nexus One Android Development] ellesshoo:
What does "smoked" mean? I've seen the term used around here but don't know what it means or whatever implications it has.
[Nexus One Android Development] rm9:
It seems that every device has a different file for the current usage.

If anyone here has access to other devices (Sony Ericsson, Droid, etc..) , I would appreciate the help in adding support for those device.

Thanks. :)
[Nexus One Android Development] KyesaRRi:
IIRC smoked means a semi transparent flat background. In the themes section there is a thread with morphs for the stock widgets to have the smoked background.
[Nexus One Android Development] mars_volta:
My Droid Eris is /sys/class/power_supply/battery/batt_current.

During USB charging it says 418 and 0, 1 or 2 otherwise if I open it with a text editor.
[Nexus One Android Development] rm9:
the widget supports batt_current, so it should work.

Does it?
[Nexus One Android Development] mars_volta:
It always displays 0 mA. The time stamp works.

When I viewed the file with ac connected it said 743.
[Nexus One Android Development] rm9:
When did you last try it?

I fixed a bug regarding batt_current a few days ago.

Thanks.
[Nexus One Android Development] mars_volta:
Ok it works a bit. It seems correct during charging but it never goes negative off charge. It displays 1 mA.
[Nexus One Android Development] rm9:
The widget should be green while charging and white while discharging.
[Nexus One Android Development] mars_volta:
It always green.
[Nexus One Android Development] rm9:
Well, it seems that batt_current works this way on the Droid Eris.

Weird.

Maybe you have another file at that directory that shows the current?

I really don't understand why every manufacturer needs to mess with the OS. :)
[Nexus One Android Development] mars_volta:
I found a file in that dir called smem_text that contains everything battery related. In there is batt_discharge_current. Looks accurate.

batt_id: 1

batt_vol: 3840

batt_vol_last: 0

batt_temp: 1072

batt_current: 1

batt_current_last: 0

batt_discharge_current: 112

VREF_2: 0

VREF: 1243

ADC4096_VREF: 4073

Rtemp: 70

Temp: 324

Temp_last: 0

pd_M: 20

MBAT_pd: 3860

I_MBAT: -114

pd_temp: 0

percent_last: 57

percent_update: 58

dis_percent: 64

vbus: 0

usbid: 1

charging_source: 0

MBAT_IN: 1

full_bat: 1300000

eval_current: 115

eval_current_last: 0

charging_enabled: 0

timeout: 30

fullcharge: 0

level: 58

delta: 1

chg_time: 0

level_change: 0

sleep_timer_count: 11

OT_led_on: 0

overloading_charge: 0

a2m_cable_type: 0

over_vchg: 0
[Nexus One Android Development] kmetek:
i have 81ma......what this means? :D
[Nexus One Android Development] rm9:
Thanks for the info.

I'll add it to the widget and post here.
[Nexus One Android Development] mars_volta:
Here is a charging snapshot..

batt_id: 1

batt_vol: 3833

batt_vol_last: 0

batt_temp: 999

batt_current: 417

batt_current_last: 0

batt_discharge_current: 479

VREF_2: 0

VREF: 1243

ADC4096_VREF: 4073

Rtemp: 62

Temp: 350

Temp_last: 0

pd_M: 88

MBAT_pd: 3921

I_MBAT: -76

pd_temp: 0

percent_last: 68

percent_update: 51

dis_percent: 64

vbus: 1

usbid: 1

charging_source: 1

MBAT_IN: 1

full_bat: 1300000

eval_current: 493

eval_current_last: 0

charging_enabled: 1

timeout: 30

fullcharge: 0

level: 51

delta: 1

chg_time: 0

level_change: 0

sleep_timer_count: 11

OT_led_on: 0

overloading_charge: 0

a2m_cable_type: 1

over_vchg: 0
[Nexus One Android Development] mars_volta:
looks like I_BMAT might be it.
[Nexus One Android Development] rm9:
I thought it was batt_discharge_current and charging_enabled indicates whether it's charging or not.
[Nexus One Android Development] bemymonkey:
It means that if you move the phone at 81km/s, the universe will implode.

Why are you installing a current measurement widget if you don't know what current means? :p
[Nexus One Android Development] mars_volta:
I think i_mbat is the calculated current taking charging and draw into account. It shows - while discharging.
[Nexus One Android Development] rm9:
ok, I will use that for starts.

Does it shows 0 when the battery is fully charged?
[Nexus One Android Development] mars_volta:
Not sure.
[Nexus One Android Development] rm9:
If you get the change please check it.

In the meantime I'll update the widget and we'll see if the readings seem correct.

Thanks.
[Nexus One Android Development] andycted:
Thank you again for the excellent widget. Can I ask if it would be hard to have a switch (when adding the widget) that optionally writes every single reading+time (like every minute) to a default text file (like /sdcard/battery.log) ?

Thank you
[Nexus One Android Development] uoY_redruM:
Does OP have updated widget?

I've been following this thread for a while now, using the original widget. Haven't posted in here until now though lol.
[Nexus One Android Development] RogerPodacter:
since its kinda related, does anyone know how to actually open and see the information contained in our batterystats.bin file? i'm trying to wipe my stats and do some testing, and i''m curious about all battery info i can find, and what is contained in that file specifically. how do you open it?
[Nexus One Android Development] rm9:
I'll add it to my todo list. :)
[Nexus One Android Development] andycted:
Thanks, that is very nice.
[Nexus One Android Development] mars_volta:
Yes, nice work! :)
[Nexus One Android Development] ellesshoo:
Ill second the idea of an excel (csv?) Compatible log file. I know it's asking a lot but maybe even a built-in plot of power draw over time like battery graph. But a log file would be a good start.
[Nexus One Android Development] bemymonkey:
A log file would be fantastic! The widget alone is already a feature I've been missing from Android for ages... thanks for the hard work :)
[Nexus One Android Development] pgwipeout:
Indeed, I use the first time stamped version, I see no reason to update yet as all of the updates were for increasing support on different phones, but I do keep track of the thread and I believe I promised five bucks for the person who developed this.
[Nexus One Android Development] TDO:
Somebody wanted to knopw the structure for the Galaxy S.

I have a rooted Galaxy, but with root explorer I can only move to /sys/class/power_supply/. There I see a entry "battery" but I can't enter the direcory.

Does anybody know how I can provide the asked information?
[Nexus One Android Development] rm9:
Maybe it's a file?

Try viewing it.
[Nexus One Android Development] TDO:
Seems you are right.

Size: 0 and no data
[Nexus One Android Development] rm9:
guess Samsung didn't want to give battery information...
[Nexus One Android Development] TDO:
No it's the root explorer.

It's a link and it can not follow it.

In the shell it's no problem.

But still no current ...

uevent

subsystem

device

power

type

status

health

present

technology

capacity

batt_vol

batt_vol_adc

batt_vol_adc_cal

batt_temp

batt_temp_adc

batt_temp_adc_cal

batt_vol_adc_aver

batt_test_mode

batt_vol_aver

batt_temp_aver

batt_temp_adc_aver

batt_v_f_adc

charging_source
[Nexus One Android Development] ellesshoo:
I installed the original version of the widget. Yesterday, I uninstalled it and installed the one from the market. Will updates be put on the market? I thought it would be easier than checking this thread for updates.
[Nexus One Android Development] rm9:
Yes,updates will be on the market.
[Nexus One Android Development] uoY_redruM:
Yeah, this is what I did as well :)
[Nexus One Android Development] RogerPodacter:
I can use root explorer to copy all the battery files from sys/devices/platform/ds2784-battery and view the contents on the computer. But there's one file in there called driver which does not copy. Anyone know how I can grab this driver and see what's inside?
[Nexus One Android Development] rm9:
If I'm not mistaken, the driver "file" isn't really a file.

In linux you access devices thought the filesystem.
[Nexus One Android Development] RogerPodacter:
Well do you know where I can find the battery driver or files? I'm trying to find the part that tells the phone that 1361 mAh equates to 100% charge. And the algorithm that the phone uses to calculate battery percentage, and all that related info.
[Nexus One Android Development] bemymonkey:
Don't these phones just read the battery voltage and say 4.2V or so is 100%? The only way they can measure the capacity is by measuring and logging how much they've charged/discharged, which is also why the battery gauges need to be calibrated every now and then.
[Nexus One Android Development] RogerPodacter:
Right but the phone still has pre known info for the stock battery. Example if you use an extended battery, the percentage meter does not adjust for the increased capacity. It simply reads 100% for hours until the mAh drops to 1361 mAh where at that point it counts down like normal. Something tells the phone this info, and wiping battery stats doesn't change anything. I'm trying to find that info.
[Nexus One Android Development] bemymonkey:
Where are you getting this 1361mAh figure? Like I mentioned before, the phone can't actually measure battery capacity in mAh, unless there's been a breakthrough ;)
[Nexus One Android Development] RogerPodacter:
Sorry I'm kinda continuing a conversation from another battery thread. The dmesg log gives us battery readings in real time, along with mAh, voltage, current, percentage. If you export your dmesg logs and plot them it turns out the OS correlates the same percentage for pre known mAh values. 100% is always 1361 mAh and 99% is always 99%, etc on down the line. I did a bunch of exports this week and plotted them all together, mAh vs percentage, voltage vs mAh, voltage vs percentage, and a bunch of others.

Bump charging to get up to the full 1420 mAh and wiping your battery stats doesn't have any effect at all. So the next step was finding out which files deals with the battery algorithm. The ds2784 battery actually provides the phone with real time mAh, current, and voltage with a built in power resistor. Anyway that's what I was looking for.

Also I'm looking for the battery stats file if one exists. The batterystats.bin turns out does not contain anything but what we see in "battery use" section of our settings. Anyone have any insight?
[Nexus One Android Development] bemymonkey:
Nice find! What result did the voltage vs. mAh plot give? Is that plot always the same?
[Nexus One Android Development] RogerPodacter:
Alright I found the answer I was looking for which is why can't we get our batteries to fully charge up to 1400 mAh and not stop around 1361 mAh. First to answer your question, voltage vs mAh is not very useful, which makes sense. Voltage is really how strong the power can be delivered in a sense. As long as there is adequate voltage, current can be pulled or pushed from the battery. So that graph looked somewhat flat but sloped downward from 4.2 to 3.5 volts.

Anyway I found the battery code for the ds2784 over at AOSP and looked thru the entire thing. There is a condition written that says if charging, and not percentage is 100%, and current is less than 80 mA, to stop charging. This code is exactly our problem.

The battery has its own charging circuit, which is why we can charge with the phone off and not blow up our battery. This value of 80 mA needs to either be changed to zero, or a lower value. Here is the code:

static int battery_adjust_charge_state(struct ds2784_device_info *di)
361 {
362 unsigned long flags;
363 unsigned source;
364 int rc = 0;
365 int temp, volt;
366 u8 charge_mode;
367
368 spin_lock_irqsave(&charge_state_lock, flags);
369
370 temp = di->status.temp_C;
371 volt = di->status.voltage_uV / 1000;
372
373 source = di->status.charge_source;
374
375 /* initially our charge mode matches our source:
376 * NONE:OFF, USB:SLOW, AC:FAST
377 */
378 charge_mode = source;
379
380 /* shut off charger when full:
381 * - CHGTF flag is set
382 * - battery drawing less than 80mA
383 * - battery at 100% capacity
384 */
385 if ((di->status.status_reg & 0x80) &&
386 (di->status.current_uA <= 80000) &&
387 (di->status.percentage == 100)) {
388 di->status.battery_full = 1;
389 charge_mode = CHARGE_OFF;
390 } else {
391 /* We don't move from full to not-full until
392 * we drop below 99%, to avoid confusing the
393 * user while we're maintaining a full charge
394 * (slowly draining to 99 and charging back
395 * to 100)
396 */
397 if (di->status.percentage < 99)
398 di->status.battery_full = 0;
399 }

this line right here we have to change

(di->status.current_uA <= 80000) &&

and make it

(di->status.current_uA <= 10000) &&

or

(di->status.current_uA <= 20000) &&

hell we could even set it to zero, because the battery circuit stops the charging when the battery is truly full. this software is just artificially limiting the charge to stop when the battery pulls in less than 80 mA, which really is not necessary.
[Nexus One Android Development] bemymonkey:
Actually, I seem to have asked the question a little confusingly. I'm interested in whether the device correlates a certain charge level (in mAh) with a certain voltage, since the voltage is the only thing that's actually measured for use as a "battery gauge". If you did the test multiple times: Were there changes in the curve, or rather, the correlated values? i.e., are the 1361mAh always reached at the same voltage?

:)
[Nexus One Android Development] RogerPodacter:
oh yes, that info was absolutely confirmed. for example, the nexus one battery meter will always switch from 92% to 91% going from 1252 mAh to 1251 mAh. doesnt matter what kind of charge you do, whether you use an extended battery or not, nothing changes that. it ALWAYS switches at that point. i exported my battery log every hour for 8 hours straight, for 5 days in a row this past week:D. and then also exported the log when it charged up to full. the undeniable, undisputed data was that these numbers are the same, regardless of voltage.

here's just a quick graph to show it. look how linear this is, nothing like solid data with a definitive result. the first one is mAh vs percentage. the second is the same thing, with some chunks of day 2 data overtop of day 1 data. this is all i have with me, the rest of the files are at work on my computer. but they were the same.

EDIT: the voltage vs mAh i just added. not too interesting.

EDIT2: so yes, 1361 mAh always equals 100%. never changes in the slightest. even if voltage is very different from day to day.
[Nexus One Android Development] mars_volta:
A display in the notification area would be neat. :p
[Nexus One Android Development] rm9:
Will do, after log file. :)
[Nexus One Android Development] syntax1976:
Samsung Galaxy S (GT-I9000M)

So is there an update and/or any plans on Samsung Galaxy S devices and where to get the battery info?
[Nexus One Android Development] rm9:
I don't have the device so it's really up to the community here to dig around.
[Nexus One Android Development] nurre:
Wild idea for debugging battery problems when idle:

Snapshopt battery_avg (battery_now = battery_avg, battery_now is deprecated) every 60 seconds along with all processes running. Then kill everything.

It'd be easy enough to look at when the battery_avg goes up a lot between two points, what app has started up and started doing something in that period.

Yes it'd require an app, no I'm not suggesting it be added to the widget/app in progress. As it's a pretty extreme way of doing it. But it should be able to accuratly show exactly how much battery an exchange sync draws every hour for example.
[Nexus One Android Development] rm9:
new version

Uploaded new version to the market.

http://xdaforums.com/showpost.php?p=7446314&postcount=21
[Nexus One Android Development] bemymonkey:
Looks fantastic, and the new logging function is great! THANK YOU!
[Nexus One Android Development] RogerPodacter:
wow the new version is excellent! in addition to current_now, we also find in sys/devices/platform/ds2784_battery a bunch of other files such as: voltage_now, current_avg, capacity, on and on. really current is all that matters. but i was just throwing that out there!

i gotta donate here, keep forgetting.
[Nexus One Android Development] mars_volta:
Wow! Logging works great! Nice work!
[Nexus One Android Development] rm9:
The app writes every value separately.

I can say that on my device I get about 3-6mA during the night with log enabled.
[Nexus One Android Development] bemymonkey:
Thanks for that info. Maybe it really was bluetooth. I'll leave the log on again tonight and check it out tomorrow morning :)
[Nexus One Android Development] andycted:
Thank you, the logging works excellently. A few suggestions if you don't mind...

-An option to either attach to log, or create a new one

-an option, or default, to write the values logged while sleeping, only when the screen turns on. This way you can be sure it won't modify the values

-clicking a small part of the widget could open the log, or show it in real time

Just a few ideas, it's good already as it is ...
[Nexus One Android Development] TDO:
I have found the information for the Galaxy S.

/sys/class/power_supply/battery/batt_chg_current

Sorry - it only works on the vibrant (the US modell of teh Galaxy S)
[Nexus One Android Development] rm9:
great.

can you send me the contents for example?

thanks.
[Nexus One Android Development] syntax1976:
Sweet! Good find... Thanks for poking around... I don't have my phone rooted yet.
[Nexus One Android Development] vishaljh:
Hi mate. Are you sure? I was unable to see this file on my rooted galaxy S.

I am using JM8 firmware.
[Nexus One Android Development] andycted:
Hey I forgot maybe the most interesting idea, if feasible: log visible (foreground) process as well !
[Nexus One Android Development] rm9:
To attach to log or create new one you can just change the log file name in the settings.

what do you mean to write the values only when screen turns on? do you mean to not write to the file while the screen is turned off?
[Nexus One Android Development] rm9:
sorry, didn't understand...
[Nexus One Android Development] andycted:
Yeah, the new log function was just to automate it. By attaching the date and time to the name you can have multiple log files to compare and to easily manage.

Regarding the process name, it's not my idea, there was a program in winmo that in order to better log what happened, it appended to every mA reading, the names of the programs that were used at the time, or rather that were active. Like right now it would log

TIME- BATTERY DRAIN-tapatalk, swype
[Nexus One Android Development] dextroz:
Thank you - thank you - thank you!

Please create a donate version in the market. I would also suggest creating a 'graphed' version. I have a Nokia E71 for which I will install the power widget, take a video and upload it to YouTube for you to check out. It is really quite impressive although I understand that Android might not provide 'live' reading of phone power draw.

As a suggestion, in app mode what would be cool is to list the 'apps' running/active when the last reading was taken and if we set this as a 'log' we should pretty much have an idea of what app is killing the battery and how much does, say Facebook consume over a day :-) But this would of course only be possible if we can have a live continuous power-feed information from the OS/phone.

God, I love your work and I need to send you a beer!
[Nexus One Android Development] mtw4991:
+100 for the log to append the name of the app that is pulling the current. Could conceiveably replace several apps on the market and would be worthy of purchase as many users can't or don't know how to properly utilize apps such as OS Monitor and System Panel. Simplicity sometimes is the best way!
[Nexus One Android Development] rm9:
Thank you very much. :)

I added the apps list option to the to-do list on the site.

I also added a paypal donate button on the app site..

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

I really didn't expect this, so thanks a lot. :)
[Nexus One Android Development] dextroz:
Hey Guys,

There is some exciting related work our friends are brainstorming in another thread:

http://xdaforums.com/showpost.php?p=7855153&postcount=395

From the looks of that post - it seems they have figured out a way to get 'live' power draw on the device by second. If you look at the log posted, the value for the current drawn is being updated each second.

Thought this might help you. Looking forward to seeing more breakthroughs and I will still go ahead and post the power draw app from Nokia as promised tonight.
[Nexus One Android Development] rm9:
Maybe I'm reading it wrong but according to the time stamp there's about a minute difference between each line.
[Nexus One Android Development] RogerPodacter:
Don't let those logs fool you. There's a glitch in our battery driver with the timestamp such that the further back in time you go, the time error grows larger. If you read that thread we talk about lots of the driver code. The driver outputs every 50 seconds, or slower depending on awake or sleep mode.

But there's some bug. I exported that particular log too many hours after the fact, so can't trust the timestamp. If I had exported tight away, it would be near accurate, and show 1 min apart readings.

Either that, or the driver logs differently over time that I just don't understand.
[Nexus One Android Development] ChronoReverse:
Updated and it's good. Thanks for the widget.
[Nexus One Android Development] ramosfet:
interesting

that's pretty clever stuff, just checked it out on the market and can't find it though.
[Nexus One Android Development] RogerPodacter:
This widget is great. I'm testing what draw the idle data connection has on the battery current, and its mind boggling me how much juice the inactive data connection bumps up current discharge. I always hear idle data uses no data and I never believed it. This is why I think android gets such bad battery life.

I'll post some logs, but its more than double the power drain, often times more. Stinks we can't keep data on but turn off until we use an app requiring data. Battery life would shoot up a ton.
[Nexus One Android Development] erikiksaz:
I find that the idle connection drain HUGELY depends on your signal strength. At school, I'm barely on HSPDA, sitting around -102-103dBa. At that strength my phone loses nearly 10% of its charge within an hour.

But, once I get back to an area with a stronger signal, the hourly drop returns to about 2-4%.