[Script] Darkness in the dark hours

Search This thread

baz@gmx.co.uk

Senior Member
Dec 2, 2010
657
124
:eek: typo / i'm visually challenged (my eyesight is terrible!) - no offence :D love the darkness script so thanks again adolf4661 :) :rolleyes: :p
 

asmanthebell

Senior Member
May 17, 2007
453
72
hi everyone
I present to you:
Darkness in the dark hours

this is a pack of:
- a script I made
- Gscript lite
- Screen filter(optional, but recommended)

A lot of users tried to find a way to do this, so I polished my script I used for Eternity to make it universal(hopefully :p)
this script made to work with rooted 2.1+ firmwares and busybox properly installed.

1. Install Gscript lite
2. choose Add a script and name it whatever you want(e.g. NOLed) and paste these lines in it( you WILL get stderrs on 2.2+, but it's normal)
see note below
Code:
#! /system/bin/busybox sh
# "turn off keyboard and notification LEDs" for ANY android firmware
# this script needs su access
# made by Adolf1994
# thanks for the help diimaan
# maybe final version - revertable
DIR=$(cd /sys && find | grep brightness | cut -c 3- | cut -d : -f 1 | head -n 1)
LED=/sys/$DIR
LED1=$LED:rgb1:red/brightness
LED2=$LED:rgb1:green/brightness
LED3=$LED:rgb1:blue/brightness
LED4=$LED:sled/brightness
if [ -s /sbin/noled_tmp_reverse.prop ]; then
chmod 00644 $LED1
chmod 00644 $LED2
chmod 00644 $LED3
chmod 00644 $LED4
rm /sbin/noled_tmp_reverse.prop
else
echo 0 > $LED1
echo 0 > $LED2
echo 0 > $LED3
echo 0 > $LED4
chmod 00444 $LED1
chmod 00444 $LED2
chmod 00444 $LED3
chmod 00444 $LED4
echo 1 > /sbin/noled_tmp_reverse.prop
fi
exit
Note: if you get EMPTY stderrs, that's no problem. BUT if something is shown next to the stderr, like permission denied, then please report

or grab the sh file here: https://mydisk.se/adolf1994/webpage/NOLed.sh

3. run the script and enjoy surfing at night without the annoying hw leds:D

optional. install Screen filter from market: https://market.android.com/details?id=com.haxor&feature=search_result

Q: Sooo, what the hell is this exactly?
A: This pack will switch off the hw leds and set the screen's brightness to a low value, so you can enjoy using your phone at night. :)

hope you like it
and don't forget to press thanks button ;)

Your script requires

Reboot

adding at the end took me a while to make it work out,

or for others run script and reboot device enjoy


Sent from my X10x using XDA Premium App
 

Adolf1994

Senior Member
Jun 2, 2010
411
65
Fertőrákos
A standalone version of the script in OP that automagically disables leds at startup
This doesn't need anything else from first post, have fun

Code:
echo "\n\n# Darkness by Adolf1994\nDIR=$(cd /sys && find | grep brightness | cut -c 3- | cut -d : -f 1 | head -n 1)\nLED=/sys/$DIR\nLED1=$LED:rgb1:red/brightness\nLED2=$LED:rgb1:green/brightness\nLED3=$LED:rgb1:blue/brightness\nLED4=$LED:sled/brightness\necho 0 > $LED1\necho 0 > $LED2\necho 0 > $LED3\necho 0 > $LED4\nchmod 00444 $LED1\nchmod 00444 $LED2\nchmod 00444 $LED3\nchmod 00444 $LED4" >> /system/etc/hw_config.sh
 
Last edited:

CAYCE_VII

Senior Member
Feb 4, 2011
648
153
34
Seattle, WA
I get this error when running the script:

GScriptError.png


I'm using Wolf's V6 ROM and DooMLoRD's V05 Kernel w/Boot Menu

Any Ideas?:confused:
 
Last edited:

Adolf1994

Senior Member
Jun 2, 2010
411
65
Fertőrákos
@CAYCE_VII, not a single one. At a first glance it looks like you didn't tick SU permission for script.
But if you did, it could be something with how the init script in ramdisk mounts partitions. Latter case requires DoomLord's opinion. And
also please try out the one that disables at startup. It will append some lines to the end of /etc/hw_config.sh and those are required to be removed manually.

BTW, I'm still on 2.1, so any further modification will just be a shoot into the dark :p

EDIT: I slightly modified the first post to make it - hopefully - final.
 
Last edited:

CAYCE_VII

Senior Member
Feb 4, 2011
648
153
34
Seattle, WA
@CAYCE_VII, not a single one. At a first glance it looks like you didn't tick SU permission for script.
But if you did, it could be something with how the init script in ramdisk mounts partitions. Latter case requires DoomLord's opinion. And
also please try out the one that disables at startup. It will append some lines to the end of /etc/hw_config.sh and those are required to be removed manually.

BTW, I'm still on 2.1, so any further modification will just be a shoot into the dark :p

EDIT: I slightly modified the first post to make it - hopefully - final.

Is there a way to toggle them off AND on? I don't want them disabled ALL the time.

Sent from my X10i using xda premium
 

Adolf1994

Senior Member
Jun 2, 2010
411
65
Fertőrákos
for now, just let me know if the startup one works. You can remove it later.
And your case is why I modified slightly my first post.
But before you do anything, tell me please, did you give superuser permission for my script? As the comment part of it says it needs that, too.
 

CAYCE_VII

Senior Member
Feb 4, 2011
648
153
34
Seattle, WA
for now, just let me know if the startup one works. You can remove it later.
And your case is why I modified slightly my first post.
But before you do anything, tell me please, did you give superuser permission for my script? As the comment part of it says it needs that, too.

yes it has SU permissions, I'm not THAT big of a noob :p. I even deleted it from SU and RE-Granted Root access...just so you know it DOES still turn off all the LEDs but it still gives an error for some reason. I can deal with the error if it turns the LEDS OFF, i just need a script to turn them back on now...PLEASE :D
 

Adolf1994

Senior Member
Jun 2, 2010
411
65
Fertőrákos
I see, but you know, it's better to prepare for the worst :p
Walk through the steps in the updated first post. If you challange any issues, just let me know.
 

CAYCE_VII

Senior Member
Feb 4, 2011
648
153
34
Seattle, WA
I see, but you know, it's better to prepare for the worst :p
Walk through the steps in the updated first post. If you challange any issues, just let me know.

Okay so I was using an old version of the script. I was using this one.

Code:
 DIR=$(cd /sys && find | grep brightness | cut -c 3- | cut -d : -f 1 | head -n 1)
LED=/sys/$DIR
LED1=$LED:rgb1:red/brightness
LED2=$LED:rgb1:green/brightness
LED3=$LED:rgb1:blue/brightness
LED4=$LED:sled/brightness
if [ -s /sbin/noled_tmp_reverse.prop ]; then
chmod 00644 $LED1
chmod 00644 $LED2
chmod 00644 $LED3
chmod 00644 $LED4
rm /sbin/noled_tmp_reverse.prop
else
echo 0 > $LED1
echo 0 > $LED2
echo 0 > $LED3
echo 0 > $LED4
chmod 00444 $LED1
chmod 00444 $LED2
chmod 00444 $LED3
chmod 00444 $LED4
echo 1 > /sbin/noled_tmp_reverse.prop
fi
exit

The one you have up now works fine. But how can I turn them back on without rebooting?

Sent from my X10i using xda premium
 

CAYCE_VII

Senior Member
Feb 4, 2011
648
153
34
Seattle, WA
Just run the script again and wait till the LEDs light up.
Ooops, another thing I should've added to first post:eek:

alright cool! I apparently used the one you first made a WHILE ago and never updated it. and i also forgot to add:

Code:
echo "\n\n\nrm /data/noled_tmp_reverse.prop" >> /system/etc/hw_config.sh

so that would be why they werent turning back on, it just takes like 10-15 seconds for them to kick back on.

Added the script to my folder of scripts! (YO DAWG, I HERD U LIEK SCRIPTS?)
Scripts.png


i know there is 2 scripts in there and they are exactly the same but it seems more practical like this, UNLESS you have a way to have 1 script be on and 1 script be off...:D
 
Last edited:

Andre Verissimo

Senior Member
Jan 25, 2011
232
53
Achotjan ROM

I just thought people might still be interested in this, so have a bump.

Thank you for doing a so useful hack. It gave me uncountable hours of peace... :)

