A simple C program to set the charging current for your device by modifying the constant_charge_current_max
value in the sysfs directory. Ideal for rooted Android devices or Linux systems where manual tuning of charge current is needed.
- Set charging current dynamically (in milliamps).
- Automatically manages file permissions for safe writes.
- Compatible with Android (Termux) and standard Linux.
- Includes Makefile with
install
,uninstall
,info
, andrun
targets.
- Root Access — Required to modify sysfs charging parameters.
- Linux or Android — Works on rooted Android (via Termux) or any Linux-based system.
git clone https://github.com/DX4GREY/set-charge-current.git
cd set-charge-current
make
make install
This will detect your OS and install to the correct location:
- Android (Termux):
~/../usr/bin
- Linux:
/usr/local/bin
make magisk_module
Select a predefined Magisk module template to create a custom module for Android devices. This allows seamless integration with Magisk for managing charging current settings.
sudo ./setcurrent <current_in_mA>
Example:
sudo ./setcurrent 2000 # Sets charging current to 2000 mA (2A)
./setcurrent help
make uninstall
make clean
- Permission Denied: Make sure to run the binary as root (
sudo
) and ensure your device allows sysfs writes. - Invalid Argument: Your hardware might not support the value you're trying to set. Try lower values like
1000
,1500
, etc.
This project is licensed under the MIT License. See the LICENSE file for details.