Skip to content

Commit

Permalink
**2019.6.20 (201906200)**
Browse files Browse the repository at this point in the history
- Additional charging control files
- Enhanced daemon reliability
- `install-current.sh` no longer requires absolute path
- Updated documentation
- wakeUnlock - auto-unlock select wakelocks after charging is disabled
  • Loading branch information
VR-25 committed Jun 21, 2019
1 parent b0987fd commit 8813122
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 73 deletions.
62 changes: 35 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To prevent fraud, do NOT mirror any link associated with this project; do NOT sh
---
## WARNING

ACC manipulates Android low level (kernel) parameters which control the charging circuitry.
ACC manipulates Android low level ([kernel](https://duckduckgo.com/?q=kernel+android)) parameters which control the charging circuitry.
The author assumes no responsibility under anything that might break due to the use/misuse of this software.
By choosing to use/misuse ACC, you agree to do so at your own risk!

Expand All @@ -45,7 +45,7 @@ By choosing to use/misuse ACC, you agree to do so at your own risk!
---
## DESCRIPTION

ACC is primarily intended for extending battery service life. On the flip side, the name says it all.
ACC is primarily intended for [extending battery service life](https://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries). On the flip side, the name says it all.



Expand Down Expand Up @@ -84,6 +84,8 @@ Notes

- To update the local repo, run `git pull -f <repo>`.

- To install/upgrade straight from source, refer to the next section.



---
Expand All @@ -94,12 +96,12 @@ Notes

Install/upgrade: flash live (e.g., from Magisk Manager) or from custom recovery (e.g., TWRP).

Uninstall: use Magisk Manager (app) or Magisk Manager for Recovery Mode (utility).
Uninstall: use Magisk Manager (app) or [Magisk Manager for Recovery Mode (utility)](https://github.com/VR-25/mm/).


### Any Root Solution (Advanced)

Install/upgrade: extract `acc-*.zip`, run `su`, then execute `sh /absolute/path/to/extracted/install-current.sh`.
Install/upgrade: extract `acc-*.zip`, run `su`, then execute `sh /path/to/extracted/install-current.sh`.

Uninstall: for Magisk install, use Magisk Manager (app); else, run `su -c rm -rf /data/adb/acc/`.

Expand All @@ -110,6 +112,8 @@ ACC supports live upgrades - meaning, rebooting after installing/upgrading is un

The demon is automatically started ~30 seconds after installation.

For non-Magisk install, `/data/adb/acc/acc-init.sh` must be executed on boot to initialize acc. Without this, acc commands won't work. Additionally, ff your system lacks executables such as `awk` and `grep`, [busybox](https://duckduckgo.com/?q=busybox+android) or similar binary must be installed prior to installing acc.



## DEFAULT CONFIGURATION
Expand Down Expand Up @@ -168,6 +172,9 @@ chargingOnOffDelay=1
# English (en) and Portuguese (pt) are the main languages supported. Refer to the localization section below for all available languages and translation information.
language=en
# Wakelocks to unlock after pausing charging
wakeUnlock=SEC_BATTERY_VBUS f9200000.ssusb chg_wake_lock qcom_step_chg c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2
```


Expand All @@ -177,9 +184,9 @@ language=en

ACC is designed to run out of the box, without user intervention. You can simply install it and forget. However, as it's been observed, most people will want to tweak settings - and obviously everyone will want to know whether the thing is actually working.

If you feel uncomfortable with the command line, skip this section and use the `ACC app` (links section) to manage ACC.
If you feel uncomfortable with the command line, skip this section and use the [ACC app](https://github.com/MatteCarra/AccA/releases/) 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.
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](https://en.wikipedia.org/wiki/Daemon_(computing)) restart.


### Terminal Commands
Expand Down Expand Up @@ -297,7 +304,7 @@ It's best to use full commands over short equivalents - e.g., `--set chargingSwi
Use provided config descriptions for ACC settings in your app(s). Include additional information (trusted) where appropriate.


### Auto-install ACC
### Online ACC Install

- The installer must run as root (obviously).
- Log: /sbin/.acc/install-stderr.log
Expand All @@ -311,18 +318,25 @@ which acc > /dev/null
3) Run "sh [installer]" (progress is shown)
```

### Offline ACC Install

Refer to [SETUP > Any Root Solution (Advanced)](https://github.com/VR-25/acc/tree/master#any-root-solution-advanced) and [SETUP > Notes ](https://github.com/VR-25/acc/tree/master#notes).



---
## TROUBLESHOOTING


### Charging Switch

By default, ACC cycles through all available charging control files until it finds one that works.
By default, ACC cycles through all available [charging control files](https://github.com/VR-25/acc/blob/master/acc/switches.txt) until it finds one that works.

Charging switches that support battery idle mode take precedence - allowing the device to draw power directly from the external power supply when charging is paused.

However, things don't always go well.
Some switches may be unreliable under certain conditions (e.g., screen off).
Others may hold a wakelock - causing faster battery drain - while in plugged in, not charging state.
Others may hold a [wakelock](https://duckduckgo.com/?q=wakelock) - causing faster battery drain - while in plugged in, not charging state.

Run `acc --set chargingSwitch` (or `acc -s s` for short) to enforce a particular switch.

Expand All @@ -342,7 +356,7 @@ The existence of a potential voltage control file doesn't necessarily mean it wo

### Restore Default Config

`acc --set reset`
`acc --set reset` (or `acc -s r`)


### Slow Charging
Expand All @@ -354,7 +368,7 @@ Nullify coolDownRatio (`acc --set coolDownRatio`) or change its value. By defaul

### Logs

Logs are stored at `/sbin/.acc/`. You can export all to `/sdcard/acc-logs-$device.tar.bz2` with `acc --log --export`. In addition to acc logs, the archive includes `config.txt` and `magisk.log`.
Logs are stored at `/sbin/.acc/`. You can export all to `/sdcard/acc-logs-$device.tar.bz2` with `acc --log --export`. In addition to acc logs, the archive includes `charging-ctrl-files.txt`, `charging-voltage-ctrl-files.txt`, `config.txt` and `magisk.log`.



Expand Down Expand Up @@ -389,8 +403,8 @@ Currently Supported Languages
- Portuguese (pt): partial

Translation Notes
- Translators should start with copies of `acc/strings.sh` and `README.md` - and append the appropriate language suffix to the base names - e.g., `strings_it`, `README_it`.
- Anyone is free and encouraged to open translation pull requests.
- Translators should start with copies of [acc/strings.sh](https://github.com/VR-25/acc/blob/master/acc/strings.sh) and [README.md](https://github.com/VR-25/acc/blob/master/README.md) - and append the appropriate language suffix to the base names - e.g., `strings_it`, `README_it`.
- Anyone is free and encouraged to open translation [pull requests](https://duckduckgo.com/?q=pull+request).
- Alternatively, `strings_*.sh` and `README_*.md` files can be send to the developer.


Expand Down Expand Up @@ -424,7 +438,7 @@ battery/batt_tune_fast_charge_current (default: 2100)
battery/batt_tune_input_charge_current (default: 1800)
battery/batt_tune_float_voltage (max: 43500)
battery/batt_tune_float_voltage (max: 4350)
```


Expand All @@ -446,22 +460,16 @@ battery/batt_tune_float_voltage (max: 43500)
---
## LATEST CHANGES

**2019.6.20 (201906200)**
- Additional charging control files
- Enhanced daemon reliability
- `install-current.sh` no longer requires absolute path
- Updated documentation
- wakeUnlock - auto-unlock select wakelocks after charging is disabled

**2019.6.17 (201906170)**
- Fixed: "automatic" charging switch not working

**2019.6.15 (201906150)**
- Prioritize charging switches that put the battery on idle when charging is paused - allowing the device to draw power directly from the external power supply
- Updated documentation

**2019.6.14-r1 (201906141)**
- Added `battery/batt_tune_float_voltage` (Samsung) to the list of supported voltage control files
- Enhanced log exporter (`acc -l --export`)
- Fixed: default voltage limit not restored when accd is stopped
- `From-source` installer for any root solution (install-current.sh)
- General fixes
- Major optimizations
- Redesigned `rebootOnPause`
- Update charging switches database
- Updated documentation (`assorted tips` section and more)
- Updated Portuguese translation
> Note: compatible with ACCApp 1.0.6-1.0.8
25 changes: 17 additions & 8 deletions acc/accd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exxit() {
{ dumpsys battery reset
enable_charging
/sbin/acc --voltage -; } > /dev/null 2>&1
[ -n "$1" ] && echo "$2" && exitCode=$1
[ -n "$1" ] && echo -e "$2" && exitCode=$1
echo "***EXIT $exitCode***"
exit $exitCode
}
Expand All @@ -22,7 +22,7 @@ get_value() { sed -n "s|^$1=||p" $config; }

is_charging() {

local file="" value="" isCharging=true
local file="" value="" isCharging=true wakelock=""

grep -Eiq 'dis|not' $batt/status && isCharging=false || :

Expand Down Expand Up @@ -50,6 +50,10 @@ is_charging() {
! grep -Eiq 'dis|not' $batt/status || reboot
fi
unplugged=true
# wakeUnlock
for wakelock in $(get_value wakeUnlock); do
echo $wakelock > /sys/power/wake_unlock
done
fi

# limit log size
Expand Down Expand Up @@ -84,7 +88,7 @@ disable_charging() {
else
switch_loop off not
! is_charging || switch_loop off
! is_charging || exxit 1 "(!) Unsupported device"
! is_charging || echo "(!) Failed to disable charging"
fi
fi
# cool down
Expand Down Expand Up @@ -192,10 +196,15 @@ check_compatibility() {
$(grep -Ev '#|^$' $modPath/switches.txt)
SWITCHES
else
[ -f $(get_value chargingSwitch | awk '{print $1}') ] && compatible=true
if [ -f $(get_value chargingSwitch | awk '{print $1}') ]; then
compatible=true
else
/sbin/acc --set chargingSwitch- > /dev/null
check_compatibility
return 0
fi
fi
$compatible || exxit 1 "(!) Unsupported device"
unset -f check_compatibility
$compatible || exxit 1 "(!) Unsupported device\n- Please, send the output file of acc --log --export to the developer"
}


Expand All @@ -207,7 +216,6 @@ apply_on_boot() {
[ -f $file ] && chmod +w $file && echo $value > $file || :
done
[[ "x$(get_value applyOnBoot)" == *--exit ]] && exit 0 || :
unset -f apply_on_boot
}


Expand Down Expand Up @@ -272,9 +280,10 @@ set -x
trap exxit EXIT

[ -f $modPath/module.prop ] || exxit 1 "(!) modPath not found"
unset modId
apply_on_boot
/sbin/acc --voltage apply > /dev/null 2>&1 || :
check_compatibility
unset modId
unset -f apply_on_boot check_compatibility
ctrl_charging
exit $?
3 changes: 3 additions & 0 deletions acc/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ chargingOnOffDelay=1

# English (en) and Portuguese (pt) are the main languages supported. Refer to README.md for all available languages and translation information.
language=en

# Wakelocks to unlock after pausing charging
wakeUnlock=SEC_BATTERY_VBUS f9200000.ssusb chg_wake_lock qcom_step_chg c440000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2
14 changes: 10 additions & 4 deletions acc/switches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License: GPLv3+
#
# PWD=/sys/class/power_supply
# Last updated: Thu, Jun 13, 2019
# Last updated: Thu, Jun 20, 2019

battery/charger_control 1 0
battery/charge_disable 0 1
Expand Down Expand Up @@ -32,7 +32,7 @@ battery/battery_charging_enabled 1 0
battery/batt_slate_mode 0 1
battery/store_mode 0 1
usb-parallel/charging_enabled 1 0
dc-wireless/charging_enabled 1 0
*wireless/charging_enabled 1 0
*-charger/charging_enabled 1 0
dc/input_suspend 0 1

Expand All @@ -47,10 +47,11 @@ dc/input_suspend 0 1
/sys/power/pnpmgr/battery/charging_enabled 1 0
/sys/devices/soc/soc:lge,cable_detect/lge_power/lge_cable_detect/charging_enabled 1 0
/sys/devices/soc/soc:lge,charging_controller/lge_power/lge_cc/charging_enabled 1 0
/sys/devices/qpnp-charger-*/power_supply/battery/charging_enabled 1 0
/sys/devices/platform/lge-unified-nodes/charging_completed 0 1
/sys/devices/platform/lge-unified-nodes/charging_enable 1 0

# unconfirmed
#battery/charge_control_limit_max 16 -- supposedly works with the next
battery/charge_control_limit 0 1
/sys/devices/soc.0/78b8000.i2c/i2c-4/4-006b/power_supply/ext-charger/charge_enabled 1 0
/sys/devices/soc.0/qpnp-linear-charger-8/power_supply/battery_qpnp/charging_enabled 1 0

Expand All @@ -71,3 +72,8 @@ battery/charge_control_limit 0 1
#/sys/devices/soc/soc:lge,charging_controller/lge_power/lge_cc/charge_done 0 1
#/sys/devices/soc/soc:lge,cable_detect/lge_power/lge_cable_detect/charge_done 0 1
#battery/wc_enable 1 0
#/sys/devices/platform/lge-unified-nodes/charger_incompatible 0 1

# advanced
#applyOnBoot=battery/charge_control_limit_max:16 AND chargingSwitch=battery/charge_control_limit 0 1
#applyOnBoot=/sys/class/qcom-battery/restricted_current:0 AND chargingSwitch=/sys/class/qcom-battery/restricted_charging 0 1
Loading

0 comments on commit 8813122

Please sign in to comment.