1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linksys WRT54GL SES LED amber light mod?

Discussion in 'Tomato Firmware' started by FattysGoneWild, Jun 18, 2009.

  1. FattysGoneWild

    FattysGoneWild LI Guru Member

    I would like to know. When wireless is in use. I would like the light to be lit up with amber. When not in use. I would like for it to be lit up in white. Any one have a script for that or does it even exist? I would even be happy as well with just the light being amber when wireless is in use and it be off when it is not being used. When I say that. Basically when no body is online using wireless. Same for the first part of my question. Any help would be greatly appreciated!
     
  2. ntest7

    ntest7 Network Guru Member

    Here's a simple script that should work. Change the "/sbin/led" lines as you wish. Just paste this into the Adminstration-Scripts-Init page.

    Valid "led" commands for the Linksys are
    led <wlan/diag/white/amber/dmz> <on/off>

    Code:
    # LED on when a wireless client is connected
    while /bin/sleep 4 ; do
    if [ "`/usr/sbin/wl assoclist`" != "" ]
     then
       /sbin/led white off
       /sbin/led amber on
     else
       /sbin/led amber off
       /sbin/led white on
    fi
    done >/dev/null 2>&1 &
     
  3. Dent

    Dent LI Guru Member

    I use the following script in the Init tab of the Scripts section. You should reboot your router after saving the script to make it take effect. The effect is
    Amber = When a wireless client is connected.
    White = When there's data being transferred wirelessly

    Code:
    #!/bin/sh
    I=`nvram get wl0_ifname`
    while sleep 1; do
    if [ "`wl assoclist`" != "" ]; then
    XFER=`ifconfig $I|grep bytes`
    if [ "$XFER" != "$PXFER" ]; then
    LED="amber on white on"
    PXFER=$XFER
    else
    LED="amber on white off"
    fi
    else
    LED="amber off white off"
    fi
    if [ "$LED" != "$PLED" ]; then
    led $LED
    PLED=$LED
    fi
    done
     
  4. Low-WRT

    Low-WRT LI Guru Member

    Code:
    #!/bin/sh
    I=`nvram get wl0_ifname`
    while sleep 20; do
    if [ "`wl assoclist`" != "" ]; then
    LED="amber on white off"
    else
    LED="amber off white on"
    fi
    done
    This should work for you. It checks every 20 sec. to see if a wireless client is connected...Checking much more than that will really overload your cpu.
    EDIT--This goes in the init script. Reboot router after saving.
     
  5. belliash

    belliash Addicted to LI Member

    I have Linksys WRT54GL 1.1 and i use tomato v1.23.8515...
    when i type led in ssh i got "Not supported", when i try to access Administartion->Buttons/LED i got "This feature is not supported on this router."

    What the hell? :|
     
  6. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Except that script wouldn't actually do anything. I think you're missing the important line where it actually sets the lights ("led $LED" after fi, probably). Currently it decides what to set the lights to, then goes to sleep and decides again.
    Plus, you don't need the "I =" if that's all you're doing. :wink:
     
  7. Low-WRT

    Low-WRT LI Guru Member

    Have you tried it? I'm almost positive that's the exact script I used when I had a GL. Granted, I am a copy & paster!:smile:
     
  8. belliash

    belliash Addicted to LI Member

    i know bash and i can confirm what SgtPepperKSU said
     
  9. premudriy

    premudriy LI Guru Member

    Hi! ntest7 has this last line in his script:
    Code:
    done >/dev/null 2>&1 &
    I've never seen anything like that. I have redirection of output to null device and & to send to background in my script like this:
    Code:
    done > /dev/null &
    So, what are those other things mean? Thanks!


    Also, here's my complete script for the same need. But I like to see white led when someone is connected. Otherwise led is off.

    Code:
    while sleep 20; do
    wificlients=$(wl assoclist)
    if [ -n "$wificlients" ] ; then
    gpio disable 2
    else
    gpio enable 2
    fi
    done > /dev/null &
     
  10. pfoomer

    pfoomer LI Guru Member

    @nest7

    I am using this script (see first thread entry) , does not appear to be overloading the cpu (0.05/0.05/0.0) is that good?
     
  11. FattysGoneWild

    FattysGoneWild LI Guru Member

    Thanks all. I tried the scripts and came up with the same problem each time. I have 20mb/2mb internet. When I go to dl a video or big file. It limits me to 1-1.2mb when dl. It does not stay consistent though. It goes up and down constantly. Dropping as low as 280kbs. Couple other users told me the cpu might be working to hard. With the script removed. I can dl at 2-2.5mb consistently every time. As for what is connected to the router. It is the following.

    1. Desktop (wired)
    2. Laptop (wireless)
    3. Xbox 360 (wired)
    4. Nintendo Wii (wireless)
    5. Directv on demand (wired)

    Once again. As for the cause. I have no clue. Other then the cpu issue possibly making sense. If it so happens to be a cpu issue. It would make no sense. Since with the stock Linksys firmware. The light stays on amber when not using secure mode with the button. It stays white how ever when using that mode. I would assume then. I would have the same issue with the stock firmware? I could be wrong though. Weird stuff.

    [​IMG]
     
  12. belliash

    belliash Addicted to LI Member

    Do You have any idea why SES led does not work for me on WRT54GL 1.1 with tomato 1.23.8515?
     
  13. FattysGoneWild

    FattysGoneWild LI Guru Member

    Reading the 1st post you made. That is odd. Because when I go to that section. It is there. Did you clear NVRAM before and after loading the firmware?

     
  14. belliash

    belliash Addicted to LI Member

    Yes, i did... :|
    there are also no files regarding ses led in /proc... strange...

    any ideas?
     
  15. FattysGoneWild

    FattysGoneWild LI Guru Member

    Strange indeed. Might wanna wait for others to chime in. Don't want to give you bad advice since I am fairly new to Tomato myself. As a last ditch effort. Maybe reflash the firmware again?
     
  16. belliash

    belliash Addicted to LI Member

    I also thought about that... and about doing thorough nvram cleaning before and after flashing... but first i decided to ask here as maybe someone would advise something else, ... maybe even someone came across that trouble too...
     
  17. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Having an LED at a particular state isn't what taxes the CPU (at all). What does it is doing all of the checks to see if we should change the LED state. Make sense?

    Have you tried increasing the sleep value in the script? If you've already tried it will a large value, like 20 or 30, then it likely isn't a CPU load problem. When you're having the issue what is the CPU load (in GUI on overview page)?
     
  18. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    2>&1 tells it to redirect the standard error (2) to standard output (1). Since you're not piping the output of this to another command, it doesn't accomplish anything. That is unless you want to just explicitly throw away the output (since no one is looking at it anyway), in which case it would need to be reversed:

    Code:
    done 2>&1 > dev/null &
    But, like I said, since no one is using the output of this, you're as well off leaving the output alone altogether:

    Code:
    done &
     
  19. pfoomer

    pfoomer LI Guru Member

    Stating the obvious

    It would appear that both you and belliash are using Viktek's version?

    If true then that is a possible common area to investigate.

    The script at the beginning of the thread works fine for me on Jon's 1.23.
     
  20. premudriy

    premudriy LI Guru Member

    Thank you for explanation, SgtPepperKSU.
     
  21. Dent

    Dent LI Guru Member

    If I change or add a script to the init section, can I force it to run right now without rebooting the modem?
     
  22. ntest7

    ntest7 Network Guru Member

    Yes, ">/dev/null 2>&1" is to explicitly discard all output from the command.

    The way I wrote it is correct. Many shells will work with it the way you show, but mine is more portable. Use syntax that works everywhere whenever possible.

    "best practice" is to explicitly discard output you don't want so that buffer space isn't used. Some shells do this automatically when not attached to a tty, but you shouldn't count on output you don't see not going somewhere.
     
  23. ntest7

    ntest7 Network Guru Member

    If you edit an existing init script, it's probably easiest to reboot the router so you don't have to track down and kill any background processes.

    To run a new script, you can telnet/ssh to the router and run
    # /tmp/script_init.sh
     
  24. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Seems you are right. I thought that the redirections were evaluated from left to right, but it looks like it is right to left. Thanks for correcting me!
    Code:
    # [I](echo "stdout"; echo "stderr" 1>&2)[/I]
    stdout
    stderr
    # [I](echo "stdout"; echo "stderr" 1>&2) > /dev/null 2>&1[/I]
    # [I](echo "stdout"; echo "stderr" 1>&2) 2>&1 > /dev/null[/I]
    stderr
    
     
  25. yoda

    yoda Addicted to LI Member

    Just tried this mod and i think it's great i was tired of turning my MS computer on and watching it blink my wifi lamp :biggrin:
     
  26. vanhh

    vanhh Network Guru Member

    Can we do this? No wireless action stay dark (no light), if there is wireless action then alternating amber and white blinking.

    thanks,
     
  27. ntest7

    ntest7 Network Guru Member

    Set the LEDs any way you want, within the limits of what the "led" command supports. The section after "then" controls "no client" behavior, the section after "else" is activated when a client is connected.

    Available led options on a Linksys include
    led <wlan/diag/white/amber/dmz> <on/off>

    and on a Buffalo
    led <wlan/diag/aoss/bridge/mystery> <on/off>

    doesn't look as if "blink" is a choice.

    (I suppose you could emulate blinking with a "led x on; sleep 1; led x off" loop, but it would likely place a heavy load on the CPU - so not a good idea)
     
  28. fluu

    fluu Networkin' Nut Member

    another script

    hi,

    I'm using Tomato 1.27.

    Under Administration -> Buttons/Leds i wanted to generate a custom Script.

    It should toggle wireless and the amber led.

    my Script so far: (but doesn't work)
    ************************************************** *****
    if [ wl radio|grep "radio is off"|wc -l -eq 1 ] ; then
    wl radio on
    led amber on
    else
    wl radio off
    led amber off
    fi
    done
    ************************************************** *****

    Any Ideas?
     
  29. Ronnie_USA

    Ronnie_USA Networkin' Nut Member

    There is an LED above the SES/AOSS Button that with stock firmware that was blue (orange is no security) when you had security enabled, is there a way to make this work again?
     
  30. wistlo

    wistlo Addicted to LI Member

    Here's a script I include in the Wan Up section, to indicate Amber when connected to the Internet, and White when connected into VPN:

    Code:
    killall laled.sh
    echo '#!/bin/sh
    VPN_ADDRESS=192.168.80.1
    EXTERNAL_SITE='GOOGLE.COM'
    while sleep 4s; do
      if ping -c 1 -W 2 ${EXTERNAL_SITE} >/dev/null
      then
        led amber on white off
      else
        led amber off white off
      fi
    if ping -c 1 -W 2 ${VPN_ADDRESS} >/dev/null
      then
        led amber off white on
      else
        led white off
      fi
    done'>/tmp/laled.sh
    sh /tmp/laled.sh &
    
    The 'killall' is not reliable, I've found, so if you bounce or restart wireless, you have to manually kill one of the scripts manually. (Reboot also kills extras).

    You know if have multiple instances of this script running if the light begins to flash erratically. (confirm via ssh console - ps command).
     
    Last edited: Apr 16, 2014

Share This Page