how to prevent charging from USB [not a question]

asked 2015-06-10 11:03:38 +0200

kimmoli gravatar image

updated 2016-07-06 13:43:35 +0200

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.

image description

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 <<<

edit retag flag offensive reopen delete

The question has been closed for the following reason "not a real question" by kimmoli
close date 2015-06-10 11:14:21.355547

Comments

3

Interesting indeed. We are missing a comprehensive and organized reference manual for this kind of things.

objectifnul ( 2015-06-10 11:12:46 +0200 )edit

These types of things are very hw-specific as far as I understand.

tortoisedoc ( 2015-06-10 12:24:25 +0200 )edit
2

That is why we need it from Jolla.

objectifnul ( 2015-06-10 13:37:02 +0200 )edit
4

Hei,

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.

echo 1 > /sys/class/power_supply/usb/charger_disable

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