Now, using a recently installed Achotjan Remplacement ROM with stock kernel and Link2SD (with an ext2 partition), this hack doesn't seems to work. Someone has an idea of what can I do in order to get it working again?
 
Last edited:

keenofhiphop

Senior Member
Jul 30, 2012
1,553
413
So adolfl do you have experience in making scripts? could you make or think about one that allows me to set that my x10 s screen always shuts down when the.proximity sensor is recognizing a move?
is there a different between gingerbread and ics roms (i mean not in general but in the scripts?)
Greets

Sent from my X10i using xda app-developers app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    hi everyone
    I present to you:
    Darkness in the dark hours

    this is a pack of:
    - a script I made
    - Gscript lite
    - Screen filter(optional, but recommended)

    I strongly recommend to you to read the whole post and only then apply my script!

    A lot of users tried to find a way to do this, so I polished my script I used for Eternity to make it universal(hopefully :p)
    this script made to work with rooted 2.1+ firmwares and busybox properly installed.

    1. Install Gscript lite
    2. To make this script revertable on the newer brand of kernels, you will need to add one line to hw_config.sh (because I just don't trust init.d scripts)
    run this from adb or any terminal emulator from phone as superuser
    Code:
    echo "\n\n\nrm /data/noled_tmp_reverse.prop" >> /system/etc/hw_config.sh
    3. in Gscript choose Add a script and name it whatever you want(e.g. NOLed) and paste these lines in it
    Code:
    #! /system/bin/busybox sh
    # "turn off keyboard and notification LEDs" for ANY android firmware
    # this script needs su access
    # made by Adolf1994
    # thanks for the help diimaan
    # maybe final version - revertable
    # requires hw_config.sh modification to be properly revertable
    DIR=$(cd /sys && find | grep brightness | cut -c 3- | cut -d : -f 1 | head -n 1)
    LED=/sys/$DIR
    LED1=$LED:rgb1:red/brightness
    LED2=$LED:rgb1:green/brightness
    LED3=$LED:rgb1:blue/brightness
    LED4=$LED:sled/brightness
    if [ -s /data/noled_tmp_reverse.prop ]; then
    chmod 00644 $LED1
    chmod 00644 $LED2
    chmod 00644 $LED3
    chmod 00644 $LED4
    rm /data/noled_tmp_reverse.prop
    else
    echo 0 > $LED1
    echo 0 > $LED2
    echo 0 > $LED3
    echo 0 > $LED4
    chmod 00444 $LED1
    chmod 00444 $LED2
    chmod 00444 $LED3
    chmod 00444 $LED4
    echo 1 > /data/noled_tmp_reverse.prop
    fi
    exit
    4. tap on "Needs SU" then save

    5. run the script and enjoy surfing at night without the annoying hw leds:D
    (most likely you WILL get stderrs on 2.2+, but it's normal)
    Note: if you get EMPTY stderrs, that's no problem. BUT if something is shown next to the stderr, like permission denied, then please report

    optional. install Screen filter from market: https://market.android.com/details?id=com.haxor&feature=search_result
    This is only for 2.1 and/or 2.2. On 2.3 I experienced a problem that's I couldn't press install in package installer activity. I nearly reinstalled the whole thing. You've been warned!

    Night is over? Just run the script again and wait till the LEDs light up.


    If You Don't Like LEDs At All, This Pretty Line Will Disable Them At Startup
    http://xdaforums.com/showpost.php?p=17514012&postcount=27



    Q: Why modifying hw_config.sh?
    A: Because if you reboot your phone while the leds are off, there will remain a file that normally indicates how the script should act upon running it. That one particular file should not present after boot.

    Q: I'm on Wolfbreak's ROM. Won't that mess tweaks up?
    A: In no way. Impossible. Unless you didn't follow steps properly.


    hope you like it
    and don't forget to press thanks button ;)
    2
    I just thought people might still be interested in this, so have a bump.
    1
    Just run the script again and wait till the LEDs light up.
    Ooops, another thing I should've added to first post:eek: