how to prevent charging from USB [not a question]
If you are on laptop with limited battery, and don't want to use that for charging your phone, but need to connect phone via USB to your laptop, this might be handy. (Read warnings and disclaimers first)
as root, to disable charging:
echo 1 > /sys/module/pm8921_charger/parameters/disabled
and to re-enable charging:
echo 0 > /sys/module/pm8921_charger/parameters/disabled
When disabled and connected to charger, polite notification says that charging does not work, please try another charger.
Warning: Do not allow phone battery to drain completely while charging disabled.
Disclaimer: Use at your own risk.
Disclaimer: I haven't tested does reboot restore this setting.
Credits to @xkr47 for asking this on IRC
Update:
<<< Here is @xkr47 "Charger Control" app. All feedback welcome. IRC: #chargercontrol on freenode. https://openrepos.net/content/xkr47/charger-control <<<
Interesting indeed. We are missing a comprehensive and organized reference manual for this kind of things.
objectifnul ( 2015-06-10 11:12:46 +0200 )editThese types of things are very hw-specific as far as I understand.
tortoisedoc ( 2015-06-10 12:24:25 +0200 )editThat is why we need it from Jolla.
objectifnul ( 2015-06-10 13:37:02 +0200 )editHei,
I used this in my script. I am not sure if this is the same with different naming, but it definitely works. And none the less, it is restored to default value after reboot of the phone.
Here.
LVPVS out.
LVPVS ( 2015-06-10 14:10:28 +0200 )edit@LVPVS, I got this when I tried your suggestion.. [root@Jolla ~]# echo 1 > /sys/class/power_supply/usb/charger_disable -bash: /sys/class/power_supply/usb/charger_disable: Permission denied
xkr47 ( 2015-06-14 14:06:26 +0200 )edit