12-04-2023, 01:05 PM
I tried using /sys/class/power_supply/axp20x-battery/status to deduce whether my phone was in charging or discharging mode. My goal is to write a script that can notify me when electricity is out. However, it seems that status goes to Discharging when it reaches 100%. Is there another way I can detect if I have a power cable with electricity plugged in to my device that works better than checking the status on the battery as I do above?