Skip to content

Commit

Permalink
**2019.5.12-r2 (201905122)**
Browse files Browse the repository at this point in the history
- Enhanced auto-installer (install-latest.sh)
- Fixed - install.sh always resets config
- Updated documentation - notes/tips for front-end developers, improved readability
  • Loading branch information
VR-25 committed May 12, 2019
1 parent e149079 commit 9550063
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 26 deletions.
54 changes: 41 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <option(s)> <arg(s)>
Expand Down Expand Up @@ -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.

Expand All @@ -293,7 +316,7 @@ Test default/set switch(es) with `acc --test`.
Evaluate custom switches with `acc --test <file onValue offValue>`.


++Charging voltage limit++
### Charging Voltage Limit

Unfortunately, not all devices/kernels support custom charging voltage limit.

Expand All @@ -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`.

Expand Down Expand Up @@ -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
Expand Down
23 changes: 13 additions & 10 deletions install-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,33 @@
# Copyright (C) 2019, VR25 @xda-developers
# License: GPLv3+
#
# Run "test -f /dev/acc/modPath/acc || sh <this script>" to install ACC.
# Run "which acc > /dev/null || sh <this script>" 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
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9550063

Please sign in to comment.