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

Power LED flashes when I disable wireless from a script

Discussion in 'Tomato Firmware' started by roantw, Dec 20, 2010.

  1. roantw

    roantw Networkin' Nut Member

    I have the most recent version of Tomato on a WRT54GL v1.1

    The SES button is set up to toggle the wireless if pressed for 0-2 seconds. That works without any problems.

    I wanted to add 3 features with a script. I want wireless disabled when the router starts up, I want the white SES led to be on when wireless is on, off when it's off, and I want wireless to shut off after a period of inactivity. So I found a script on the forum, added a few details, and this is the final product, added to 'init'

    Code:
    sleep 5
    wl radio off
    
    WAIT_SECONDS=120; 
    #idlestart=0; #zero means that idle period is not started yet 
    while sleep 10; do 
      if test `wl radio | cut -f3 -d" "` == "off"; then #if radio is off 
        idlestart=0 
        led white off
      else #if radio is on
        led white on 
        if test `wl assoclist | wc -l` -eq 0; then #no connection 
          if test $idlestart -eq 0; then 
            idlestart=`date +%s` 
          else 
            currtime=`date +%s` 
            if test `expr $currtime - $idlestart` -ge $WAIT_SECONDS; then 
              wl radio off 
              idlestart=0 
            fi 
          fi 
        else 
          idlestart=0 
        fi 
      fi 
    done
    Turning the wireless off at startup works, as does the LED. But when the wireless is shut off after a period of inactivity (in this case, 2 minutes, for testing), the Power LED flashes, and continues to flash until the wireless is turned back on. Toggling the wireless with the SES button doesn't cause this problem.

    I've tried issuing the "wl radio down" command from a custom script, activated by the SES button, and the same thing happens. "wl radio out" doesn't cause the problem, but the WLAN LED stays on after that command, even though the wireless is off.

    When the built-in "Toggle Wireless" feature is issued, how does it work? If I could replicate it in my script, I think my problem would be solved.

    Thanks.
     
  2. roantw

    roantw Networkin' Nut Member

    Anyone?
     

Share This Page