I have a oneplus2 and I need to know the difference between charging_enabled vs battery_charging_enabled files present in /sys/class/power_supply/battery

I am using an app called Battery Charge Limit that is currently using battery_charging_enabled file to toggle charging when the preset limit is reached but even though I can see my phone is discharging (the app stop phone's charging even though the cable is plugged in), the discharging current is unusually very small as compared to "normal" discharging (without the app). Why is this happening? From where is it getting the extra power (if not from the battery) to keep up with the activities done on the phone.

I was wondering if the full charge condition (the ability of the phone to run directly on plugged power source instead of battery after it charges to 100%) was being applied at 90% (which I have set as the max charge limit in the app).

Also I checked the status of charging_enabled while the app was activated and it was 1, which means that it was not affected by the app (which is obvious as the control file used by the app is different).

Edit: I just changed the control file of the app from battery_charging_enabled to charging_enabled and now the battery drain seems normal.

Can anyone explain the difference between these control files ?

Edit: Adding device codes snippets from the file /android/lineage/kernel/oneplus/msm8994/drivers/power/qpnp-smbcharger.c . Hope it helps.

                smbchg_battchg_en(chip, val->intval,
                                REASON_BATTCHG_USER, &unused);
                pr_err("chg_en form userspace battery charging enable: %d\n",val->intval);
                smbchg_usb_en(chip, val->intval, REASON_USER);
                smbchg_dc_en(chip, val->intval, REASON_USER);
                chip->chg_enabled = val->intval;
                pr_err("chg_en form userspace charging enable: %d\n",chip->chg_enabled);
                val->intval = smcghg_is_battchg_en(chip, REASON_BATTCHG_USER);
                val->intval = chip->chg_enabled;
  • @beeshyams Couldn't find anything on net except some differences in device code.
    – paulplusx
    Aug 7, 2018 at 12:59

1 Answer 1


I had mailed this to developer requesting to answer here , instead he answered on mail to me. Quoting verbatim

You are right. Different control files behave differently. battery_charging_enabled tries to maintain the charge. It takes required power from charger, and it didn't charge/discharge battery. This behaviour is ideal, and if it works, then you should be using it.

charging_enabled completely cuts off power supply from cable. This case we need the threshold limit to start charging again

I have a OnePlus 3, I have both files, but the former doesn't work. I have no choice but to use the latter.

  • The thing is the former works(i.e. It stops charging) on my oneplus2 but the discharging is very slow about 10-50mAh which is 20-40 times less than normal. Probably some android developer can help with an even more precise answer.
    – paulplusx
    Aug 7, 2018 at 16:38
  • It seems like expected - it is drawing power from charger so the rate of discharge is slower compared to the second case where the battery is taking full load and discharging faster. Related android.stackexchange.com/q/130000/131553
    – beeshyams
    Aug 7, 2018 at 16:47
  • Seems like this is an acceptable answer although I would love to know the precise function of battery_charging_enabled . Thank you for your help.
    – paulplusx
    Aug 7, 2018 at 19:47
  • 1
    Thanks for accepting. I would also suggest reaching out to developers on XDA
    – beeshyams
    Aug 8, 2018 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .