Increasing torch power with root

Search This thread

dog77k

Senior Member
Nov 1, 2010
192
96
Texas
Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?

I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.

I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh

toggle=$(cat /sys/class/leds/led:switch/brightness)

if [ "$toggle" = "0" ];then
	echo 90 > /sys/class/leds/led:torch_0/brightness
	echo 90 > /sys/class/leds/led:torch_1/brightness
	echo 1 > /sys/class/leds/led:switch/brightness
	echo "on"
else
	echo 0 > /sys/class/leds/led:torch_0/brightness
	echo 0 > /sys/class/leds/led:torch_1/brightness
	echo 0 > /sys/class/leds/led:switch/brightness
	echo "off"
fi

Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
 

Attachments

  • flashlight_toggle_90.zip
    325 bytes · Views: 166

mains75

Senior Member
Mar 1, 2014
129
21
I tried to do the widget, but when I start it , Permission denied appears.
I have rooted device, and I gave SM manager root permissions...
 

dog77k

Senior Member
Nov 1, 2010
192
96
Texas
I tried to do the widget, but when I start it , Permission denied appears.
I have rooted device, and I gave SM manager root permissions...

Do you have the "Su" toggle turned on for that script in SM Manager? It's in the top bar when you setup the script.
 

Attachments

  • Screenshot_20170812-142657.png
    Screenshot_20170812-142657.png
    107.2 KB · Views: 269
  • Like
Reactions: mains75

mains75

Senior Member
Mar 1, 2014
129
21
Yes I have..
After some attempts It worked... Thankyou

I wonder why if I edit the 2 files manually, system resets their value after you turn on the torch with other apps...
 
Last edited:
Nov 3, 2017
7
1
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh

toggle=$(cat /sys/class/leds/led:switch/brightness)

if [ "$toggle" = "0" ];then
	echo 90 > /sys/class/leds/led:torch_0/brightness
	echo 90 > /sys/class/leds/led:torch_1/brightness
	echo 1 > /sys/class/leds/led:switch/brightness
	echo "on"
else
	echo 0 > /sys/class/leds/led:torch_0/brightness
	echo 0 > /sys/class/leds/led:torch_1/brightness
	echo 0 > /sys/class/leds/led:switch/brightness
	echo "off"
fi

Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.

Thank you - your script works well!

A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?

Thanks again.
 
Last edited:
  • Like
Reactions: dog77k

dog77k

Senior Member
Nov 1, 2010
192
96
Texas
Thank you - your script works well!

A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?

Thanks again.

Good idea. Add this line to end of the script and it will close Script Manager.

Code:
killall os.tools.scriptmanager
 

Comrade_ru

New member
Nov 13, 2013
2
0
xz1 compact

I tried to run this script on Sony XZ1 compact, but when running ScriptManager writes "No such file or directory". What am I doing wrong? ROOT mean. The path on the system and similar files exist. I turn on the SU button at startup. Help please.
 

xavier-fs

Member
Dec 31, 2018
13
0
Xiaomi Redmi Note 4
I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.

I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh

toggle=$(cat /sys/class/leds/led:switch/brightness)

if [ "$toggle" = "0" ];then
    echo 90 > /sys/class/leds/led:torch_0/brightness
    echo 90 > /sys/class/leds/led:torch_1/brightness
    echo 1 > /sys/class/leds/led:switch/brightness
    echo "on"
else
    echo 0 > /sys/class/leds/led:torch_0/brightness
    echo 0 > /sys/class/leds/led:torch_1/brightness
    echo 0 > /sys/class/leds/led:switch/brightness
    echo "off"
fi

Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Thanks for the guide, now I successfully edited my config, and I can use godly torch app to control light intensity.
 

felixby

Member
Sep 22, 2021
9
0
#!/system/bin/sh

toggle=$(cat /sys/class/leds/led:switch_0/brightness)

if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch_0/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch_0/brightness
echo "off"
fi
i edit name folder switch to worck for xz3 i tested for me is worck good and plzz i need mehtod before edit in rom like defaut
 

blackhawk

Senior Member
Jun 23, 2020
8,888
3,575
Samsung Galaxy Note 10+
Meh... bear in mind the led current was sinked at that level for a reason.
Although it goes much higher with the camera, it's only briefly.
Running it full time like that may exceed it's heat sinking capabilities and prematurely burn it out.
Everything happens for a reason... and it probably wasn't to keep you in the dark🤣
 

felixby

Member
Sep 22, 2021
9
0
script worck for me for xperia xz3 by change switch to switch_0 and i need methode for set auto by sysytem
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?

    I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.

    I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
    Code:
    #!/system/bin/sh
    
    toggle=$(cat /sys/class/leds/led:switch/brightness)
    
    if [ "$toggle" = "0" ];then
    	echo 90 > /sys/class/leds/led:torch_0/brightness
    	echo 90 > /sys/class/leds/led:torch_1/brightness
    	echo 1 > /sys/class/leds/led:switch/brightness
    	echo "on"
    else
    	echo 0 > /sys/class/leds/led:torch_0/brightness
    	echo 0 > /sys/class/leds/led:torch_1/brightness
    	echo 0 > /sys/class/leds/led:switch/brightness
    	echo "off"
    fi

    Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
    3
    I havent heard of that and touch sensitivity is really good but I think you can increase it b enabling glove mode.


    toRch not toUch :laugh:
    1
    Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?
    1
    I tried to do the widget, but when I start it , Permission denied appears.
    I have rooted device, and I gave SM manager root permissions...

    Do you have the "Su" toggle turned on for that script in SM Manager? It's in the top bar when you setup the script.
    1
    I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
    Code:
    #!/system/bin/sh
    
    toggle=$(cat /sys/class/leds/led:switch/brightness)
    
    if [ "$toggle" = "0" ];then
    	echo 90 > /sys/class/leds/led:torch_0/brightness
    	echo 90 > /sys/class/leds/led:torch_1/brightness
    	echo 1 > /sys/class/leds/led:switch/brightness
    	echo "on"
    else
    	echo 0 > /sys/class/leds/led:torch_0/brightness
    	echo 0 > /sys/class/leds/led:torch_1/brightness
    	echo 0 > /sys/class/leds/led:switch/brightness
    	echo "off"
    fi

    Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.

    Thank you - your script works well!

    A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?

    Thanks again.