Long story short I was installing custom ROMs to my Android device and one thing that stays in place regardless of ROM I use is a wrong battery stats monitoring. The device always behaves like it's being charged, although it's not.
I've checked the /sys/class/power_supply/battery
and voila - there's no battery
, only /sys/class/power_supply/usb
. According to some docs I've found that will make the system think it's connected to an external power source.
The question is what is responsible for creating this battery
file - is it a kernel, or a ROM (i.e. LineageOS, Resurrection Remix etc).
[UPD:] In the document I've provided they write about /sys/devices/power_supply
, not /sys/class/
, although here the /sys/class/power_supply/*/
is mentioned as a Kernel interface. Should I assume that it's a Kernel issue then?
It's interesting though, that the stock ROM does show battery stats correctly, although nothing was added to /sys/class/
and TWRP recovery I'm using shows battery charge as -1%.
ls -d /sys/devices/*/power_supply/battery
orls -d /sys/devices/*/*/power_supply/battery
orls /sys/class/power_supply/battery
? Both ROM and kernel are involved in hardware handling. There must be some binary blob in/vendor
acting as HAL which interacts with kernel, which ultimately deals with hardware. Mostly custom ROMs keep on including the same blobs in their ROMs extracted by someone. Do you face same issue with your stock ROM? – Irfan Latif Jul 9 '19 at 14:25/sys/class/power_supply/battery/status
? If it existscat
it. – Irfan Latif Jul 9 '19 at 14:57/battery
there - just/usb
. – Usurer Jul 9 '19 at 15:07pgrep -a hardware.health
either? – Irfan Latif Jul 9 '19 at 15:31