1. You want that $100.00 in your pocket or an Amazon Fire TV don't you? Well here's the deal. With our new updated look we are in desperate need of an updated logo. The 'old' one has certainly served us well, but it's time. Find all the details here: bit.ly/1q0k6Wa
  2. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

Liberty Flashed, keyboard lights?

Discussion in 'Droid 2 Global Roms' started by na8flush, Mar 8, 2011.

  1. na8flush
    Offline

    na8flush New Member

    Joined:
    Feb 28, 2011
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    So, I flashed my D2G to Liberty 1.5, and I'm loving it. The Get-r-done tool worked great, awesome to see some support for the global.

    However, I've run into a few snags. Mainly, the sensors. Which I know is an issue, and has been talked to death, but the only problem I'm having with it is the keyboard backlight. I can do without bluetootk and all, I would just need to have the keyboard and soft keys light up. It's pretty damn impossible to use in the dark without em.

    So, I flashed the sensors.zip, and now the keys work great again, but the phone reboots itself all the time. I know this is an known issue, I'm just wondering if there's simply a solution for just the backlight issue, or does Fission not have this problem, because I'd be willing to switch to that if so. Thanks.
  2. na8flush
    Offline

    na8flush New Member

    Joined:
    Feb 28, 2011
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    So, answering my own question. There's a lot to read in these forums, and sometimes the 22 page thread answers a question you didn't think it would.

    Guess the backlight can't be fixed till the sensor issue is, and get-r-done is working hard on that.

    However, I found a temp solution for the soft keys not lighting up. This app will enable them manually, but not the keyboard.

    https://market.android.com/details?id=com.deskangel.adjbrightness
  3. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Here is my work around for lights. From terminal or script run as root.

    (To turn on)
    echo 1 > /sys/class/leds/keyboard-backlight/brightness
    echo 1 > /sys/class/leds/button-backlight/brightness

    (To turn off)
    echo 0 > /sys/class/leds/keyboard-backlight/brightness
    echo 0 > /sys/class/leds/button-backlight/brightness

    You can create a shortcut on your screen with an ap like "Gscript " and just toggle them on and off as needed. I still miss the sensors but at least I can see what I'm doing now.

    from D2G duh..
  4. na8flush
    Offline

    na8flush New Member

    Joined:
    Feb 28, 2011
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Awesome, that worked perfectly. A toggle makes it not so bad at all, I may go back to liberty now since fission isn't so good after trying liberty.

    You should message your fix to buryboi, the guy who's been trying to crack the sensor issue

    Sent from my DROID2 GLOBAL using DroidForums App
  5. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    I did a little more tweaking and got it so my lights come on for 15 +- seconds after keypress. This way I don't have to toggle the backlight anymore. You'll want to create a shell script on your sdcard or use an ap like "Gscript". Run this script once as root after boot. Change "sleep" value to keep the lights on longer. The script reads the keyboard press event "event4" and turns the lights on for 15 seconds.

    Code:
    while [ 1 ]
        do
            echo 0 > /sys/class/leds/keyboard-backlight/brightness
            cat /dev/input/event4|read -n 4
            echo "1" > /sys/class/leds/keyboard-backlight/brightness
        sleep 15
    done
    
    Not sure what toll this may take on the battery. But I doubt its much. Hope this helps. I look forward to seeing a final fix soon.

    from D2G duh..
    Last edited: Mar 15, 2011
  6. Lunatics
    Offline

    Lunatics New Member

    Joined:
    Dec 26, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Hey baker, just wondering if we use that does the phone not reboot itself constantly and we can always have the keyboard lights without having to constantly toggle on/off? If so I will totally be going to liberty because I can live without all of the other sensors.
  7. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Yes. Just flash Liberty, flash Romer, flash sensor toggle ( to turn off sensors ). Then create a shell script and run it from terminal or Gscript as my post describes. You will need to run the script every time you reboot your phone. I'm sure there is a way to run it at startup but it would probably require you to remout your /system files and change things. So its safe to just run the script manually. I don't want to be the guy that tells you to mess up your phone :icon_eek:. If you are curious you can also create scripts for other input events useing this method.

    Try soft keys.

    Code:
    while [ 1 ]
        do 
            echo 0 > /sys/class/leds/button-backlight/brightness
            cat /dev/input/event3|read -n 4
            echo 1 > /sys/class/leds/button-backlight/brightness
        sleep 15
    done
    
    Again this fixes just the keyboard and softkey lights on the phone. It does not fix your sensors. so toggle them off when you flash your Rom with GET-R-DONE tools. That way you don't reboot every time the phone gets tired.
    Last edited: Mar 15, 2011
  8. Lunatics
    Offline

    Lunatics New Member

    Joined:
    Dec 26, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    I copied your script but get an error when I try and run it and it doesn't work. "While[1] not found" and "syntax error do unexpected".
    Last edited: Mar 15, 2011
  9. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Lunatics sory for the error change it to ( while [ 1 ] ) at the start of the script that should do it. I think it just needs a space between while and braces.

    from D2G duh..
  10. buryboi
    Offline

    buryboi Premium Member Premium Member Developer

    Joined:
    Dec 20, 2009
    Messages:
    234
    Likes Received:
    0
    Trophy Points:
    0
    Great job! I'll incorporate this into the Romer and set it to run on boot.
  11. Lunatics
    Offline

    Lunatics New Member

    Joined:
    Dec 26, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    I still get the same 2 errors with a space, only the first one says "While [ not found".
  12. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    I've fixed the errors in the script above
    Try to copy/paste that again. "The first one for keyboard"
    Then reboot before you run it.

    from D2G duh..
  13. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Awesome! if you do. use the fixed one it works better to have the light off command before the event check.
    Last edited: Mar 15, 2011
  14. Lunatics
    Offline

    Lunatics New Member

    Joined:
    Dec 26, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Hm, now the soft button lights are coming on but getting an error "read Illegal option -n" and the keyboard doesn't light up.
  15. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    ok Lunatics stick with it I swear it works lol. here do this one.

    Code:
    while [ 1 ]
        do
            echo 0 > /sys/class/leds/keyboard-backlight/brightness
            cat /dev/input/event4|read -n 4
            echo "1" > /sys/class/leds/keyboard-backlight/brightness
        sleep 15
    done
    
    also are you running from a terminal or from Gscript ?
  16. Lunatics
    Offline

    Lunatics New Member

    Joined:
    Dec 26, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Error message still comes up for whatever reason with that one however both lights work now, thanks a lot. Also I'm using Gscript.
  17. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Excellent. The error is probably because Gscript is executing before its granted root. Make sure the box for use root is checked. You can also ad the command "su" at the start of the sript to be sure.

    from D2G duh..
  18. buryboi
    Offline

    buryboi Premium Member Premium Member Developer

    Joined:
    Dec 20, 2009
    Messages:
    234
    Likes Received:
    0
    Trophy Points:
    0
    @baker,

    What I've got is a script that starts the two light scripts, it looks like this:

    Code:
    #!/system/bin/sh
    keyboardlights.sh
    
    softkeylights.sh
    Because each of the light scripts are open ended while scripts, the first one starts, but never loads the second one.

    You seem like you know a bit about scripts, what can I do to make it start the first light script and then continue on to the next one.

    Edit: Nevermind,

    Code:
    nohup keyboardlights.sh &
    nohup softkeylights.sh &
    fixed it!

    Romer_v7 released in the original Thread Here
    Last edited: Mar 15, 2011
  19. baker1md
    Offline

    baker1md New Member

    Joined:
    Mar 7, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Nice solution! I'm happy I could help out with romer 7. This is great stuff.

    My fix incapsulated both events in functions of the same script droped that into /system/etc/init.d and created a config file for timeout variable adjustment I'm working on a script to change config values from terminal so I can keep the files on the ro mount. If you want ill upload them once I'm sure they are bugless. wow! great day off for me hacking out my droid.


    from D2G duh..
  20. buryboi
    Offline

    buryboi Premium Member Premium Member Developer

    Joined:
    Dec 20, 2009
    Messages:
    234
    Likes Received:
    0
    Trophy Points:
    0
    Sounds great!! Thanks again for coming up with this fix! Makes the Roms much more usable.
Search tags for this page

echo 1> /sys/class/leds/keyboard-backlight/brightness

,
how find /sys/class/leds/keyboard-backlight/brightness