1. Hot New Devices! HTC One M9 | Samsung Galaxy S6 | LG G4

Turn the Camera Flash LED on and off!!


  1. Lars

    Lars Well-Known Member

    If you have root here is a way to turn the Camera LED on and off for a real flashlight app. No working widget but it is based on the Desire hardware exploit from Damunix which I've adapted for the Incredible. I'm using superuser.apk but I think the unregulated su sticky method should work too.

    Install Gscript from the market, or a terminal app if you are a glutton for typing punishment every time.
    In Gscript select Menu - Add Script
    Name: LED On
    Needs SU checked and obviously Gscript has to be granted SU.
    Body: echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness
    Save it off and select Menu - Add Script again
    Name: LED Off
    Needs SU checked
    Body: echo 0 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness
    Save that one off

    Run LED On to turn it on and LED Off, well you get it. Now we just need a stand alone app that runs in SU to clean it up. In any case this is much better than the $1 app in the Market that crashes the camera and requires a reboot.

    Advertisement
    killadanny, Taylored, dgourd and 2 others like this.
  2. Lars

    Lars Well-Known Member

    Hmm seems Lamppu works too. I thought I'd done something cool. Back to my hole...
  3. corywf

    corywf Member

    Lampuu does work but crashes the camera. The script works well!
  4. paimon.soror

    paimon.soror Well-Known Member

    Nice work man! Having options is always great so even though there are other apps on the market that may or may not do the same, dont shy away from making scripts like you did above. Some people may find your script better, or maybe it will work better on their device vs other apps out there.

    Good work!
  5. yojoe600

    yojoe600 Well-Known Member

    nice work man... and yea lampuu works but at least u found another way
  6. snowzach

    snowzach Member

    Holy crap... put 255 in and look at it.. I'm still seeing little white dots...
  7. snowzach

    snowzach Member

    Looks like 128 is as bright as you can go without it shutting off automatically.. (ie working like a flash)
  8. Taylored

    Taylored Well-Known Member

    Awesome! Thanks!
  9. andreyua

    andreyua Active Member

    This is amaazziiing! I wish I could run 255 continuosly. Any tricks?
  10. Lefort1

    Lefort1 Well-Known Member

    Anyone who's tried this script, does it allow the light to stay on while video recording or does it crash?
  11. Taylored

    Taylored Well-Known Member

    Not working for me.
  12. duradrinx

    duradrinx New Member

    Echo not found errors for me... verified that I didn't mistype and su access is granted.
  13. andreyua

    andreyua Active Member

    Guys,

    Make sure you are using gscript and you allowed its SU priceledges. Oh and you obviously need root.
  14. Lars

    Lars Well-Known Member

    echo may need to be in lower case. Linux is a case sensitive OS.

    Lamppu doesn't seem to crash my camera but I'll keep trying (to crash it :) ) Yea 255 tells it just to flash. Lamppu is able to sustain the brighter mode. Maybe that's what crashes the camera after a bit?

    Thanks for the props BTW.
  15. killadanny

    killadanny Well-Known Member

    Thanks, worked perfectly.
  16. Dr_Freeman

    Dr_Freeman Member

    lamppu does not use the brighter one, i wrote a small script to loop the "255" command, it works, and also works while using the camera. however, it flickers a bit, but the main problem is that the LEDs get VERY HOT when left on 255. also i cant figure out how to turn it off short of restarting the phone.
  17. Taylored

    Taylored Well-Known Member

    I'd like to test out that loop on my phone. Would you mind posting the script or sending a PM?

    Thanks :)
  18. paimon.soror

    paimon.soror Well-Known Member

    Yikes, LED's generally shouldn't get very hot...if they are that means there is far too much voltage flowing into the diode. If running 255 makes the LED hot, chances are you want to not use that value or you may kill the diode
  19. Dr_Freeman

    Dr_Freeman Member

    sure, heres the script. USE AT YOUR OWN RISK.

    Code (Text):
    1. while true; do
    2.   out=`echo 255 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness`
    3.   done
    4.  

    this does continue to loop while the camera is on, but i wouldnt recommend it.
  20. paimon.soror

    paimon.soror Well-Known Member

    Probably uses a significant amount of cpu time too to constantly write out 0xFF to that port lol, not to mention no "nice" way to end the script

Share This Page