Results 1 to 13 of 13

Thread: How to disable the radio whenever possible

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Apr 2009
    Location
    Sofia,Bulgaria
    Posts
    29
    Hi,

    I'm not sure what this code is doing and is it necessary ?
    Code:
    while [ $C -gt 0 ]; do
    printf "\x02" > /dev/gpio/out
    sleep 1
    printf "\x00" > /dev/gpio/out
    sleep 1
    I wrote myself a short code , which can be used also if you have enabled cron. In the /usr/local/sbin/ez-setup file I wrote simple code just to switch on/off the wireless. If you remove thecomments it is only 4-5 rows.
    Code:
    #!/bin/sh
    WLAN=`wl isup`
    time=`/bin/date '+%b %e %H:%M:%S'`
    if [ "$WLAN" = "0" ]; then
        echo "$time: Wireless was down, powering up!" >> /tmp/var/log/ez-setup.log && wl radio on
        echo "$time : You have 5 minutes to  connect to the router before wireless automatically shuts down" >> /tmp/var/log/ez-setup-pressed
        sleep 300
        echo "$time : End of 5 minutes" >> /tmp/var/log/ez-setup.log
        rm /tmp/var/log/ez-setup-pressed
     else
        echo "$time: Wireless was up, powering down!" >> /tmp/var/log/ez-setup.log && 
        wl radio off
    fi
    When I press the ez-setup, it starts/stops the wireless and creates "flag" file in order to mark that the button was pressed.

    Then in the cron I start the following script to disable the wireless if it is not used. The purpose of the "flag" file is to assure that the wireless will be on for at least 5 minutes, so we can connect. Without it it may happen that we will switch on the wireless and in 10 seconds cron may stop it.
    You may put this code in a script and start it every 5 minutes using cron.
    Code:
    #!/bin/sh
    
    time=`/bin/date '+%b %e %H:%M:%S'`
    
    WLAN=`wl isup`
    if [ "$WLAN" = "0" ]; then
    #echo "$time : Wireless is already down ! " >> /opt/var/log/ez-setup.log
    exit
    fi
    
    if [ -f /tmp/var/log/ez-setup-pressed ]; then 
    #echo "$time : Stop file still exists" >> /opt/var/log/ez-setup.log 
    exit
    fi
    
    if [ $(wl assoclist | wc -l) -gt 0 ]; then 
    #echo "$time : Wireless devices still connected" >> /opt/var/log/ez-setup.log 
    exit
    fi
    
    echo "$time : Wireless automatically down " >> /tmp/var/log/ez-setup.log 
    wl radio off
    Last edited by zerg; 26-09-2009 at 21:10.

Similar Threads

  1. help pls! radio doesn't work in 1.9.7.5 firmware
    By anpspb in forum WL-500gP Q&A
    Replies: 12
    Last Post: 26-01-2008, 20:41
  2. How can I disable radio?
    By maradamc in forum WL-500gP Firmware Discussion
    Replies: 6
    Last Post: 22-01-2008, 22:19
  3. Scripting or automatic disable Radio
    By airone in forum WL-500g Q&A
    Replies: 2
    Last Post: 15-12-2005, 15:39
  4. Disable radio
    By Marrik in forum WL-500g Q&A
    Replies: 8
    Last Post: 26-02-2005, 17:04
  5. The right way to disable radio (physical)
    By mamici in forum WL-500g Q&A
    Replies: 2
    Last Post: 04-11-2004, 15:41

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •