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

Wireless Client Script

Discussion in 'Tomato Firmware' started by Low-WRT, Mar 30, 2007.

  1. Low-WRT

    Low-WRT LI Guru Member

    Sorry if this has already been answered, but I searched and could not find anything.
    I just switched from Thibor and used a script that turned off the SES light when the wireless client was disconnected, was amber when connected, and white when transferring data. I loved that script. I could tell by walking past if anyone was connected wirelessly. Anyway, I can't get it to work on 1.06. Here it is:
    sleep 5
    #!/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="am on wh on"
    PXFER=$XFER
    else
    LED="am on wh of"
    fi
    else
    LED="am of wh of"
    fi
    if [ "$LED" != "$PLED" ]; then
    led $LED
    PLED=$LED
    fi
    done


    Any suggestions?
    Thanks in advance
     
  2. Reiper

    Reiper LI Guru Member

  3. Low-WRT

    Low-WRT LI Guru Member

    Yeah, I saw that. I was hoping someone had found a fix. I'm really pleased with Tomato so far, I really like that feature.
    Thanks
     
  4. mikester

    mikester Network Guru Member

    Do you run the script under INIT or WAN UP?
     
  5. Low-WRT

    Low-WRT LI Guru Member

    I've tried both. All I get is a constant white light.
     
  6. Low-WRT

    Low-WRT LI Guru Member

    If anyone is interested, I got this one to work for 1.06.
    I found it at the DD-WRT site:

    #!/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='gpio disable 3 ; gpio disable 2'
    PXFER=$XFER
    else
    LED='gpio disable 3 ; gpio enable 2'
    fi
    else
    LED='gpio enable 3 ; gpio enable 2'
    fi

    if [ "$LED" != "$PLED" ]; then
    eval $LED
    PLED=$LED
    fi
    done
     
  7. petch01

    petch01 LI Guru Member

    low-WRT,

    Thank you very much for this script.

    Petch01
     
  8. hammach

    hammach LI Guru Member

    does this only work on wrt54gs v3.0 or higher? if so is there a similar script that can be written for v1.1 that will disable the light if no connection enable when connection?
     
  9. Low-WRT

    Low-WRT LI Guru Member

    Mine is a GL 1.1
     
  10. hammach

    hammach LI Guru Member

    my router the wrt54gs does not have a ses led. the ses led is included in v 3.0+ so what I would like to do is write a script that toggles the wlan light to off when no connection and on when it detects a wireless connection.
     
  11. dvd-guy

    dvd-guy Guest

    Anyone got a script like this for the second router in a WDS configuration?
     
  12. ntest7

    ntest7 Network Guru Member

    In the original script, change the stuff that looks like
    am of wh of

    to
    amber off white off
    ie. don't use the abbreviations. That seems to fix it.
     
  13. ntest7

    ntest7 Network Guru Member

    Change the script to use
    wlan/diag/dmz off/on
    to use those lights instead of am (amber) or wh (white). And don't use "of" when you mean "off".

    The changed section might look like:
    ...
    if [ "$XFER" != "$PXFER" ]; then
    LED="wlan on dmz on"
    PXFER=$XFER
    else
    LED="wlan on dmz off"
    fi
    else
    LED="wlan off dmz off"
    ...

    season to taste.
     
  14. Reiper

    Reiper LI Guru Member

    Anyone know what the "difference" is between the two scripts posted on this thread? In other words does one use resources different from the other? I tried Low-WRT's script from the DD-WRT boards and it works but I noticed a substantial increase in CPU usage. Just wondering if the "fixed" hyper-WRT script is more efficient. Also the Hyper-WRT script makes more sense to me whereas the DD-WRT script uses "gpio" which I'm not familiar with?
     
  15. Reiper

    Reiper LI Guru Member

    So from what I understand ntest7 is saying, the following will work on Routers with the SES light?

    #!/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
     
  16. ntest7

    ntest7 Network Guru Member

    yes, absolutely
     
  17. hammach

    hammach LI Guru Member

    I got the script working but it pushes up my cpu load from 0.00 to 0.30+ is normal?
     
  18. ntest7

    ntest7 Network Guru Member

    Probably. That's still a very low load.

    You can reduce the impact of this script somewhat by changing the "sleep 1" to "sleep 2" at the expense of updating the LEDs every two seconds rather than every second.

    "top" might give you a better idea of the resources the script uses. On my box it looks as if the script uses about 5% of CPU time.
     
  19. Reiper

    Reiper LI Guru Member

    I don't know about anyone else but the script seems to bring my internet connection to it's knees.
     
  20. dvd-guy

    dvd-guy Guest

    The load went up to 30% as other users have reported, but it didn't affect my internet connection. The script works beautifully and adds a new layer of functionality to this already exciting router. I can now just LOOK at my router to see what's happening.
     
  21. Low-WRT

    Low-WRT LI Guru Member

    Thanks for all the help with this! I've updated my script to the "improved" one. It's working great.
    I haven't noticed any effect on my internet connection, but I'm interested in what others have to say...sorry not much help.
     
  22. ntest7

    ntest7 Network Guru Member

    A load of 0.3 does not equal 30% load. The simplified explanation is that the load shows the average length of the kernel run queue for the last 5 minutes, or an average of 0.3 processes were waiting to be run. In other words, 0.3 is a light load unlikely to be noticed.

    Google for "linux uptime load average" or similar for more detailed explanations.
     
  23. Reiper

    Reiper LI Guru Member

    By the way I'm now having problems with and w/o the script. In other words it has something to do with my ISP tonight!
     

Share This Page