Battery Log and Amazfit do not work on SFOS 4

Are you sure it did work before the reset?

I’ts quite possible some parts of that app will not work depending on device.

1 Like

Hello, yes it works before. I will now try to switch off the phon with charging and so I will charge it with the original sony firmware. Maybe it is a Battery reset and the hardware need one charge zycle to gif the mAh.

its not work :frowning: I disabled also sandboxing and also without effort

via terminal follow result:



I will test it also on my old X10

on X10 it works ??? I have no clou. I will wait one day :frowning:

It’s probable the paths where the values are read from differ between devices. Some may not exist at all.

Can you do a

ls -lR /sys/class/power_supply/

and post the output?

Also, which version are you using?

2 Likes

You can see which files are read at the start of this file:

https://gitlab.com/nephros/harbour-batterylog/-/blob/no-statefs/src/batteryinfo.cpp?ref_type=heads

If any of those do not exist on the X10ii, the corresponding values can not be processed.

Hm. Maybe it’s that easy?

Can you please test (on both phones) the new build at:

https://build.sailfishos.org/package/show/home:nephros:devel:forks/harbour-batterylog

It’s possible some X10 functionality broke now.

1 Like

Hello nephros, yesterday I had a party and so I can answer only today. You are the best :). The new version brings two variable back on my X10III but on X10 the new version had now a -mA variable in charge moden and + in discharge. The biggest problem on both is, that the SoC varialble is missing. On X10III is this 0% and on X10 NaN%. Therfore the rest time cannot be calculated.
X10III X10

I was also with a file manager in /sys/class/power_supply and saw that all folders are linked on both phones to a other place. On X10 I have no patchmanager and so it could not be from a patch. But If I open the folder BMS I could see, that the used filenames are complete diferent between X10 and X10III and I think also between X10II. Maybe the hard reset changes the filenames from a fresh flashed phone. The Phon was Android 11 and never used before (fresh out of the box).

The SoC file on X10 is called “soc_reporting_ready” (file contains “1”) numeand on X10III I have 3 files “soc_reporting_ready” (file contains “1”), battery_raw_soc" (file contains “9417”) and “cc_soc” (file contains "9253).
No I will understand the file batteryinfo.cpp fom Batterylog and maybe I find a reason. Thanks for you quick task / new version and knowledege.

I was wrong the folder /sys/class/power_supply/battery/ is the reight folder. But the same game. The folder do not have the same name there either.
here the file lists:
X10

[defaultuser@Xperia10-DualSIM ~]$ ls /sys/c
lass/power_supply/battery
capacity
charge_control_limit
charge_control_limit_max
charge_counter
charge_done
charge_type
charger_temp
charger_temp_max
constant_charge_current_max
current_now
current_qnovo
device
die_health
dp_dm
health
input_current_limited
input_suspend
parallel_disable

X10III

[defaultuser@Xperia10III ~]$ ls /sys/class/power_supply/battery
aicl_done
aux_temp
bootup_shutdown_phase
capacity
charge_control_limit
charge_control_limit_max
charge_counter
charge_done
charge_full
charge_full_design
charge_term_current
charge_type
charger_temp
charger_temp_max
charging_enabled
constant_charge_current
constant_charge_current_max
current_now
cycle_count
device
die_health
dp_dm
enable_shutdown_at_low_battery
fcc_mah
fcc_stepper_enable
force_recharge
health
input_current_limited
input_suspend
jeita_condition
jeita_step_fcc
jeita_step_fv
lrc_enable
parallel_disable
power
present
profile_fv_rb_en
recharge_soc
rerun_aicl
reset_miscta
set_ship_mode
smart_charging_status
status
step_charging_enabled
subsystem
sw_jeita_enabled
system_temp_level
technology
temp
time_to_full_now
type
uevent
voltage_max
voltage_now
wakeup54

Maybe its neccesary to pick up the variables from different folders on both devices. But I found not the real file under /usr/share/harbour-batterylog/ what I can change for the test. I think its in the compiled file /usr/bin/harbour-battery-low and I cannot change it. The qml used for SoC batteryInfo.chargeFull and batteryInfo.chargeFullDesign. Both files exist on X10III.

extract from MainPage.qml:
image

here are the answer at the question from yesterday:

