miska / HungerMeter

Hunger meter is so far really simple application to display current and average power consumption of SailfishOS device. It's purpose is to let you know whether changes you did to your device setup are going to help you get better battery life or not (for example which applications doesn't hurt keep running on background and which does).
GNU General Public License v3.0
3 stars 2 forks source link

Can't open app #7

Open Disasm opened 8 years ago

Disasm commented 8 years ago

OS version: 2.0.1.11 Hardware: Nexus 4

When I open the app, something appears on the screen for a moment and then app cover appears. Click on the app cover does the same thing. Looks like something bad happens. There is also no useful information on the app cover: Now (1 s): Avg (10 s): Avg (24 h): ----- mW

miska commented 8 years ago

Hi,

it definitely shouldn't be crashing, will try to figure out what and why. The only device I tested it on is original Jolla, so there might be some differences. Can you send me output of command

ls /sys/class/power_supply/*

Screenshot is fine.

Disasm commented 8 years ago

Here it is: /sys/class/power_supply/battery: capacity charge_now charge_type current_now device energy_full health power present status subsystem technology temp type uevent voltage_max_design voltage_min_design voltage_now

/sys/class/power_supply/pm8921-dc: device online power present subsystem type uevent

/sys/class/power_supply/touch: online power present subsystem type uevent

/sys/class/power_supply/usb: current_max device online power present scope subsystem type uevent

/sys/class/power_supply/wireless: device online power present subsystem type uevent

And here are contents of battery dir: ==> ./temp 280 ==> ./type Battery ==> ./current_now 253300 ==> ./charge_now 32740 ==> ./charge_type N/A ==> ./capacity 63 ==> ./voltage_max_design 4360000 ==> ./health Good ==> ./status Discharging ==> ./voltage_now 3896814 ==> ./uevent POWER_SUPPLY_NAME=battery POWER_SUPPLY_STATUS=Discharging POWER_SUPPLY_CHARGE_TYPE=N/A POWER_SUPPLY_HEALTH=Good POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_TECHNOLOGY=Li-ion POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4360000 POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000 POWER_SUPPLY_VOLTAGE_NOW=3887601 POWER_SUPPLY_CAPACITY=63 POWER_SUPPLY_CURRENT_NOW=268100 POWER_SUPPLY_TEMP=280 POWER_SUPPLY_ENERGY_FULL=2097000000 POWER_SUPPLY_CHARGE_NOW=32743 ==> ./technology Li-ion ==> ./voltage_min_design 3200000 ==> ./energy_full 2097000000 ==> ./present 1

miska commented 8 years ago

Thank you, that helps. But one value looks kinda weird. charge_now should be amount of energy left in your battery in uAh. Which in your case would be 32mAh which would mean that you have about 10 minutes of battery left. Which doesn't add up with 63% of battery. Any idea how to make sense out of those numbers? I could probably try to ignore charge_now in your case and compute energy left out of energy_full and capacity. Or I could assume, that somebody made a decimal error in your kernel and charge_now is actually in hundreds of uAh which would roughly make some reasonable numbers. Will try to prepare some patched version for you to try.

Disasm commented 8 years ago

I will try to figure out what charge_now does mean. During the charge it lowers down and becomes negative. When the charger is disconnected it slowly goes up.

miska commented 8 years ago

Hmmm, that is, how current_now should behave, charge_now should be slowly raising when charging and slowly decreasing when discharging. Weird.

Disasm commented 8 years ago

Looks like that charge_now indeed represents (dis)charge in uAh, but instead of absolute value we have randomly biased value. I have found that this value resets to zero after deep sleep, but preserves between reboots. Anyway, this value is terribly unreliable on my phone and should be ignored.

miska commented 8 years ago

Can you try this? https://michal.hrusecky.net/tmp/harbour-hungermeter-4.0.1-1.armv7hl.rpm

Disasm commented 8 years ago

Thank you. Now it doesn't crash. However on Battery Info page it shows that current capacity is 0 mWh and 0.00%. Also, field "Full" contains value "2099 00", which seems to be a truncated version of "2099 000 000 mWh", but the value of 2099000000 corresponds to the 2100mAh stock battery capacity.

miska commented 8 years ago

Hmmm, didn't realized that even energy_full is wrong. It's units are supposed to be uAh, but your value seems thousand times more. Is it possible you have some really weird kernel?

Can you try this?

https://michal.hrusecky.net/tmp/harbour-hungermeter-4.0.1-2.armv7hl.rpm

Should help with at least Full, although rewritten Current a little bit as well. And added some more debug output if you run it from console. That could help to figure out why current doesn't work if it would be still broken.

Disasm commented 8 years ago

Now "Current" and percentage values are non-zero. Thank you! This kernel is really strange. I will try to file a bug to the hardware adaptation bugzilla.