Was gonna keep this private but someone requested it 🤷♂️ sooo don't complain about it being stupid or anything. However issues are welcome.
Since this script is made public, I made things a bit more convenient by storing literally everything in a variable. If you need to override any of the stock value, simply add the variable(s) that you want to override in battery.conf file so that you won't have to modify the script.
- Download the script:
curl https://raw.githubusercontent.com/Hakimi0804/battery/master/battery.sh -so battery.sh
- Execute it:
bash battery.sh
Use the script's config manager to change design capacity:
bash battery.sh -c set design_capacity your_device_design_capacity
Just like design capacity, you can override the path. Most of the time this line should fix it:
bash battery.sh -c set path_voltage_usb "/sys/class/power_supply/usb/voltage_now"
- If the voltage is too small, you'll need to set the voltage unit to milivolt
- If the voltage is too large, you'll need to set the voltage unit to microvolt
Use one of the following lines depending on what voltage is broken (battery voltage/USB voltage)
bash battery.sh -c set config_voltage_unit "microvolt/milivolt"
bash battery.sh -c set config_voltage_unit_usb "microvolt/milivolt"
Arguement to pass: -u
, --update
bash battery.sh -u
or
bash battery.sh --update
You can override default value by adding them to a file named battery.conf. In addition, you can use the provided tool to achieve that.
Arguements to pass: -c
, --config
<set/unset/get>
[value]
Available actions: set, unset, get
Examples:
bash battery.sh -c set path_voltage_usb /sys/class/power_supply/usb/voltage_now
bash battery.sh -c unset path_voltage_usb
bash battery.sh -c get path_voltage_usb
nodepath="/sys/class/power_supply/battery"
default_nodepath="$nodepath"
design_capacity=4300
config_enable_vooc=1
config_voltage_unit="microvolt"
config_voltage_usb_unit="milivolt"
config_force_allow_for_non_termux=false
path_current="$nodepath/current_now"
path_voltage="$nodepath/voltage_now"
path_voltage_usb="$nodepath/../usb/device/ADC_Charger_Voltage"
path_capacity="$nodepath/capacity"
path_status="$nodepath/status"
path_temp="$nodepath/temp"
path_voocchg_ing="$nodepath/voocchg_ing"
path_fastcharger="$nodepath/fastcharger"
path_batt_fcc="$nodepath/batt_fcc"
- myself
- 🤷♂️
- 🤷♂️
- 🤷♂️