Issue #2125


Report battery % / charging

Added by Denis 'GNUtoo' Carikli almost 4 years ago. Updated almost 3 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Galaxy S 3 (I9300), Unknown
Type of work:
C programming
Actions #1

Updated by Victor Shilin over 3 years ago

The battery driver needs to use VF SOC register in order to report the charge percentage correctly (the following patch by Wolfgang Wiedmeyer made this work on Replicant 11:
The charger driver reports "Discharging" (in the status sysfs node) even when the cable is connected (the "online" sysfs node, however, is showing the value "1").
I tried to force the "status" node to return "Charging" instead (whenever the "online" node reports value "1"), but this didn't help (need to investigate how exactly the healthd service detects charging).

Actions #2

Updated by Kurtis Hanna over 3 years ago

Not sure if this helps at all, but here is a max17047 related commit from upstream that was added a few months ago.

Actions #3

Updated by _I3^ RELATIVISM over 3 years ago

  • Type of work C programming added
Actions #4

Updated by Victor Shilin over 3 years ago

healthd service detected device charging after setting the charger driver type from POWER_SUPPLY_TYPE_BATTERY to POWER_SUPPLY_TYPE_MAINS:

Not sure if this the correct way to resolve the issue, though.
smdk4412 kernel instead use "samsung_fake_battery" driver to create "usb" and "ac" power supplies:

Actions #5

Updated by Kurtis Hanna almost 3 years ago

It looks like postmarketOS has recently been trying to solve this issue, but have run up against some issues:

Actions #6

Updated by Kurtis Hanna almost 3 years ago

This patch, which is a v2 of an old Wolfgang patch, was just submitted upstream which claims to cause the i9300 to provide an accurate State of Charge value at all times.

Actions #7

Updated by Henrik Grimler almost 3 years ago

For the record: the v2 of Wolfgangs patch is needed since RepSOC does not return anything reasonable for i9300/i9305, since it does not have a current sense resistor. We also need the POWER_SUPPLY_TYPE_BATTERY->POWER_SUPPLY_TYPE_MAINS patch mentioned above for the UI to show something reasonable (otherwise the device think there are two power sources it seems). Together with some other Replicant patches [1] the battery can be charged and % reported correctly (but there are some quirks that stills needs to be worked out, data transfer to the phone does not seem to be possible while it is charging for example).



Also available in: Atom PDF