• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [MOD][SCRIPT] Enable/Disable soft key LEDS *6/14/12*

bump (my last post on here)

Okay, here's what you need to do if Init.d is missing.

1. Go through the steps in the main post, download script manager, install it, give it SU permissions.
2. use root explorer to go into system/etc and CREATE the init.d folder (IMPORTANT) it needs to be in LOWER CASE
3. Browse back to the SD card, and move the two scripts to the folder you just created, then go through the sequential steps in the main post to finish installation.

Remember, even though you'll get the chmod 444 error lock the screen, and it'll work.

Please hit the "thanks" button if I helped.
 
Inside

sys/class/leds/button-backlight

Find "max_brightness"
Using root explorer or any other file manager that allows you to change permissions long press on it and check the 'write' permission for the owner. And the script should work now even after getting the error message. To turn the light back on after using the script on just lock and unlock your phone.

This permissions however will revert after a reboot is completed



EDIT: Scratch the above,
-Open the scripts provided by the OP with a text editor using root explorer
-Everywhere you see "max_brightness" (is only in there twice in ea script) change it to "brightness" (in other words, delete "max_")
-Now, save and exit
-Do this for both on and off scripts
-Problem solved, everything should work even after a reboot
-Whats happening here is 'brightness' has a rw permission by default

edit: found out its only a temporary lights out fix, the lights come back on within a few seconds
 
Here is the fix . put this inside the off script and inside the on script, the only thing you have to change inside the on script is the 'echo 0' to 'echo 15'

Then save and exit

#!/system/bin/sh
busybox mount ,rw /sys/class/leds/button-backlight/max_brightness
busybox echo 0 >sys/class/leds/button-backlight/max_brightness
busybox chmod 755 /sys/class/leds/button-backlight/max_brightness
 
Here is the fix . put this inside the off script and inside the on script, the only thing you have to change inside the on script is the 'echo 0' to 'echo 15'

Then save and exit

#!/system/bin/sh
busybox mount ,rw /sys/class/leds/button-backlight/max_brightness
busybox echo 0 >sys/class/leds/button-backlight/max_brightness
busybox chmod 755 /sys/class/leds/button-backlight/max_brightness

This is good for the lights off. But what about lights on? Change the 0 to a 15? Ill be updating the OP tonight with new links.
 
Ok, so the dilemma is, do you call T-mobile and let them know you got the goods and have not been charged so you can get the G3 Service, or do you not say anything for awhile, let the dust settle and then you call to just pay for the service because you bought it elsewhere??? wow, the possibilities...LOL

Thanks I appreciate it bro! I just haven't had the time to look into it lol. Next we need to look into changing the colors!
 
Cleaned up the code:


#!/system/bin/sh
busybox echo 0 >sys/class/leds/button-backlight/max_brightness
busybox chmod 755 /sys/class/leds/button-backlight/max_brightness
 
Okay, I'm missing a 'then' as a condition for line 10 but I don't see how. I'm tired as crap, so someone help me fix this :P

#!/system/bin/sh
if [ -e /sys/class/leds/button-backlight/max_brightness ]; then
if [ `cat /sys/class/leds/button-backlight/max_brightness` -eq 0 ]; then
busybox echo 15 >sys/class/leds/button-backlight/max_brightness
busybox chmod 755 /sys/class/leds/button-backlight/max_brightness
else
busybox echo 0 >sys/class/leds/button-backlight/max_brightness
busybox chmod 755 /sys/class/leds/button-backlight/max_brightness
fi
fi
 
LOL FUUUUUCK I'm stupid

#!/system/bin/sh
if [ -e /sys/class/leds/button-backlight/max_brightness ]; then
if [ `cat /sys/class/leds/button-backlight/max_brightness` -eq 0 ]
then
echo 15 > sys/class/leds/button-backlight/max_brightness
else
echo 0 > sys/class/leds/button-backlight/max_brightness
fi
fi

It's fixed. This toggles it

You're welcome :D
 
LOL FUUUUUCK I'm stupid

#!/system/bin/sh
if [ -e /sys/class/leds/button-backlight/max_brightness ]; then
if [ `cat /sys/class/leds/button-backlight/max_brightness` -eq 0 ]
then
echo 15 > sys/class/leds/button-backlight/max_brightness
else
echo 0 > sys/class/leds/button-backlight/max_brightness
fi
fi

It's fixed. This toggles it

You're welcome :D

didnt work for me
 
I just tested it...works absolutely fine on the Broken Out ROM.
Maybe you need to chmod on the stock, but I don't see why you would.

Created an entirely new file, and input it by hand, saved it, and named it something completely different with a new widget, and it's working so I'm not sure what to tell ya...

Make sure you're using the one in the comment saying "FUUUUCK I'm stupid." because I removed the unnecessary semicolon that was closing the argument prematurely in it - thus making it work...on my phone at least.
 
Thats exactly what it says "[: not found", as it doesnt find "[" w/o the quotations

Thought you means [: as if to be a smiley face...

As for "[:" not being found there is no colon in in the code at all, so that may be why if that's what it's saying.

Also, there's a chance that for some reason the script software you're using is detecting whitespace, which it shouldn't, so that being the case try this...

Code:
#!/system/bin/sh
if [-e /sys/class/leds/button-backlight/max_brightness]; then
if [`cat /sys/class/leds/button-backlight/max_brightness` -eq 0]
then
echo 15 > sys/class/leds/button-backlight/max_brightness
else
echo 0 > sys/class/leds/button-backlight/max_brightness
fi
fi
 
Thought you means [: as if to be a smiley face...

As for "[:" not being found there is no colon in in the code at all, so that may be why if that's what it's saying.

Also, there's a chance that for some reason the script software you're using is detecting whitespace, which it shouldn't, so that being the case try this...

Code:
#!/system/bin/sh
if [-e /sys/class/leds/button-backlight/max_brightness]; then
if [`cat /sys/class/leds/button-backlight/max_brightness` -eq 0]
then
echo 15 > sys/class/leds/button-backlight/max_brightness
else
echo 0 > sys/class/leds/button-backlight/max_brightness
fi
fi

the colon belongs to the message itself, the SManager's message.

i will give the new code a try

edit: i dont know about coding but, are you supposed to declare values, etc? like:

#!/bin/sh
# This shell script is PUBLIC DOMAIN. You may do whatever you want with it.

TOGGLE=$HOME/.toggle

if [ ! -e $TOGGLE ]; then
touch $TOGGLE
command1
else
rm $TOGGLE
command2
fi
 
[ -e not found, if i replace the [ with a { it jumps and says ] not found

I'm going to record my screen and show you everything that needs to get done here since I'm starting to think that your error is PEBKAC...
Also, as we're both learning our way through linux shell apparently I suggest you take a gander at
Linux Shell Scripting Tutorial - A Beginner's handbook

also, try (and I HIGHLY doubt that removing the flag is going to work) remove the -e and the space before the "/" so remove "-e " in line three and see if that will fix it.
 
Back
Top Bottom