ubports-mido / android_device_xiaomi_mido

Warning! This repo is currently outdated, use "ubports_device_xiaomi_mido" repo instead, This is the device tree for Ubuntu touch port for Redmi note 4X (mido) , clone to device/xiaomi/mido
3 stars 5 forks source link

Auto Shutdown due to misreading of battery percentage #2

Closed joelselvaraj closed 4 years ago

joelselvaraj commented 4 years ago

Device automatically power off after a while. The main cause appears to be Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: Battery energy percentage is at critical level -0.0%

I think its because devices /org/freedesktop/UPower/devices/battery_bcl and /org/freedesktop/UPower/devices/battery_fg_adc reports 0.0 battery percentage `` /var/log/syslog

Mar 28 10:31:21 ubuntu-phablet kernel: [ 2664.800381] PM: suspend entry 2020-03-28 05:01:21.565521092 UTC

Mar 28 10:31:21 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_bms), is_present=1, state=2, percentage=93.00, temperature=33.50

Mar 28 10:31:21 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_bcl), is_present=1, state=3, percentage=0.00, temperature=0.00

Mar 28 10:31:22 ubuntu-phablet kernel: [ 2665.030288] PM: suspend entry 2020-03-28 05:01:22.483906040 UTC

Mar 28 10:31:22 ubuntu-phablet kernel: [ 2665.030298] PM: Syncing filesystems ... done.
Mar 28 10:31:22 ubuntu-phablet kernel: [ 2665.040462] PM: Preparing system for mem sleep
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.239994] Restarting tasks ... done.
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.247380] cpufreq: Frequency violation fixed for CPU0
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.247506] PM: suspend exit 2020-03-28 05:01:23.504436091 UTC

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_fg_adc), is_present=1, state=3, percentage=0.00, temperature=0.00

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: is_using_battery_power() => true

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: Battery energy percentage is at critical level -0.0%

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: LibsuspendSuspendControl: disallow_suspend(UPowerPowerSource2)

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: LibsuspendSuspendControl: exiting suspend
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.252237] PM: suspend entry 2020-03-28 05:01:23.509163486 UTC

Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.252248] PM: Syncing filesystems ... done.
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.266354] PM: Preparing system for mem sleep
Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: DefaultStateMachine: handle_power_source_critical

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_bms), is_present=1, state=2, percentage=93.00, temperature=33.50

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_battery), is_present=1, state=2, percentage=93.00, temperature=33.50

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: SystemShutdownControl: power_off()

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_bcl), is_present=1, state=3, percentage=0.00, temperature=0.00

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_fg_adc), is_present=1, state=3, percentage=-0.00, temperature=0.00

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_bms), is_present=1, state=2, percentage=93.00, temperature=33.50

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_battery), is_present=1, state=2, percentage=93.00, temperature=33.50

Mar 28 10:31:23 ubuntu-phablet repowerd[1259]: UPowerPowerSource: change_device(/org/freedesktop/UPower/devices/battery_bcl), is_present=1, state=3, percentage=0.00, temperature=0.00

Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.325120] Restarting tasks ... done.
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.333330] cpufreq: Frequency violation fixed for CPU0
Mar 28 10:31:23 ubuntu-phablet kernel: [ 2665.333447] PM: suspend exit 2020-03-28 05:01:23.590377184 UTC

Mar 28 10:31:23 ubuntu-phablet rsyslogd: [origin software="rsyslogd" swVersion="8.16.0" x-pid="13142" x-info="http://www.rsyslog.com"] exiting on signal 15.
joelselvaraj commented 4 years ago

Maybe disabling them might help. Will let try and let you know.

CONFIG_QPNP_FG=y
CONFIG_BATTERY_BCL=y

https://github.com/ubports-mido/android_kernel_xiaomi_msm8953/blob/d46c2645d287330ccfb8079ace5e79c2aac7fd0c/arch/arm64/configs/mido_defconfig#L2182-L2183

gopikrishnanrmg commented 4 years ago

I didn't notice that the device shutdown, that's cool that you noticed it and yeah please check it out.

joelselvaraj commented 4 years ago

I think the issue can be closed now. I m running for the past 3 days without any auto shutdown issue after the fix.