• 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*

also, declaring the value with ! can HELP, but in certain circumstances depending on the terminals operand it is not necessary.
Try declaring it, that may fix it for you.
 
i had already tried declaring it, didnt help, it say it not found too. I'm running the script on the ESTEEM, dont know if that will make a huge difference since the script to turn off and on works just fine (after changing the chmod to 755)
 
i had already tried declaring it, didnt help, it say it not found too. I'm running the script on the ESTEEM, dont know if that will make a huge difference since the script to turn off and on works just fine (after changing the chmod to 755)

It COULD, but I don't see any reason as to why it should.
Try using this, and let me know what happens...

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
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
 
I think it may be something to do with the way that busybox integrates into the Esteem vs. the connect. Don't really know, but it's worth a shot to try everything I can think of :P

Only true way to learn is to fail right xD
 
I think it may be something to do with the way that busybox integrates into the Esteem vs. the connect. Don't really know, but it's worth a shot to try everything I can think of :P

Only true way to learn is to fail right xD

right right,

tried that last one, gave me the [: not found
 
right right,

tried that last one, gave me the [: not found

hmmm, the only thing that I can possibly imagine it being at this point is an issue with access restrictions. I don't see a logical, or reason in the code that should prevent you from it working if it did before.

Guess someone else with an esteem will have to step in and try it out on that one, because I've got no clue, and my connect's down right now (doing more ROM work for the release thread.)
 
Thanks for all the help. Permissions are set to w on the max_brightness file itself, and im running the script while RO, so that I know shouldn't be messing up the script lol
 
Thanks for all the help. Permissions are set to w on the max_brightness file itself, and im running the script while RO, so that I know shouldn't be messing up the script lol

Sure, not a problem at all...just pisses me off that I can't help you solve it. Never really been the type to just be "okay" with not figuring something out. I'm sure it's going to bug the utter **** out of me until someone figures it out if I don't just go buy an esteem and do so myself :P (which I wouldn't, money's too tight atm.)
 
what's this red light your guys are talking about?

I believe that's in reference to the esteem and they're slowly sliding off track of what the initial thread was pertaining to :P
I know I've never seen a red light on my connect when it charges :o (none of the four I owned did.)
 
4?! why so many? random and of topic but I can't wait for better stable roms out for the connect I see my self having this phone for a long time
 
4?! why so many? random and of topic but I can't wait for better stable roms out for the connect I see my self having this phone for a long time

First one had a dead pixel and overheated by the time I got out of the store, second one got a dead pixel within a week, third one I bricked, but it ended up frying when it got to the store anyways, so they'll never know.

Now I'm on my fourth, and so far I just can't seem to break this one.
I've dropped it five times, once down three flights of stairs with a 3k extended battery on it, and NO external casing...not a scratch.
I've tested out many different kernel edits, rom edits, kernel/rom combos...no effect.
It hasn't had a dead pixel yet after a month or so, nor has it even gotten close to overheating.
Worst thing I've had with this one is user created errors.
AHHH good ol' PEBKAC
 
oh I see. What were the temps looking like on your previous phones and what is the highest temp ur current reached?

dunno, never gotten software to read it right, and I know that for a fact because it ALWAYS says 32c even when it was overheating, and so cold I couldn't tell the batttery was in...
 
Nice script. Works as described.
Yes you will get that error on the script app, I did what you said and just ignored the error and turned the screen off then on, and BAM it works.

NOW I feel like I am watching a movie.
 
Sure, not a problem at all...just pisses me off that I can't help you solve it. Never really been the type to just be "okay" with not figuring something out. I'm sure it's going to bug the utter **** out of me until someone figures it out if I don't just go buy an esteem and do so myself :P (which I wouldn't, money's too tight atm.)

i'm trying to learn how to script myself lol, but it seems harder when you know next to nothing.

I google, but i get no str8 answers

1- in the script, whats the word/character that opens 'max_brightness' via the string to check the value (15 or 0)? would it be that "-e" or can we use the wourd 'touch'? as in

if [ touch sys/class/leds/button-backlight/max_brightness == "0" ]; then
busybox blah blah blah......

or something similar?

2- my understanding of the script is that it goes and opens the file, checks the value and if it meets a set criteria it does something if not it does something else. I just want to understand how that translates into a script, broken down piece by piece

3- I've tried SManager to make the OFF script run on boot, but it doesnt seem to work, i guess because it runs to early and it works best if it ran after the media scan.

4- Instead of `cat, can you just use $whatever?
 
i'm trying to learn how to script myself lol, but it seems harder when you know next to nothing.

I google, but i get no str8 answers

1- in the script, whats the word/character that opens 'max_brightness' via the string to check the value (15 or 0)? would it be that "-e" or can we use the wourd 'touch'? as in

if [ touch sys/class/leds/button-backlight/max_brightness == "0" ]; then
busybox blah blah blah......

or something similar?

2- my understanding of the script is that it goes and opens the file, checks the value and if it meets a set criteria it does something if not it does something else. I just want to understand how that translates into a script, broken down piece by piece

3- I've tried SManager to make the OFF script run on boot, but it doesnt seem to work, i guess because it runs to early and it works best if it ran after the media scan.

4- Instead of `cat, can you just use $whatever?

I am new to Unix coding as of literally yesterday, so I'm not entirely sure on all of that. I guess having a background in coding helps me know what I'm trying to find when I look for it.
 
Can there be a script added instead of off or on, but an option to turn off after a few seconds or when the screen is touched?
 
damn, this really took a liking lol. Maybe we can get this incorporated into a ROM! :D haha

Not sure if you saw this, but I turned it into a toggle'able one so now you just need one widget on your homescreen. Tap for on, let script run, lock screen, do the same thing for off.

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

**NOTE** Apparently doesn't work on the esteem for some reason.
 
Not sure if you saw this, but I turned it into a toggle'able one so now you just need one widget on your homescreen. Tap for on, let script run, lock screen, do the same thing for off.

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
**NOTE** Apparently doesn't work on the esteem for some reason.
WOW, i wish i had half the knowledge you do! I mean i can only do some basic coding lol. Will have to reup script to OP!
 
WOW, i wish i had half the knowledge you do! I mean i can only do some basic coding lol. Will have to reup script to OP!

haha, thanks but I just started working with *NIX a few days ago. I'd have to say that a shell script is far from anything "pro" but it's definitely the same type of start I had when I got into WoW Server Emulation; and if that's to say anything about me if I get enough resources fast enough within the next six months I'm going to be coding ROM's by hand from source.

Was in the emulation scene for little under two years, and have people tell me all the time that they've seen my name somewhere, or my code. hell, I even have peopel that made NPC's on their servers named after me...LOL

It's kinda kewl to see people so dedicated to the ones that help them. Always feels good to know that knowledge is being put to use, yaknow.
 
I'm still trying to figure out if there's a way for us to force close the damn script terminal. Really annoying to have to close that ****er by hand since "autoclose" (of course) doesn't work.
 
haha, thanks but I just started working with *NIX a few days ago. I'd have to say that a shell script is far from anything "pro" but it's definitely the same type of start I had when I got into WoW Server Emulation; and if that's to say anything about me if I get enough resources fast enough within the next six months I'm going to be coding ROM's by hand from source.

Was in the emulation scene for little under two years, and have people tell me all the time that they've seen my name somewhere, or my code. hell, I even have peopel that made NPC's on their servers named after me...LOL

It's kinda kewl to see people so dedicated to the ones that help them. Always feels good to know that knowledge is being put to use, yaknow.
See you may have just started like me, but you have more past experience in the game lol. I appreciate how much you have helped as well as superuser!
 
Back
Top Bottom