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

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
 
Upvote 0
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.)
 
  • Like
Reactions: V SuperUser V
Upvote 0
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.)
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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!
 
Upvote 0
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.
 
Upvote 0
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!
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones