For some reasons not related to the battery life, I need to disable the battery charging when a USB host is connected to my phone (a rooted Nexus 4). Taking a look around on the internet (link1, link2), it looks like I should modify a system file. I have found a series of interesting files located in /sys/class/power_supply/battery
and /sys/class/power_supply/usb
, that could be the right ones to be modified in order to achieve the usb charging disabling (e.g. /sys/class/power_supply/usb/present 0/1
).
Has anyone tried something like that (control the usb charging via software and modify such system files)? Which is the best way to modify those system files? Should I use the adb shell or another tool?
I tried the "root explore" app in order to modify those files, however when I modified a file (after changing its permissions), it was automatically kept back to its original value.