示例#1
0
function init_update_status_for_station($PHY_UID)
{
    if (get_phyinf_freq($PHY_UID) == 5) {
        $upwifistats_pidfile = "/var/run/upwifistats5g.pid";
        $helper_script = "/etc/scripts/upwifistatshlper_A_band.sh";
    } else {
        $upwifistats_pidfile = "/var/run/upwifistats24g.pid";
        $helper_script = "/etc/scripts/upwifistatshlper_G_band.sh";
    }
    $pid = fread("", $upwifistats_pidfile);
    if ($pid != "") {
        echo "kill " . $pid . "\n";
    }
    $upwifi_attr0 = "updatewifistats -s " . $helper_script . " -m bcm -i " . devname($PHY_UID) . " ";
    $upwifi_attr1 = "-x ";
    //for upwifistats argument (-x --> /phyinf:#)
    $upwifi_attr2 = "-r ";
    //for upwifistats argument (-r --> /runtime/phyinf:#)
    $p = XNODE_getpathbytarget("", "phyinf", "uid", $PHY_UID, 0);
    if ($p == "") {
        return;
    }
    $r = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $PHY_UID, 0);
    if ($r == "") {
        return;
    }
    $upwifi_attr1 = $upwifi_attr1 . $p . " ";
    $upwifi_attr2 = $upwifi_attr2 . $r . " ";
    $cmd = $upwifi_attr0 . $upwifi_attr1 . $upwifi_attr2 . " &";
    TRACE_error($cmd);
    echo $cmd . "\n";
    echo "echo \$! > " . $upwifistats_pidfile . "\n";
}
示例#2
0
if ($prefix == "BAND24G") {
    $upwifistats_pidfile = "/var/run/upwifistats24g.pid";
    $helper_script = "/etc/scripts/upwifistatshlper_G_band.sh";
} else {
    $upwifistats_pidfile = "/var/run/upwifistats5g.pid";
    $helper_script = "/etc/scripts/upwifistatshlper_A_band.sh";
}
/* restart upwifistats 
 * 1. kill previous pid
 * 2. get the prefix, restart the upwifistats
*/
$pid = fread("", $upwifistats_pidfile);
if ($pid != "") {
    echo "kill " . $pid . "\n";
}
$upwifi_attr0 = "updatewifistats -s " . $helper_script . "  -m RT2800 -i " . devname($prefix) . " ";
$upwifi_attr1 = "-x ";
//for upwifistats argument (-x --> /phyinf:#)
$upwifi_attr2 = "-r ";
//for upwifistats argument (-r --> /runtime/phyinf:#)
$found = 0;
/* for each interface. */
$i = 1;
while ($i > 0) {
    $uid = $prefix . "-1." . $i;
    $p = XNODE_getpathbytarget("", "phyinf", "uid", $uid, 0);
    if ($p == "") {
        $i = 0;
        break;
    }
    $r = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $uid, 0);
