1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

Turn the Camera Flash LED on and off!!


Last Updated:

  1. Lars

    Lars Well-Known Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    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 This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    Hmm seems Lamppu works too. I thought I'd done something cool. Back to my hole...
     
  3. corywf

    corywf Member

    Joined:
    May 3, 2010
    Messages:
    17
    Likes Received:
    0
    Lampuu does work but crashes the camera. The script works well!
     
  4. paimon.soror

    paimon.soror Well-Known Member

    Joined:
    Apr 29, 2010
    Messages:
    413
    Likes Received:
    76
    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

    Joined:
    Apr 14, 2010
    Messages:
    2,188
    Likes Received:
    207
    nice work man... and yea lampuu works but at least u found another way
     
  6. snowzach

    snowzach Member

    Joined:
    Apr 23, 2010
    Messages:
    17
    Likes Received:
    23
    Holy crap... put 255 in and look at it.. I'm still seeing little white dots...
     
  7. snowzach

    snowzach Member

    Joined:
    Apr 23, 2010
    Messages:
    17
    Likes Received:
    23
    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

    Joined:
    May 20, 2010
    Messages:
    691
    Likes Received:
    60
    Awesome! Thanks!
     
  9. andreyua

    andreyua Active Member

    Joined:
    May 1, 2010
    Messages:
    39
    Likes Received:
    3
    This is amaazziiing! I wish I could run 255 continuosly. Any tricks?
     
  10. Lefort1

    Lefort1 Well-Known Member

    Joined:
    Apr 23, 2010
    Messages:
    266
    Likes Received:
    26
    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

    Joined:
    May 20, 2010
    Messages:
    691
    Likes Received:
    60
    Not working for me.
     
  12. duradrinx

    duradrinx New Member

    Joined:
    May 8, 2010
    Messages:
    4
    Likes Received:
    0
    Echo not found errors for me... verified that I didn't mistype and su access is granted.
     
  13. andreyua

    andreyua Active Member

    Joined:
    May 1, 2010
    Messages:
    39
    Likes Received:
    3
    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 This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    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

    Joined:
    Apr 26, 2010
    Messages:
    847
    Likes Received:
    102
    Thanks, worked perfectly.
     
  16. Dr_Freeman

    Dr_Freeman Member

    Joined:
    Jun 6, 2010
    Messages:
    7
    Likes Received:
    0
    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

    Joined:
    May 20, 2010
    Messages:
    691
    Likes Received:
    60
    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

    Joined:
    Apr 29, 2010
    Messages:
    413
    Likes Received:
    76
    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

    Joined:
    Jun 6, 2010
    Messages:
    7
    Likes Received:
    0
    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

    Joined:
    Apr 29, 2010
    Messages:
    413
    Likes Received:
    76
    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

Loading...