[defaultuser@Xperia10III ~]$ ls -lR /sys/class/power_
supply/
/sys/class/power_supply/:
total 0
lrwxrwxrwx    1 root     root             0 Jun 15 09
:56 battery -> ../../devices/platform/soc/c440000.qco
m,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b
@2:qcom,qpnp-smb5/power_supply/battery
lrwxrwxrwx    1 root     root             0 Jun 15 10
:44 battery_ext -> ../../devices/platform/soc/c440000
.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7
250b@2:qcom,qpnp-smb5/power_supply/battery_ext
lrwxrwxrwx    1 root     root             0 Jun 15 09
:56 bms -> ../../devices/platform/soc/c440000.qcom,sp
mi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:q
pnp,qg/power_supply/bms
lrwxrwxrwx    1 root     root             0 Jun 15 09
:57 dc -> ../../devices/platform/soc/c440000.qcom,spm
i/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qc
om,qpnp-smb5/power_supply/dc
lrwxrwxrwx    1 root     root             0 Jun 15 10
:44 main -> ../../devices/platform/soc/c440000.qcom,s
pmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:
qcom,qpnp-smb5/power_supply/main
lrwxrwxrwx    1 root     root             0 Jun 15 09
:57 pc_port -> ../../devices/platform/soc/c440000.qco
m,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b
@2:qcom,qpnp-smb5/power_supply/pc_port
lrwxrwxrwx    1 root     root             0 Jun 15 09
:56 usb -> ../../devices/platform/soc/c440000.qcom,sp
mi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:q
com,qpnp-smb5/power_supply/usb

I think the file "charge_full"makes the problem:
This is every time 0 under battery and bms. Maybe this constand is not usable. Maybe its possible to create it wich capacity and charge_full_design?
Also the file “charge_now_raw” not exist under bms.

hera are the files from a X10III SFOS 5.0.0.67 in discharge mode:

/sys/class/power_supply/battery/capacity=89
/sys/class/power_supply/battery/current_now-344543
/sys/class/power_supply/battery/voltage_now=4253791
/sys/class/power_supply/battery/charge_counter=3893940
/sys/class/power_supply/battery/charge_full=0 here could be the problem!!!
/sys/class/power_supply/battery/charge_full_design=4529000
/sys/class/power_supply/battery/time_to_full_now=-1

/sys/class/power_supply/bms/charge_now_raw	file not exist
/sys/class/power_supply/bms/charge_full=0 here could be the problem!!!
/sys/class/power_supply/bms/charge_full_design=4529000
/sys/class/power_supply/bms/time_to_empty_avg=0
/sys/class/power_supply/bms/time_to_full_avg=-1
/sys/class/power_supply/bms/voltage_ocv=4271600

/sys/class/power_supply/battery/status=Discharging
/sys/class/power_supply/battery/health=Good
/sys/class/power_supply/battery/temp=310
1 Like

@nephros - how could I change the batteryinfo.cpp. Can I install the debug version and can make it allone?
I will change follow line:

- const QString BatteryInfo::FILENAME_SYSFS_BATT_CHARGE_FULL       = QStringLiteral("battery/charge_full");
+ const QString BatteryInfo::FILENAME_SYSFS_BATT_CHARGE_FULL       = QStringLiteral("battery/charge_full_design");

Maybe the file “charge_full” will come back after some cycles but I am affraid that this is a fals on Xperia 10III.

Thx in advance

If you need to change the c++ source you need to recompile the app.

charge_full_design is not the current full charge, but rather the one “designed” , so when the battery was new. It will always show the same value, therefore not help with any calculations.

1 Like

Yes I know but it was only a trick to compensate my 0 in this file. A other idea is to bring a if in there. If charge_full = 0 then use charge_full_design Else charge_full. We can also wait some cycles, maybe the BMS will write the right charge_full after it… No pressure. Before I made the hard reset with power+ Vol = 3x vibrate all was good. But a good effect is, that after this hard reset the X10III had a very low current in discharge. Befor it was about 200mA now 150mA most times.

1 Like

After my hard reset and 2 times charge fron 1% to 100% the BMS is not refreshed and I have a “0” in /sys/class/power_supply/battery/charge_full and also in
/sys/class/power_supply/bms/charge_full.
So the app Batterylog could not show the remaining time at full charged.
As temp. quickfix I solved it with changing the file
Logs.qml in /usr/share/harbour-batterylog/qml/components/
Also the SoC are not correct.
In line 135 and line 145 I add “Design” after “Full”.
135 - return Math.round(60.0 * ((batteryInfo.energyFull - batteryInfo.energy) / Math.abs(averagePower)));
135 + return Math.round(60.0 * ((batteryInfo.energyFullDesign - batteryInfo.energy) / Math.abs(averagePower)));
145 - return Math.round(60.0 * (batteryInfo.energyFull / averagePower));
145 + return Math.round(60.0 * (batteryInfo.energyFullDesign / averagePower));
Also in file /usr/share/harbour-batterylog/qml/pages/MainPage.qml
I changed:
- value: (batteryInfo.chargeFull / batteryInfo.chargeFullDesign * 100).toPrecision(2) + "%"
+ value: (batteryInfo.chargeFullDesign / batteryInfo.chargeFullDesign * 100).toPrecision(3) + "%"
Yes now is the real status hidden but it works for me…
Its seems that after a hard reset from Android the X10III never will bring back the SoC and other atributes. Also Time to full or Time to Empty are 0 now. I found no feature to recalibrate the bms.