Skip to content

Commit 02e64be

Browse files
committedOct 14, 2020
**v2020.10.14 (202010140)**
- acc -i: show additional power supply info, if any. - build.sh: copy uninstaller to build dir. - cooldown_current: instead of pausing charging periodically during the cooldown phase, lower the charging current (0mA or custom). This is the default behavior (smoother). - Fetch current and voltage control files only once per boot session to prevent loss of default values. - Fixed daemon restart/stop timeout issues. - Fixed Zygote-related issue that prevented accd initialization on boot. - Misc fixes & optimizations - MTK switch delay ranges from 5 to 20 seconds.
1 parent e3063ad commit 02e64be

15 files changed

+221
-148
lines changed
 

‎README.md

+23-21
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ In interactive mode, it also asks the user whether they want to download and ins
174174
```
175175
#DC#
176176
177-
configVerCode=202009230
177+
configVerCode=202010120
178178
capacity=(-1 60 70 75 false)
179179
temperature=(40 60 90)
180180
cooldownRatio=()
181+
cooldownCurrent=0
181182
cooldownCustom=()
182183
resetBattStats=(false false)
183184
chargingSwitch=()
@@ -215,6 +216,8 @@ loopCmd=()
215216
216217
# cooldownCustom=cooldown_custom=(file raw_value charge_seconds pause_seconds)
217218
219+
# cooldownCurrent=cooldown_current=[Milliamps]
220+
218221
# resetBattStats=(reset_batt_stats_on_pause reset_batt_stats_on_unplug)
219222
220223
# chargingSwitch=charging_switch=(ctrl_file1 on off ctrl_file2 on off --)
@@ -256,6 +259,7 @@ loopCmd=()
256259
# mtp max_temp_pause
257260
258261
# ccu cooldown_custom
262+
# cdc cooldown_current
259263
260264
# rbsp reset_batt_stats_on_pause
261265
# rbsu reset_batt_stats_on_unplug
@@ -306,6 +310,8 @@ loopCmd=()
306310
307311
# acc -s loop_cmd="echo 0 \\> battery/input_suspend"
308312
313+
# acc -s cooldown_current=500
314+
309315
310316
# FINE, BUT WHAT DOES EACH OF THESE VARIABLES ACTUALLY MEAN?
311317
@@ -356,6 +362,10 @@ loopCmd=()
356362
# It takes precedence over the regular cooldown settings.
357363
# Refer back the command examples.
358364
365+
# cooldown_current (cdc) #
366+
# Instead of pausing charging periodically during the cooldown phase, lower the charging current.
367+
# This is the default behavior (smoother).
368+
359369
# reset_batt_stats_on_pause (rbsp) #
360370
# Reset battery stats after pausing charging.
361371
@@ -1029,26 +1039,6 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu
10291039
## LATEST CHANGES
10301040

10311041

1032-
**v2020.9.24 (202009240)**
1033-
1034-
- Cooldown no longer interferes with capacity_sync.
1035-
- Delay accd initialization (5 minutes) to prevent conflicts with fbind.
1036-
- Do not auto-shutdown if charging was disabled by accd itself at temp >= max_temp.
1037-
- Do not remount / rw if it's not tmpfs.
1038-
- Fixed cooldown_custom.
1039-
- Major optimizations
1040-
- MTK and Razer specific tweaks
1041-
- New charging switch for Motorola One Vision
1042-
- Removed obsolete features.
1043-
- Simplified config.
1044-
- Updated documentation.
1045-
1046-
Release Notes
1047-
1048-
- Config will be reset.
1049-
- MIUI bootloop issue possibly fixed.
1050-
1051-
10521042
**v2020.10.1 (202010010)**
10531043

10541044
- Fixed automatic charging switch management issues.
@@ -1072,3 +1062,15 @@ Release Notes
10721062
- Move persistent data to /sdcard/Documents/vr25/acc/ for compatibility with Android 11 storage isolation.
10731063
- Updated documentation (FAQ, tips, voltage issues, Samsung's "70% problem", etc.).
10741064
- Use `cmd` in place of most `dumpsys` calls.
1065+
1066+
1067+
**v2020.10.14 (202010140)**
1068+
1069+
- acc -i: show additional power supply info, if any.
1070+
- build.sh: copy uninstaller to build dir.
1071+
- cooldown_current: instead of pausing charging periodically during the cooldown phase, lower the charging current (0mA or custom). This is the default behavior (smoother).
1072+
- Fetch current and voltage control files only once per boot session to prevent loss of default values.
1073+
- Fixed daemon restart/stop timeout issues.
1074+
- Fixed Zygote-related issue that prevented accd initialization on boot.
1075+
- Misc fixes & optimizations
1076+
- MTK switch delay ranges from 5 to 20 seconds.

‎TODO.txt

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
remove #legacy
22

3-
cooldown with current reduction
4-
stop/slowdown charging with current reduction
3+
support voltage control files with space-separated values (Samsung)
54

6-
profiles
7-
config.txt
8-
profile=[file]
5+
alerts
6+
7+
8+
alternate charging control logic
9+
10+
disable_charging() {
11+
maxChargingCurrent0=${maxChargingCurrent[0]-}
12+
set +e
13+
set_ch_curr 0 > /dev/null 2>&1
14+
set -e
15+
touch $TMPDIR/.ch-disabled
16+
}
17+
18+
enable_charging() {
19+
set +e
20+
set_ch_curr ${maxChargingCurrent0:--} > /dev/null 2>&1
21+
set -e
22+
rm $TMPDIR/.ch-disabled
23+
}
24+
25+
not_charging() {
26+
grep -Eiq "${1-dis|not}" $batt/status && [ ! -f $TMPDIR/.ch-disabled ]
27+
}

‎acc/acc.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test_charging_switch() {
9999
&& sleep_sd not_charging || :
100100

101101
! not_charging && failed=true || {
102-
grep -iq 'not' $batt/status \
102+
not_charging not \
103103
&& battIdleMode=true \
104104
|| battIdleMode=false
105105
}
@@ -308,7 +308,7 @@ case "${1-}" in
308308
| sed -e '1s/.*/Battery Service/' && echo
309309

310310
. $execDir/batt-info.sh
311-
echo "/sys/class/power_supply/$batt/uevent"
311+
echo Uevent
312312
batt_info "${2-}" | sed 's/^/ /'
313313

314314
} | more

‎acc/acca.sh

+15-27
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ daemon_ctrl() {
1010
exec /dev/accd $config
1111
;;
1212
stop)
13-
. ./release-lock.sh
13+
. $execDir/release-lock.sh
1414
exit 0
1515
;;
1616
*)
@@ -21,12 +21,16 @@ daemon_ctrl() {
2121

2222

2323
set -eu
24-
cd /data/adb/vr25/acc/
25-
export TMPDIR=/dev/.acc verbose=false
26-
. ./setup-busybox.sh
2724

25+
execDir=/data/adb/vr25/acc
2826
config=/sdcard/Documents/vr25/acc/config.txt
29-
defaultConfig=$PWD/default-config.txt
27+
defaultConfig=$execDir/default-config.txt
28+
TMPDIR=/dev/.acc
29+
verbose=false
30+
31+
export execDir TMPDIR verbose
32+
cd /sys/class/power_supply/
33+
. $execDir/setup-busybox.sh
3034

3135
mkdir -p ${config%/*} 2>/dev/null || :
3236
[ -f $config ] || cp $defaultConfig $config
@@ -50,14 +54,13 @@ case "$@" in
5054

5155
# print battery uevent data
5256
-i*|--info*)
53-
cd /sys/class/power_supply/
5457
for batt in $(ls */uevent); do
5558
chmod u+r $batt \
5659
&& grep -q '^POWER_SUPPLY_CAPACITY=' $batt \
5760
&& grep -q '^POWER_SUPPLY_STATUS=' $batt \
5861
&& batt=${batt%/*} && break
5962
done 2>/dev/null || :
60-
. /data/adb/vr25/acc/batt-info.sh
63+
. $execDir/batt-info.sh
6164
batt_info "${2-}"
6265
exit 0
6366
;;
@@ -76,37 +79,22 @@ case "$@" in
7679
flock 0 <&4
7780
shift
7881

79-
# since this runs asynchronously, restarting accd from here is potentially troublesome
80-
# the front-end itself should do it
81-
# case "$*" in
82-
# s=*|*\ s=*|*charging_switch=*|*sc=*|*shutdown_capacity=*)
83-
# ! daemon_ctrl stop > /dev/null || restartDaemon=true
84-
# trap 'e=$?; ! ${restartDaemon:-false} || /dev/accd; exit $e' EXIT
85-
# ;;
86-
# esac
87-
8882
. $defaultConfig
8983
. $config
9084

9185
export "$@"
9286

93-
case "$*" in
94-
*ab=*|*apply_on_boot=*)
95-
apply_on_boot
96-
;;
97-
esac
98-
9987
[ .${mcc-${max_charging_current-x}} = .x ] || {
100-
. ./set-ch-curr.sh
88+
. $execDir/set-ch-curr.sh
10189
set_ch_curr ${mcc:-${max_charging_current:--}} || :
10290
}
10391

10492
[ .${mcv-${max_charging_voltage-x}} = .x ] || {
105-
. ./set-ch-volt.sh
93+
. $execDir/set-ch-volt.sh
10694
set_ch_volt ${mcv:-${max_charging_voltage:--}} || :
10795
}
10896

109-
. ./write-config.sh
97+
. $execDir/write-config.sh
11098
exit 0
11199
;;
112100

@@ -115,15 +103,15 @@ case "$@" in
115103
-s\ d*|-s\ --print-default*|--set\ d*|--set\ --print-default*|-sd*)
116104
[ $1 = -sd ] && shift || shift 2
117105
. $defaultConfig
118-
. ./print-config.sh | grep -E "${1:-...}" || :
106+
. $execDir/print-config.sh | grep -E "${1:-...}" || :
119107
exit 0
120108
;;
121109

122110
# print current config
123111
-s\ p*|-s\ --print|-s\ --print\ *|--set\ p|--set\ --print|--set\ --print\ *|-sp*)
124112
[ $1 = -sp ] && shift || shift 2
125113
. $config
126-
. ./print-config.sh | grep -E "${1:-...}" || :
114+
. $execDir/print-config.sh | grep -E "${1:-...}" || :
127115
exit 0
128116
;;
129117

0 commit comments

Comments
 (0)
Please sign in to comment.