1. Download our Official Android App: Forums for Android!

Root Turn the Camera Flash LED on and off!!

Discussion in 'Android Devices' started by Lars, Jun 17, 2010.

  1. Lars

    Lars Android Expert
    Thread Starter
    Rank:
    None
    Points:
    163
    Posts:
    1,439
    Joined:
    Mar 24, 2010

    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 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    163
    Posts:
    1,439
    Joined:
    Mar 24, 2010

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

    corywf Newbie
    Rank:
    None
    Points:
    15
    Posts:
    17
    Joined:
    May 3, 2010

    May 3, 2010
    17
    0
    15
    Lampuu does work but crashes the camera. The script works well!
     
  4. paimon.soror

    paimon.soror Android Enthusiast
    Rank:
    None
    Points:
    73
    Posts:
    413
    Joined:
    Apr 29, 2010

    Apr 29, 2010
    413
    76
    73
    Software Engineer
    Vernon, CT
    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 Android Expert
    Rank:
    None
    Points:
    143
    Posts:
    2,188
    Joined:
    Apr 14, 2010

    Apr 14, 2010
    2,188
    207
    143
    College Student
    NC
    nice work man... and yea lampuu works but at least u found another way
     
  6. snowzach

    snowzach Newbie
    Rank:
    None
    Points:
    18
    Posts:
    17
    Joined:
    Apr 23, 2010

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

    snowzach Newbie
    Rank:
    None
    Points:
    18
    Posts:
    17
    Joined:
    Apr 23, 2010

    Apr 23, 2010
    17
    23
    18
    Looks like 128 is as bright as you can go without it shutting off automatically.. (ie working like a flash)
     
  8. Taylored

    Taylored Android Enthusiast
    Rank:
    None
    Points:
    78
    Posts:
    689
    Joined:
    May 20, 2010

    May 20, 2010
    689
    60
    78
    IT Recruiter
    GA
    Awesome! Thanks!
     
  9. andreyua

    andreyua Member
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    May 1, 2010

    May 1, 2010
    39
    3
    16
    This is amaazziiing! I wish I could run 255 continuosly. Any tricks?
     
  10. Lefort1

    Lefort1 Android Enthusiast
    Rank:
    None
    Points:
    43
    Posts:
    266
    Joined:
    Apr 23, 2010

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

    Taylored Android Enthusiast
    Rank:
    None
    Points:
    78
    Posts:
    689
    Joined:
    May 20, 2010

    May 20, 2010
    689
    60
    78
    IT Recruiter
    GA
    Not working for me.
     
  12. duradrinx

    duradrinx Lurker
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    May 8, 2010

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

    andreyua Member
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    May 1, 2010

    May 1, 2010
    39
    3
    16
    Guys,

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

    Lars Android Expert
    Thread Starter
    Rank:
    None
    Points:
    163
    Posts:
    1,439
    Joined:
    Mar 24, 2010

    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 Android Expert
    Rank:
    None
    Points:
    93
    Posts:
    847
    Joined:
    Apr 26, 2010

    Apr 26, 2010
    847
    102
    93
    Thanks, worked perfectly.
     
  16. Dr_Freeman

    Dr_Freeman Lurker
    Rank:
    None
    Points:
    25
    Posts:
    7
    Joined:
    Jun 6, 2010

    Jun 6, 2010
    7
    0
    25
    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 Android Enthusiast
    Rank:
    None
    Points:
    78
    Posts:
    689
    Joined:
    May 20, 2010

    May 20, 2010
    689
    60
    78
    IT Recruiter
    GA
    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 Android Enthusiast
    Rank:
    None
    Points:
    73
    Posts:
    413
    Joined:
    Apr 29, 2010

    Apr 29, 2010
    413
    76
    73
    Software Engineer
    Vernon, CT
    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 Lurker
    Rank:
    None
    Points:
    25
    Posts:
    7
    Joined:
    Jun 6, 2010

    Jun 6, 2010
    7
    0
    25
    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 Android Enthusiast
    Rank:
    None
    Points:
    73
    Posts:
    413
    Joined:
    Apr 29, 2010

    Apr 29, 2010
    413
    76
    73
    Software Engineer
    Vernon, CT
    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...