Make a script?

israelsalinas14

Well-known member
Jun 17, 2011
188
3
0
Visit site
I want to make a script for disabling the leds at boot. These are the commands I got from marrz thread.

chmod 0333 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness

How can I make a script out if this. I only want it to disable the leds, no led notifications or stuff like that. Thanks
 

JerryScript

Daydream Believer
Mar 8, 2011
2,055
1,559
0
Visit site
I'm not sure if it can be done, the lights come on when you press the power button, way before any of the recovery or boot files load up.
 

israelsalinas14

Well-known member
Jun 17, 2011
188
3
0
Visit site
I'm not sure if it can be done, the lights come on when you press the power button, way before any of the recovery or boot files load up.

Well In terminal, I put su. Then this

chmod 0333 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness

And it worked. The leds never power up anymore at all. Basically what I want is a script that will disable the leds on startup.
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Well In terminal, I put su. Then this

chmod 0333 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness

And it worked. The leds never power up anymore at all. Basically what I want is a script that will disable the leds on startup.

Shell scripts are actually quite easy...

Code:
#!/system/bin/sh

chmod 0333 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness

Since you have already tested the commands in terminal that makes it that much easier ;)

The first line is required at the top of all shell scripts it's what causes the system to recognize it's a script.

Save it as something like 97nobacklight

I say 97 simply for the fact that at least most roms don't already have a script labeled 97, would be a good idea to look in /system/etc/init.d/ and confirm there is not a script labeled 97 or whatever number you set it to. Options are 01-99 where they are ran in order on bootup starting with 01 (00 might also work but I've never tried it, I see little need in such a test)

Once you have your script you can use adb to push it to your phone

Code:
adb push <script_name> /system/etc/init.d/

and set the permissions so it will work

Code:
adb shell chmod 0777 /system/etc/init.d/<script_name>

where <script_name> is whatever you named the script without the <>
 

israelsalinas14

Well-known member
Jun 17, 2011
188
3
0
Visit site
Shell scripts are actually quite easy...

Code:
#!/system/bin/sh

chmod 0333 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness

Since you have already tested the commands in terminal that makes it that much easier ;)

The first line is required at the top of all shell scripts it's what causes the system to recognize it's a script.

Save it as something like 97nobacklight

I say 97 simply for the fact that at least most roms don't already have a script labeled 97, would be a good idea to look in /system/etc/init.d/ and confirm there is not a script labeled 97 or whatever number you set it to. Options are 01-99 where they are ran in order on bootup starting with 01 (00 might also work but I've never tried it, I see little need in such a test)

Once you have your script you can use adb to push it to your phone

Code:
adb push <script_name> /system/etc/init.d/

and set the permissions so it will work

Code:
adb shell chmod 0777 /system/etc/init.d/<script_name>

where <script_name> is whatever you named the script without the <>

Thanks. I made the 97nobacklight file and put it in system-etc-init.d I reboot and leds were still on. Am I missing something? How do I set the permission.
 

vee

Well-known member
Feb 17, 2011
283
14
0
Visit site
Thanks. I made the 97nobacklight file and put it in system-etc-init.d I reboot and leds were still on. Am I missing something? How do I set the permission.
This is a PM that mmarz sent me at the time when he made the post that you're refering to.


"Download the rar file I have attached to my post. The file disablekeys.sh is the script file you are looking. To make a script run at startup, you need an app that can do this. "phone prioritizer" is one such app. There are others.

If you have a kernel that supports init.d scripts, then rename disablekeys.sh to 99disablekeys and place it inside /system/etc/init.d/
Then change the permissions on the file to "rwxrwxrwx"."
 

israelsalinas14

Well-known member
Jun 17, 2011
188
3
0
Visit site
Ok sorry if im being ignorant but its still not working. Im on bumblebee 2.4 kernel. Im using root explorer. I mounted r/w then changed permissions to rwxrwxrwx and it still doesnt work. Can I have a link to mmarz thread where he posted the disablekeys.sh? Thanks