diff --git a/README.md b/README.md index 9d81e67..b2ba941 100644 --- a/README.md +++ b/README.md @@ -160,18 +160,13 @@ rebootOnPause= ## USAGE -ACC is designed to run out of the box, without user intervention. You can simply install it and forget. However, as I've been observing, most people will want to tweak settings - and everyone will want to know whether the thing is actually working. +ACC is designed to run out of the box, without user intervention. You can simply install it and forget. However, as I've been observing, most people will want to tweak settings - and obviously everyone will want to know whether the thing is actually working. -If you're not comfortable with the command line, skip this section and use the `ACC app` (links section) to configure/manage ACC. +If you're not comfortable with the command line, skip this section and use the `ACC app` (links section) to manage ACC. Alternatively, you can use a `text editor` to modify `/sdcard/acc/config.txt`. Changes to this file take effect almost instantly, and without a daemon restart. -Notes/Tips for Front-end Developers -- It's best to use full commands over short equivalents - e.g., `--set chargingSwitch` instead of `-s s`. -- Follow auto-install/upgrade instructions in `moduleZip/install-latest.sh`. -- Use provided config descriptions for ACC settings in the app. Include additional information (trusted) where appropriate. - -Terminal Commands +### Terminal Commands ``` acc @@ -274,11 +269,39 @@ Run acc --readme to see the full documentation. +--- +## NOTES/TIPS FOR FRONT-END DEVELOPERS + + +It's best to use full commands over short equivalents - e.g., `--set chargingSwitch` instead of `-s s`. + +Use provided config descriptions for ACC settings in your app(s). Include additional information (trusted) where appropriate. + + +### Auto-install ACC + +``` +1) Check whether ACC installed (exit code 0) +which acc > /dev/null + +2) Download the installer (https://raw.githubusercontent.com/VR-25/acc/master/install-latest.sh) +- e.g., curl -#L [URL] > [output file] (progress is shown) + +3) Run "sh [installer]" (progress is shown) +``` + +Notes + +- The installer must run as root (obviously). +- Log: /sbin/_acc/install-sdterr.log + + + --- ## TROUBLESHOOTING -++Charging switch++ +### Charging Switch By default, ACC cycles through all available charging control files until it finds one that works. @@ -293,7 +316,7 @@ Test default/set switch(es) with `acc --test`. Evaluate custom switches with `acc --test `. -++Charging voltage limit++ +### Charging Voltage Limit Unfortunately, not all devices/kernels support custom charging voltage limit. @@ -302,17 +325,17 @@ Since I don't own every device under the sun, I cannot tell whether yours does. Use `acc --voltage :millivolts` (e.g., acc -v :4050) for evaluating charging voltage control files. -++Restore default config++ +### Restore Default Config `acc --set reset` -++Slow charging++ +### Slow Charging Nullify coolDownRatio (`acc --set coolDownRatio`) or change its value. By default, coolDownRatio is null. -++Logs++ +### Logs Logs are stored at `/sbin/_acc/`. You can export all to `/sdcard/acc-logs-$device.tar.bz2` with `acc --log --export`. @@ -360,6 +383,11 @@ See current submissions [here](https://www.dropbox.com/sh/rolzxvqxtdkfvfa/AABceZ --- ## LATEST CHANGES +**2019.5.12-r2 (201905122)** +- Enhanced auto-installer (install-latest.sh) +- Fixed - install.sh always resets config +- Updated documentation - notes/tips for front-end developers, improved readability + **2019.5.12-r1 (201905121)** - Installer optimizations - Updated documentation diff --git a/install-latest.sh b/install-latest.sh index 4d813a9..25ff935 100644 --- a/install-latest.sh +++ b/install-latest.sh @@ -6,30 +6,33 @@ # Copyright (C) 2019, VR25 @xda-developers # License: GPLv3+ # -# Run "test -f /dev/acc/modPath/acc || sh " to install ACC. +# Run "which acc > /dev/null || sh " to install ACC. set -euo pipefail +echo +echo "Downloading [module.prop], [update-binary] and [acc-*.zip]..." modId=acc -log=/dev/$modId/install-stderr.log -which awk >/dev/null || PATH=/sbin/.magisk/busybox:$PATH +log=/sbin/_$modId/install-stderr.log +[[ $PATH == "*magisk/busybox*" ]] || PATH=/sbin/.magisk/busybox:$PATH get_ver() { sed -n 's/^versionCode=//p' ${1:-}; } -instVer=$(get_ver /dev/$modId/modPath/module.prop 2>/dev/null) -baseUrl=https://github.com/Magisk-Modules-Repo/$modId -rawUrl=https://raw.githubusercontent.com/Magisk-Modules-Repo/$modId/master -currVer=$(curl -L $rawUrl/module.prop 2>/dev/null | get_ver) +instVer=$(get_ver /sbin/_$modId/acc/module.prop 2>/dev/null || :) +baseUrl=https://github.com/VR-25/$modId +rawUrl=https://raw.githubusercontent.com/VR-25/$modId/master +currVer=$(curl -#L $rawUrl/module.prop | get_ver) updateBin=$rawUrl/META-INF/com/google/android/update-binary zipFile=$baseUrl/releases/download/$currVer/$modId-$currVer.zip set +euo pipefail if [ ${instVer:-0} -lt ${currVer:-0} ] \ - && curl -L $updateBin 2>/dev/null > ${log%/*}/update-binary \ - && curl -L $zipFile 2>/dev/null > ${log%/*}/$modId-$currVer.zip + && curl -#L $updateBin > ${log%/*}/update-binary \ + && curl -#L $zipFile > ${log%/*}/$modId-$currVer.zip then sh ${log%/*}/update-binary dummy outFD ${log%/*}/$modId-$currVer.zip 2>$log fi -exit $? +echo +exit 0 diff --git a/install.sh b/install.sh index 324b230..5229032 100644 --- a/install.sh +++ b/install.sh @@ -151,7 +151,7 @@ on_install() { trap 'exxit $?' EXIT config=/data/media/0/$MODID/config.txt - configVer=$(sed -n s|^versionCode=||p $config 2>/dev/null || :) + configVer=$(sed -n 's|^versionCode=||p' $config 2>/dev/null || :) termuxSu=/data/data/com.termux/files/usr/bin/su # extract module files diff --git a/module.prop b/module.prop index db832a7..6e6574b 100644 --- a/module.prop +++ b/module.prop @@ -1,7 +1,7 @@ id=acc name=Advanced Charging Controller (acc) -version=2019.5.12-r1 -versionCode=201905121 +version=2019.5.12-r2 +versionCode=201905122 author=VR25 @ xda-developers description=This is primarily intended for extending battery service life. On the flip side, the name says it all. It supports Magisk 17-19. minMagisk=17000