示例#3
0
 }
 /* special command for guestzone 
  * Guestzone interface can only be brought up IF hostzone interface HAS BEEN BROUGHT UP BEFORE ! 
  * So when we meet condition :
  * 	1. hostzone intf hasn't up
  *  2. guestzone need to up 
  *  --> We just bring the hostzone intf up and bring it down again. 
  *
  * Remember that this kind of situation happens when : 
  *  1. Hostzone is disabled from web, while guestzone is enabled. 
  *  2. Hostzone is disabled because of schedule, while guestzone is enabled.
  */
 $up = fread("", "/var/run/BAND5G-1.1.UP");
 if ($i == 2 && $active == 1 && $up == "") {
     startcmd("ip link set " . devname('BAND5G-1.1') . " up");
     startcmd("ip link set " . devname('BAND5G-1.1') . " down");
 }
 $down = fread("", "/var/run/" . $uid . ".DOWN");
 $down += 0;
 if ($down == "1") {
     startcmd("# " . $uid . " has been shutdown.");
 } else {
     if ($active != 1) {
         startcmd("# " . $uid . " is inactive!");
     } else {
         startcmd("# " . $uid . ", dev=" . $dev);
         PHYINF_setup($uid, "wifi", $dev);
         $brdev = find_brdev($uid);
         //	startcmd("ip link set ".$dev." up");
         /* bring up guestzone bridge */
         if (isguestzone($uid) == "1") {
示例#4
0
function setup_txpower($uid)
{
    $phypsts = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $uid, 0);
    $dev = devname($uid);
    if ($phypsts != "") {
        $ccka = query($phypsts . "/txpower/ccka");
        $cckb = query($phypsts . "/txpower/cckb");
        $sa = query($phypsts . "/txpower/ht401sa");
        $sb = query($phypsts . "/txpower/ht401sb");
        $sa_5G = query($phypsts . "/txpower/ht401sa_5G");
        $sb_5G = query($phypsts . "/txpower/ht401sb_5G");
    } else {
        return;
    }
    $phyp = XNODE_getpathbytarget("", "phyinf", "uid", $uid, 0);
    $txpower = query($phyp . "/media/txpower");
    if ($txpower == "70") {
        $tx_value = 3;
    } else {
        if ($txpower == "50") {
            $tx_value = 6;
        } else {
            if ($txpower == "25") {
                $tx_value = 12;
            } else {
                $tx_value = 17;
            }
        }
    }
    $max_num_24G_ch = 14 * 2;
    $max_num_5G_ch = 196 * 2;
    if ($ccka != "" && $cckb != "" && $sa != "" && $sb != "") {
        $index = 0;
        while ($index < $max_num_24G_ch) {
            $ccka_value = substr($ccka, $index, 2);
            $ccka_value = strtoul($ccka_value, 16);
            if ($ccka_value != 0) {
                if ($ccka_value - $tx_value >= 1) {
                    $ccka_value = $ccka_value - $tx_value;
                } else {
                    $ccka_value = 1;
                }
            }
            $ccka_value = dec2strf("%02x", $ccka_value);
            $pwrlevelCCK_A = $pwrlevelCCK_A . $ccka_value;
            $cckb_value = substr($cckb, $index, 2);
            $cckb_value = strtoul($cckb_value, 16);
            if ($cckb_value != 0) {
                if ($cckb_value - $tx_value >= 1) {
                    $cckb_value = $cckb_value - $tx_value;
                } else {
                    $cckb_value = 1;
                }
            }
            $cckb_value = dec2strf("%02x", $cckb_value);
            $pwrlevelCCK_B = $pwrlevelCCK_B . $cckb_value;
            $sa_value = substr($sa, $index, 2);
            $sa_value = strtoul($sa_value, 16);
            if ($sa_value != 0) {
                if ($sa_value - $tx_value >= 1) {
                    $sa_value = $sa_value - $tx_value;
                } else {
                    $sa_value = 1;
                }
            }
            $sa_value = dec2strf("%02x", $sa_value);
            $pwrlevelHT40_1S_A = $pwrlevelHT40_1S_A . $sa_value;
            $sb_value = substr($sb, $index, 2);
            $sb_value = strtoul($sb_value, 16);
            if ($sb_value != 0) {
                if ($sb_value - $tx_value >= 1) {
                    $sb_value = $sb_value - $tx_value;
                } else {
                    $sb_value = 1;
                }
            }
            $sb_value = dec2strf("%02x", $sb_value);
            $pwrlevelHT40_1S_B = $pwrlevelHT40_1S_B . $sb_value;
            $index = $index + 2;
        }
        fwrite("a", $_GLOBALS["START"], 'iwpriv ' . $dev . ' set_mib pwrlevelCCK_A=' . $pwrlevelCCK_A . '\\n');
        fwrite("a", $_GLOBALS["START"], 'iwpriv ' . $dev . ' set_mib pwrlevelCCK_B=' . $pwrlevelCCK_B . '\\n');
        fwrite("a", $_GLOBALS["START"], 'iwpriv ' . $dev . ' set_mib pwrlevelHT40_1S_A=' . $pwrlevelHT40_1S_A . '\\n');
        fwrite("a", $_GLOBALS["START"], 'iwpriv ' . $dev . ' set_mib pwrlevelHT40_1S_B=' . $pwrlevelHT40_1S_B . '\\n');
    }
    if ($sa_5G != "" && $sb_5G != "") {
        $index = 0;
        while ($index < $max_num_5G_ch) {
            $sa_value = substr($sa_5G, $index, 2);
            $sa_value = strtoul($sa_value, 16);
            if ($sa_value != 0) {
                if ($sa_value - $tx_value >= 1) {
                    $sa_value = $sa_value - $tx_value;
                } else {
                    $sa_value = 1;
                }
            }
            $sa_value = dec2strf("%02x", $sa_value);
            $pwrlevel5GHT40_1S_A = $pwrlevel5GHT40_1S_A . $sa_value;
            $sb_value = substr($sb_5G, $index, 2);
            $sb_value = strtoul($sb_value, 16);
            if ($sb_value != 0) {
                if ($sb_value - $tx_value >= 1) {
                    $sb_value = $sb_value - $tx_value;
                } else {
                    $sb_value = 1;
                }
            }
            $sb_value = dec2strf("%02x", $sb_value);
            $pwrlevel5GHT40_1S_B = $pwrlevel5GHT40_1S_B . $sb_value;
            $index = $index + 2;
        }
        fwrite("a", $_GLOBALS["START"], 'iwpriv ' . $dev . ' set_mib pwrlevel5GHT40_1S_A=' . $pwrlevel5GHT40_1S_A . '\\n');
        fwrite("a", $_GLOBALS["START"], 'iwpriv ' . $dev . ' set_mib pwrlevel5GHT40_1S_B=' . $pwrlevel5GHT40_1S_B . '\\n');
    }
}
示例#5
0
<?php

include "/etc/services/PHYINF/phywifi.php";
include "/htdocs/phplib/xnode.php";
include "/htdocs/phplib/trace.php";
$p = XNODE_getpathbytarget("", "phyinf", "uid", "BAND24G-1.1", 0);
if ($p != "") {
    $dev = devname("BAND24G-1.1");
    echo "insmod /lib/modules/rt2860v2_ap.ko\n";
}
示例#6
0
if (isfile("/usr/sbin/updatewifistats") != 1) {
    TRACE_error("/usr/sbin/updatewifistats doesn't exist \n");
    return;
}
if ($PHY_UID == "") {
    $PHY_UID = "BAND24G-1.1";
}
$prefix = cut($PHY_UID, 0, "-");
if ($prefix == "BAND24G") {
    $upwifistats_pidfile = "/var/run/upwifistats24g.pid";
    $helper_script = "/etc/scripts/upwifistatshlper_G_band.sh";
} else {
    $upwifistats_pidfile = "/var/run/upwifistats5g.pid";
    $helper_script = "/etc/scripts/upwifistatshlper_A_band.sh";
}
$dev = devname($PHY_UID);
/* restart upwifistats 
 * 1. kill previous pid
 * 2. get the prefix, restart the upwifistats
*/
$pid = fread("", $upwifistats_pidfile);
if ($pid != "") {
    echo "kill " . $pid . "\n";
}
$upwifi_attr0 = "updatewifistats -s " . $helper_script . "  -m REALTEK -i " . $dev . " ";
$upwifi_attr1 = "-x ";
//for upwifistats argument (-x --> /phyinf:#)
$upwifi_attr2 = "-r ";
//for upwifistats argument (-r --> /runtime/phyinf:#)
$found = 0;
/* for each interface. */
示例#7
0
<?php

include "/etc/services/PHYINF/phywifi.php";
include "/htdocs/phplib/xnode.php";
include "/htdocs/phplib/trace.php";
$p = XNODE_getpathbytarget("", "phyinf", "uid", "BAND5G-1.1", 0);
$p2 = XNODE_getpathbytarget("", "phyinf", "uid", "BAND24G-1.1", 0);
if ($p == "") {
    return error(9);
}
if (query($p . "/active") == 1) {
    //don't do anything at startup
} else {
    if (query($p2 . "/active") == 1) {
        /* for RT3092: the clock of RT3092 is based on RT3662, 
         * so the RT3662 must be up once for RT3092. */
        $dev = devname("BAND5G-1.1");
        echo "insmod /lib/modules/rt2860v2_ap.ko\n";
        echo "xmldbc -P /etc/services/WIFI/rtcfg.php -V PHY_UID=BAND5G-1.1 > /var/run/RT2860.dat\n";
        echo "ip link set " . $dev . " up\n";
        echo "ip link set " . $dev . " down\n";
        echo "rmmod rt2860v2_ap\n";
        error(0);
    } else {
        return error(8);
    }
}