yashsingh1/xdaforums huggingface dataset:
[Magisk] skyfighter:
Tests @ Xiaomi Mi Mix 2S running MIUI global stable v10.2.2.0

Sadly both didn't work: "acc -d" / "acc -e" still result in display on + notification sound. (Will leave coolDown off...)

Don't work for me (last three: tested only "auto disable" and not "auto off").

polaris:/ # acc --test ./battery/charge_done 0 1

(!) [./battery/charge_done] does not work

1|polaris:/ # acc --test ./battery/power/control auto disabled

(!) [./battery/power/control] does not work

1|polaris:/ # acc --test ./parallel/power/control auto disabled

(!) [./parallel/power/control] does not work

1|polaris:/ # acc --test ./dc/power/control auto disabled

(!) [./dc/power/control] does not work

1|polaris:/ # acc --test ./bms/power/control auto disabled

(!) [./bms/power/control] does not work

Looks like there is only one working switch for me: ./battery/input_suspend 0 1

polaris:/ # acc -s s

(i) Available charging switches

1) auto 4) ./parallel/input_suspend 0 1

2) ./battery/input_suspend 0 1 5) exit

3) ./parallel/charging_enabled 1 0

(?) Choice, <enter>: 4

polaris:/ # acc -t

(!) [./parallel/input_suspend] does not work

1|polaris:/ # acc -s s

(i) Available charging switches

1) auto 4) ./parallel/input_suspend 0 1

2) ./battery/input_suspend 0 1 5) exit

3) ./parallel/charging_enabled 1 0

(?) Choice, <enter>: 3

polaris:/ # acc -t

(!) [./parallel/charging_enabled] does not work

1|polaris:/ # acc -s s

(i) Available charging switches

1) auto 4) ./parallel/input_suspend 0 1

2) ./battery/input_suspend 0 1 5) exit

3) ./parallel/charging_enabled 1 0

(?) Choice, <enter>: 2

polaris:/ # acc -t

(i) [./battery/input_suspend] works
[Magisk] VR25:
It's acc, not cs.

If your ROM offers the ability to turn off wake/sound on plug, use it. Else, disable coolDown (acc -s coolDown).
[Magisk] VR25:
Excellent idea!

I've been busy lately, but already started implementing this into accd. It's straightforward and efficient.

Thank you
[Magisk] VR25:
Hi,

Reboot your system and leave the device alone for a few minutes (say 5) to log the issue. Grab the log file from /dev/acc/.
[Magisk] VR25:
Me neither (yet), and that's the second report on this. That's an edge case.
[Magisk] VR25:
I'll add add this feature.
[Magisk] VR25:
Unless you install a ROM (e.g., LOS) that allows disabling "wake/sound on plug", don't use coolDown. The next version will turn it off for all.
[Magisk] I_did_it_just_tmrrow:
Hope this uploads still help you to improve your module. THX a ,ot for your work.

I am a user of a OnePlus One. Alias bacon or A0001. Because there is no chance to get a accu with the same or more mAh on the market I just build my own one. You can get much infos here.

My target: Setting up acc to control the accu by low voltage and high voltage and tempertaure. The accu chip BG27541 had sadly a hard-coded mAh value in the chip, flashed by oneplus/accu manufactur. So the fuel-gauge is not working correctly with my accu-mod.

Greetings by Idijt
[Magisk] Camerado:
Ok, disable coolDown and reboot. Cyclical screen blinking between coolDown-pause capacity have stopped, but...

After reaching pause capacity screen blinking one time (charger sounds off, but ROM do not support not-wake screen when charger on/off) and after 60 seconds (rebootOnPause=60) reboot occurs. And...

After that (charger on) reboot occurs again after 5 minutes. When i trying to disable charger, smartphone restarts again.
[Magisk] skyfighter:
Perfect, thank you! :)

In the meantime I've just modified /sbin/.magisk/img/acc/accd by surrounding the relevant lines (173,174) with a if-clause:

[B]if eval $(get_value resetCapacityMax); then[/B]
dumpsys batterystats --reset 1>/dev/null 2>&1 || :
rm /data/system/batterystats* 2>/dev/null || :
[B]fi[/B]

and adding the new parameter to /sdcard/acc/config.txt (and sbin/.magisk/img/acc/default_config.txt):

resetCapacityMax=false # Reset battery stats every time capacityMax/capacityPause is reached.

Seems to work as intended, at least it did for ~ three days. Last night something did reset the battery stats but perhaps I did that myself while playing around with files under /sys/class/power_supply/. :angel:

According to the MIUI Bettery Stats the only available switch (./battery/input_suspend 0 1) works but:

- afterwards prevents the device from going into deep-sleep

- doesn't supply the device from the ac adapter anymore

=> leaving the phone awake (screen is off -> wake-lock?), draining the battery...until the phone is disconnected, then DeepSleep works again. This way after charging over night to 70% I loose ~5-7% until the next morning. :(

Any hints regarding wake-lock (find, remove, ...) or forcing the device into DeepSleep?
[Magisk] ubergeek77:
Awesome! I'm glad to hear this!

You probably already know this, but just as a precaution, dumpsys disables monitoring of other information when you do this, such as voltage and temperature, so I wanted to make sure you were aware of that. If you run dumpsys battery in a terminal after setting the battery level, there is a warning message about it. It will even prevent the notification bar from showing the charging indicator.

Also, even though my notification bar battery level is always wrong, when it gets down to 1%, it stays that way until the battery level reported by the /sys/class ... /capacity file ticks down closer to zero. However, I never get a "battery empty, shutting down" graceful shutdown anymore. The phone just shuts off at around 2%, probably due to low voltage. I know ACC already has an auto shutdown feature at certain percentages, but I thought this would be helpful information for you to know anyway.
[Magisk] N1NJATH3ORY:
Thank you worked flawlessly! Quick question how do i find out Battery Cycles ? As i did acc -i but it dont give charger cycle ? How do i find out how many times i have connected the charger or how many times have i charged the Tab S4 ? Please ? Thanks
[Magisk] VR25:
I build custom batteries too. I keep smartphones for as long as possible (years), and always push them off-limits.

For anyone else who might be interested...

- Higher mAh rating: no problem

- Higher charging voltage rating: great for longevity

- Same charging voltage rating: good

- Lower charging voltage rating: terrible, unless the kernel supports custom charging voltage

Now, to your issues...

- You used the original battery chip. What's its peak charging voltage?

- What are the specs (current and voltage) of the batter(y|ies) you used? Did you keep the respective chip(s)?
[Magisk] VR25:
Ok, so in the next release, instead of rebooting when capacity >= maxCapacity, acc will do it when capacity == maxCapacity.
[Magisk] VR25:
Currently, there's no dedicated workaround for this. There are however, two things you can do:

- Try blocking the offending wakelock if your system supports that.

- Set resumeCapacity to 1% below maxCapacity.
[Magisk] VR25:
Running "dumpsys battery reset" before "dumpsys battery set level .." gets the job done.

Interesting...

This is another look at how your system is working in regards to battery management.

Are you using ACC's auto shutdown feature? Note that it now uses "reboot -p" instead of the graceful (yet unreliable) "am start -n android/com.android.internal.app.ShutdownActivity" or similar command.
[Magisk] VR25:
There's no definite answer to this. Such information is not usually provided by the battery management system.

The app AccuBattery may give you an answer based on estimated capacity calculations.
[Magisk] Inkazzo:
Please dont be confused but we (@I_did_it_just_tmrrow and me) made the same battrie Mod, i will answer your question.

- You used the original battery chip. What's its peak charging voltage?

Waht do you mean with Peak charging voltage? The level wich will be charged into until the chaging stopps or the voltige the controller is using for the charge of the cell? The maximum voltige level of the cell i´ve seen my self is 4,327 - 4,330 is and it depends on firmware. The Voltige wich the controller is using to charge the cell i can not messure. Or do you mean the Lithimcell type (4,2 volt or 4,35 hi volt cell) we got the 4,35v type.

- What are the specs (current and voltage) of the batter(y|ies) you used? Did you keep the respective chip(s)?

Original accu 3100mah @4,35v max, nominal 3,9v, low 3,3v (messured real capacity using MC3000 charger is now 2350mah)

Selfmade accu 3900mah @4,35v max, nominal 3,9v, low 3,3v (messured real capacity using MC3000 charger is now 3874mah)

the original IC+BMS chip( Texas instruments BG27541) from the original Oneplus accu was used on the new one

END
[Magisk] I_did_it_just_tmrrow:
THX a lot for reply.

To your questions:

- You used the original battery chip. What's its peak charging voltage?

Sorry, but what exactly is the the Peak level?

EDIT: I made for a short video. At the begining it is pluged into the charger.

https://www.mediafire.com/file/irnwb3b8gcwa7tk/recording_20190327_120853.mp4

- What are the specs (current and voltage) of the batter(y|ies) you used? Did you keep the respective chip(s)?

I used the chip from the Oneplus Accu on the new lithium-cell. The chip is a Texas Instrument BG27541. Sadly there are only some expensiv ways to reflash them external with the new mAh values.

Original accu is called BLP571 and has 3100mAh @4,35V max, nominal 3,9V

Selfmade accu has 3800mAh @4,35V max, nominal 3,9V

Nice to read that there are some other dudes out there who respect the hardware and give all the devices one more reason to life. I see a lot of people in the web. But doing some modification with the Lithium-Cell is not so common.

Here at the BLP571 replacement thread is a user called @Inkazzo who build the same accu like me. We do some tests but it is really hard to reach the max voltage when charging the accu (about 4,35V). Our only chance was to write another value into "sys/class/power_supply/battery/capacity" like 50.

With your reply you give me really hope that you can help us with your great Magisk-Modul.

Greetings by Idijt
[Magisk] icsterm:
How is it possible to adjust the coolDownTemp action to be something else instead of 50s charge/10s discharge?

I don't use coolDownCapacity at all, but I do use coolDownTemp.

maxTemp seems to play nicely with the customisable cooling timeout, but coolDownTemp should have it's customisable preset, which it doesn't.

Also, why is the maximum charge voltage limitating fixed to max 4199mV? That equals to somewhat 80%'ish maximum charge on a 4.4V Li-Po, and the charging gets real slow when it hits 60% (takes around 1 hour on my Mi Note 2 just to charge 20% of battery).

I would like to not use the 4.4V default charge voltage on my Mi Note 2 and limit the charge voltage at 4.25-4.3V and also get faster charging when the battery is over 60%.

This is the only bummer with ACC, it's not made with Li-Po's in mind which have 0.2V greater max capacity voltage.
[Magisk] VR25:
[MENTION=8750216]Inkazzo[/MENTION], [MENTION=3729682]I_did_it_just_tmrrow[/MENTION], replace "peak charging voltage" with "cutoff charging voltage". 4.35 is the number, as you said.

So far, I know that you would like acc to override the confused BMS. That is, you want it to update battery capacity based on voltage - and auto-shutdown when voltage is low (e.g., 3.5 Volts) to prevent deep discharge and eventual cell death.

I didn't have time to dive deeper into the linked thread. For completeness, could you summarize all issues with the battery mod, and your proposed solutions?
[Magisk] VR25:
So, you want something like temp=400_15-450_90. I can implement that. But wouldn't it be better to just use, for instance, temp=400-400_15?

Ok, I'll increase the limit to 4300mV.
[Magisk] icsterm:
Not exactly, I would like to adjust the cooldown parameter for capacity, but keep the capacity cooldown disabled using 101% as battery threshold, and just really apply the custom cooldown for cooldowntemp only. I hope I made myself clear enough, because I mainly adjust acc using ACCA, I'm not a big fan of using terminal to adjust parameters. This method or add a new cooldown parameter in the mix (your proposed variant, which might be better because it's easier to understand for beginners).

That's great, I hope the internal charging circuitry on 4.2V Li-Ion phones don't allow 4.3V charging (I think they do), that is a big mistake to charge using higher than stock voltage (i'm not 100% positive on this), this can damage Li-Ion cells fast (users might bump it to max if not familiar with cell chemistries). So maybe a standalone flag in the config file is needed for enabling the extended charging voltage (e.g LiPo = 1 or 0(default 0)).

4300mV is really the max needed in my case.
[Magisk] ubergeek77:
I'm 99% certain I do (it shows up as the first number shown in acc -s), but now that you mention it, it doesn't seem to shut down by itself anymore.
[Magisk] VR25:
Not sure I'm getting this straight.

coolDownRatio (default: 50/10) works with coolDownCapacity (default: 60%) OR coolDownTemp (default: 40°C).

If you set coolDownCapacity to 101%, coolDownRatio works with coolDownTemp only.

Likewise, if coolDownTemp is absurdly high (e.g., 90°C), but coolDownCapacity is valid (e.g., 60%), coolDownRatio works with coolDownCapacity only.

A dedicated coolDownRatio for coolDownTemp - is that what you want?

The limit will be default_max_mV - 1mV, then.
[Magisk] icsterm:
Yes, that's more simpler way to make this fully configurable.
[Magisk] lupacche:
Thanks for the awesome work, but I Just cannot get rid of the wakelock caused by acc when charger Is connected and charging Is disabled.

I tried both of the two switches available on my phone (changed and restarted the daemon), I also tried using WakeBlock (but the particular wakelock Is not listed in that application).

I am using a OnePlus 6,Wakelock name is chg_wake_lock

Edit: I now noticed that this has been already discussed. I'm availabe if you need help for testing

Edit 2: I managed to suppress the Wakelock by using a custom kernel (Franco R15) and its companion app in which I blocked the wakelock.
[Magisk] VR25:
There's a major logic issue...

If there are two coolDownRatio values, which of those would be used when coolDownCapacity AND coolDownTemp are reached?
[Magisk] VR25:
Note: the wakelock is not caused by acc. That's a faulty driver implementation. The vendor is to blame.

You managed to suppress a great pain.
[Magisk] lupacche:
Thanks for clarifying that, I hope my workaround Is useful for someone else. Seems to work fine.
[Magisk] icsterm:
Indeed, if both are reached it gets a little overcomplicated.

Maybe keep time values of cooldowntemp = cooldowncapacity in sync when cooldowncapacity is disabled.

This is what I've tried, I disabled cooldowncapacity in ACCA and the 50/10 thing happended, and I really wanted something different such as 120/10.
[Magisk] D1stRU3T0R:
OP what do you think it's the best/highest amount that a qc3-er can charge? Pocophone supports QC4+ but we only got qc3(cutting down budgeds), thus asking what's the safest way to go. We managed 3500mah for now. If you want more information about battery/charger or anything please PM so you can have a better ideea about it.
[Magisk] kewinhw:
im on default acc profile

my phone vibrates when im charging it when battery is between 70-80 is that normal ? it vibrates stops charging and then starts charging again very briefly this happens. my device is oneplus 6 stock oxygen os

EDIT: searched the forum. i disabled cooldown that seemed to do it. also stopped my screen from waking :)
[Magisk] cinmil:
I tried install acc on 2 phone(max pro m1/redmi note 5 pro.charging become too slow after reaching 60℅.maybe around 600~700ma take too long to full..is there setting for this?.i only set charging lmit to 90%.and off other option....tried uninstalling this module and charging become normal again.but i need the setting to limit charging certain %
[Magisk] ubergeek77:
This is getting out of hand...
[Magisk] VR25:
I'll add this to the documentation.

Why don't you just set coolDown=120/10, then?

Implementing two distinct cool down ratios is not worth the effort.

The power adapter itself tells you the max power it can supply, but the battery and internal charging circuitry dictate how much of it gets supplied.

Mainstream information suggests that the max charge rate should be no higher than 1C (100% capacity in one hour) - while the suggested recommended max is .8C (80% capacity in one hour, that's 3200 out of 4000mAh.).

We see this being disregarded all the time with fast charging technologies.

You're probably okay with up to 4000mAh (1C), as long as your battery temperature doesn't go out of wack (e.g., 45+°C). Just keep in mind that fast charging in general is against longevity.

It will be disabled by default for all.

run acc --set coolDown .

:eek:

Did you look over your device's forums for a similar case? If that's really caused by the firmware update, this needs a PSA.

Anyway, I'll switch my focus back to acc after I'm done updating Sysconfig Patcher.
[Magisk] ubergeek77:
Yes, I did. I even made a post about it on the Pixel 3 XL forum. No one there seemed to have the same issue as me, and a few people suggested that ACC was causing this somehow. I'm disappointed that it doesn't affect more people, because maybe then it would get more attention.

Personally, I don't hold ACC directly responsible, but there is clearly something going on here. My SO's phone isn't quite as severe as mine, but that Pixel 3 XL also has incorrect readings like mine.

If I had to guess, Google changed something about how they estimate the battery level, and since ACC blocks charging after a certain percentage, that estimation is disrupted somehow. But when you think about it, that explanation doesn't really make any sense, because the Linux kernel provides a perfectly good reading for the battery.

I honestly have no idea what's going on here, what caused it, or how to get it to stop.

If it's any help, what I can tell you is that this recent jump in battery level difference started very shortly after I bumped my ACC charging cutoff from 42% to 60%. I posted about my numbers before, but back when my cutoff was 42%, the battery level was somewhere around 10% different, not 30% as it currently is.

But yeah. This is completely nuts.
[Magisk] Sukhwinder449:
Hey man thanx for the great work developing this module. I've been using it since the mcs version. Very useful stuff. Now that it's changed into acc with more features it's even great.

I'm currently using capacity values of 0,101,90,95. The issue I'm facing is that when battery reaches 90 the charging is paused and then with just 1% drop to 89 charging is resumed again. It causes infinite loops of charging from 89 to 90.

Instead the way I've configured the values it should be charging from 90 to 95 right?

Can you point me to what I'm doing wrong here?
[Magisk] VR25:
The new capacitySync feature will definitely prevent OCD episodes.

Now, as to what exactly this is happening...

It could be that turning charging off enough times before the expected design capacity is reached confuses the "smart battery".

If that's the case, that smart battery's algorithm is very poor.

I'm curious to know whether the smart battery would self-calibrate if you stopped using acc for a few days and let the battery charge/discharge "normally".
[Magisk] Tommytommy1234:
I'm using LineageOs 16 and when my battery goes under 5%, it's shut down himself. Anything I can do to stop this?
[Magisk] VR25:
Your charging switch(es) could be unreliable. ACC is disabling charging, but for some reason, the system is turning it back on.

Try enforcing a single charging switch (acc -s s).

Also, upload your power supply log if you've not done so already: https://xdaforums.com/showpost.php?p=78809121&postcount=2247
[Magisk] VR25:
Run acc -c sed -i s/=5,/=0,/
[Magisk] traptrigger:
what does charging(taper) means?
[Magisk] firefoot007:
I am trying this module on Mi 8se, and same things happens to me, i have set charging limit to 95% and recharge at 80%, also turned everything else off. It almost stops charging at 70% in taper mode with 2-3 mA current. Did you find any solution?
[Magisk] Sukhwinder449:
I think there are syntax errors in config file when you first install this module. Originally the capacity values I used were using commas between pause, resume values

capacity=5,101,85,90

But the comments in config file lists example as capacity=0,101,70-80. There's - symbol used instead of comma.

The cool down values also used comma instead of / symbol indicated in comments.

Maybe I'm mistaken in pointing this out but the weirdness with charging is fixed for me after using syntax from examples given in commented section of config file. I corrected it to values shown in ss. And finally charging stops at 90 and then resumes when battery goes to 84. Otherwise it would just stop at lower values which I've set at 85 and would not charge above it and just cause infinite loops of 84 to 85 charging cycle.
[Magisk] Tommytommy1234:
Is there a option in acc app to configure this?
[Magisk] skyfighter:
I tried to setup two tasks using djs but it did not work as expected - looks like it does not execute my commands at the defined time. Looked at it's code and found out it uses sleep for timing the jobs...tried to find out what's going on and stumbled about this:

:/ $ date && sleep 3000 && date
Sat Apr 6 13:22:37 CEST 2019
Sat Apr 6 16:30:03 CEST 2019
:/ $

WTF :eek:

Guess sleep is to blame and not djs. Any idea how to solve that "sleep-issue"?

(Sorry for off-topic. Couldn't find a better place to ask and since djs is included in acc I hope it's okay.)
[Magisk] smartsoldier:
Hey this app looks really promising! I am having an issue on my phone where I need to force it to charge even though it thinks the temp is -32C, and I think you app may do the trick. Can you confirm, and if so do I need Magisk specifically? I have LineageOS and root access already. Thanks.
[Magisk] VR25:
Removing that file doesn't seem to be a universal solution. It didn't work for me.

What do you mean by auto-restore?

Could you upload cs_debug.zip?

Not a bug, but rather a Nougat limitation. Clearing batterystats.bin and/or any other similar file doesn't work. I'm yet to find a working solution.

Where's your cs_debug.zip? ;)

That could probably be done. However, a general rule of thumb states that playing with voltage/current is almost always a bad idea. The safest thing to do is setting the RESUME% to a higher value (i.e., cs 90 66) -- so that your battery starts charging again when its charge level drops below that %.

Will add that exception.

A cs_debug.zip file would be great! :rolleyes:

You should try it. If it isn't, upload the generated cs_debug.zip file.
[Magisk] ant090876:
I am know, but i not seen here the button "Add attach".

Archive on yandex-disk: "https://yadi.sk/d/yws7W2083PLEcf"
[Magisk] Bedi_:
Hi all, cs module stopped working after last update on my n6p. Here's the output, cs_log and debug. Hope that will be helpful

cs -i

Battery Info

cat: can't open '/sys/devices/platform/battery/power_supply/Battery/uevent': No such file or directory
[Magisk] merbiyatch:
Hello. Would someone be able to help me on how to make this app work for me? I get this whenever i type cs 80
[Magisk] runeupo:
I had similar before, what works for me:

su #

cs 80

Hopefully it works for you, too
[Magisk] merbiyatch:
Uhm i just said cs 80 aint workin for me though
[Magisk] runeupo:
And your screenprint shows you used command 'su'

It's my suggestion to use 'su #' and then the cs command. Just try ?
[Magisk] umeshbluezzz:
My logs
[Magisk] DarkXonline:
Unsupported device. Plz help
[Magisk] merbiyatch:
Not workin
[Magisk] Aping812:
can someone explain how to install this

i had Mi 6 with custom rom RR 5.8.5 based AOSP

i Don't understand how to install it