Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control file gets overwritten #190

Open
hellfi opened this issue Apr 10, 2020 · 0 comments
Open

control file gets overwritten #190

hellfi opened this issue Apr 10, 2020 · 0 comments
Assignees

Comments

@hellfi
Copy link

hellfi commented Apr 10, 2020

Hi!
I have an older Redmi 3s with a fresh Lineageos 16 where $something is overwriting the control file. Some crude debug in the shell, while being connected to power:
cat /sys/class/power_supply/battery/charging_enabled \ && echo 0 > /sys/class/power_supply/battery/charging_enabled \ && cat /sys/class/power_supply/battery/charging_enabled \ && sleep 1s \ && cat /sys/class/power_supply/battery/charging_enabled
produces

1
0
1

So even when the file is altered by BatteryChargeLimit once it reaches the limit this only lasts a second. My crude remedy: make the control file not writable:
cat /sys/class/power_supply/battery/charging_enabled \ && echo 0 > /sys/class/power_supply/battery/charging_enabled \ && chmod -w /sys/class/power_supply/battery/charging_enabled \ && cat /sys/class/power_supply/battery/charging_enabled \ && sleep 3s \ && cat /sys/class/power_supply/battery/charging_enabled

1
0
0

Reversing this enables charging again.
I'm not confident playing with access rights on the control file is the way to go, but after the battery dies it should get reset in the worst case, being in /sys/. Maybe something like this could be added with even more warning dialogs to confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants