Writing to a system file

harrisc

New member
I am running linageOS 17 (Android 10} on an unlocked Huawei MediaPad M3. Magdisk is installed and MacroDroid given Super User rights, I am planning to control the charging depending on the current charge state. I need to write either 1 or 0 to file /sys/devices/platform/huawei_charger .

Setting up my macro I cannot navigate to the folder, only the Internal disk and the MicroSD card but not the system files at /sys/devices/platform/huawei_charger

How do I use MacroDroid to navigate to a system folder?
 

Endercraft

Moderator (& bug finder :D)
You can use the shell script action with root shell.
echo 0 > /sys/devices/platform/huawei_charger
You can change the 0 to be 1.
 

harrisc

New member
Using a text editor I can edit the file /sys/devices/platform/huawei_charger/enable_charger with 1 or 0 as required (note I had the file wrong above). I am trying MacroDroid script as suggested . See screenshot. I test its action. MacrDoid is given SuperUser permission but nothing changes. What have I done wrong?


Screenshot_20231021-093151_MacroDroid.png
 

Endercraft

Moderator (& bug finder :D)
You should try to use helper instead (make sure to grant root permission). Also make sure to save output of shell script in a variable for debugging.
 
Top