Example #1
0
static void
ez_action_change_wifi2(void)
{
    int i_radio_state;

    if (get_enabled_radio_rt())
    {
        i_radio_state = 0;
    }
    else
    {
        i_radio_state = 1;
        update_svc_status_wifi2();
    }

    nvram_wlan_set_int(0, "radio_x", i_radio_state);

    logmessage("watchdog", "Perform ez-button %s %s %s", (i_radio_state) ? "enable" : "disable", "2.4GHz", "radio");

#if defined(USE_RT3352_MII)
    mlme_radio_rt(i_radio_state);
#else
    restart_wifi_rt(i_radio_state, 0);
#endif
}
Example #2
0
static void
ez_action_change_guest_wifi2(void)
{
    int i_guest_state;

    if (get_enabled_guest_rt())
    {
        i_guest_state = 0;
    }
    else
    {
        i_guest_state = 1;
        update_svc_status_wifi2();
    }

    nvram_wlan_set_int(0, "guest_enable", i_guest_state);

    logmessage("watchdog", "Perform ez-button %s %s %s", (i_guest_state) ? "enable" : "disable", "2.4GHz", "AP Guest");

    control_guest_rt(i_guest_state, 1);
}
Example #3
0
static void
ez_action_change_guest_wifi5(void)
{
#if BOARD_HAS_5G_RADIO
    int i_guest_state;

    if (get_enabled_guest_wl())
    {
        i_guest_state = 0;
    }
    else
    {
        i_guest_state = 1;
        update_svc_status_wifi5();
    }

    nvram_wlan_set_int(1, "guest_enable", i_guest_state);

    logmessage("watchdog", "Perform ez-button %s %s %s", (i_guest_state) ? "enable" : "disable", "5GHz", "AP Guest");

    control_guest_wl(i_guest_state, 1);
#endif
}
Example #4
0
static void
ez_action_change_wifi5(void)
{
#if BOARD_HAS_5G_RADIO
    int i_radio_state;

    if (get_enabled_radio_wl())
    {
        i_radio_state = 0;
    }
    else
    {
        i_radio_state = 1;
        update_svc_status_wifi5();
    }

    nvram_wlan_set_int(1, "radio_x", i_radio_state);

    logmessage("watchdog", "Perform ez-button %s %s %s", (i_radio_state) ? "enable" : "disable", "5GHz", "radio");

    restart_wifi_wl(i_radio_state, 0);
#endif
}
Example #5
0
File: rc.c Project: ff94315/rt-n56u
static void
nvram_convert_misc_values(void)
{
	char buff[64];
	int sw_mode;
#if defined (BOARD_GPIO_BTN_ROUTER)
	int i_router_switch = BTN_PRESSED;

	if (cpu_gpio_get_pin(BOARD_GPIO_BTN_ROUTER, &i_router_switch) >= 0) {
		if (i_router_switch != BTN_PRESSED)
			nvram_set_int("sw_mode", 3);
	}
#endif

	/* check router mode */
	sw_mode = nvram_get_int("sw_mode");
	if (sw_mode == 1) {
		/* Internet gateway mode */
		nvram_set_int("wan_nat_x", 1);
		nvram_set("wan_route_x", "IP_Routed");
	} else if (sw_mode == 4) {
		/* Pure router mode */
		nvram_set_int("wan_nat_x", 0);
		nvram_set("wan_route_x", "IP_Routed");
	} else if (sw_mode == 3) {
		/* AP mode (Ethernet convertor) */
		nvram_set_int("wan_nat_x", 0);
		nvram_set("wan_route_x", "IP_Bridged");
	} else {
		sw_mode = 1;
		nvram_set_int("sw_mode", 1);
		nvram_set_int("wan_nat_x", 1);
		nvram_set("wan_route_x", "IP_Routed");
	}

#if defined (BOARD_GPIO_LED_ROUTER)
	if (sw_mode != 3)
		LED_CONTROL(BOARD_GPIO_LED_ROUTER, LED_ON);
#endif

#if BOARD_HAS_5G_RADIO
	if (strlen(nvram_wlan_get(1, "ssid")) < 1)
		nvram_wlan_set(1, "ssid", DEF_WLAN_5G_SSID);

	memset(buff, 0, sizeof(buff));
	char_to_ascii(buff, nvram_wlan_get(1, "ssid"));
	nvram_wlan_set(1, "ssid2", buff);

	if (strlen(nvram_wlan_get(1, "wpa_mode")) < 1)
		nvram_wlan_set_int(1, "wpa_mode", 0);

#if BOARD_HAS_5G_11AC
	if (strlen(nvram_wlan_get(1, "gmode")) < 1)
		nvram_wlan_set_int(1, "gmode", 4); // a/n/ac Mixed

	if (nvram_wlan_get_int(1, "HT_BW") > 2)
		nvram_wlan_set_int(1, "HT_BW", 2);
#else
	if (strlen(nvram_wlan_get(1, "gmode")) < 1)
		nvram_wlan_set_int(1, "gmode", 2); // a/n Mixed

	if (nvram_wlan_get_int(1, "HT_BW") > 1)
		nvram_wlan_set_int(1, "HT_BW", 1);
#endif

	if (nvram_wlan_get_int(1, "stream_tx") > BOARD_NUM_ANT_5G_TX)
		nvram_wlan_set_int(1, "stream_tx", BOARD_NUM_ANT_5G_TX);

	if (nvram_wlan_get_int(1, "stream_rx") > BOARD_NUM_ANT_5G_RX)
		nvram_wlan_set_int(1, "stream_rx", BOARD_NUM_ANT_5G_RX);
#endif

	if (strlen(nvram_wlan_get(0, "ssid")) < 1)
		nvram_wlan_set(0, "ssid", DEF_WLAN_2G_SSID);

	memset(buff, 0, sizeof(buff));
	char_to_ascii(buff, nvram_wlan_get(0, "ssid"));
	nvram_wlan_set(0, "ssid2", buff);

	if (strlen(nvram_wlan_get(0, "gmode")) < 1)
		nvram_wlan_set_int(0, "gmode", 2); // b/g/n Mixed

	if (nvram_wlan_get_int(0, "HT_BW") > 1)
		nvram_wlan_set_int(0, "HT_BW", 1);

	if (nvram_wlan_get_int(0, "stream_tx") > BOARD_NUM_ANT_2G_TX)
		nvram_wlan_set_int(0, "stream_tx", BOARD_NUM_ANT_2G_TX);

	if (nvram_wlan_get_int(0, "stream_rx") > BOARD_NUM_ANT_2G_RX)
		nvram_wlan_set_int(0, "stream_rx", BOARD_NUM_ANT_2G_RX);

	nvram_set_temp("ntpc_counter", "0000000000");
	nvram_set_temp("login_timestamp", "0000000000");

	nvram_set_int_temp("networkmap_fullscan", 0);
	nvram_set_int_temp("link_internet", 2);
	nvram_set_int_temp("link_wan", 0);

	nvram_set_int_temp("reload_svc_wl", 0);
	nvram_set_int_temp("reload_svc_rt", 0);

	nvram_set_int_temp("usb_hotplug_ms", 0);
	nvram_set_int_temp("usb_hotplug_lp", 0);
	nvram_set_int_temp("usb_hotplug_md", 0);
	nvram_set_int_temp("usb_unplug_lp", 0);
	nvram_set_int_temp("usb_unplug_md", 0);
	nvram_set_int_temp("usb_opt_start", 0);

	nvram_set_int_temp("l2tp_wan_t", 0);
	nvram_set_int_temp("l2tp_cli_t", 0);
	nvram_set_int_temp("l2tp_srv_t", 0);
	nvram_set_int_temp("vpnc_state_t", 0);
	nvram_set_temp("deferred_wanup_t", "0000000000");
	nvram_set_temp("vpnc_dns_t", "");
	nvram_set_temp("vpnc_dom_t", "");
	nvram_set_temp("viptv_ifname", "");

	nvram_set_temp(RSTATS_NVKEY_24, (sw_mode != 3) ? IFDESC_WAN : IFDESC_LAN);
	nvram_set_temp(RSTATS_NVKEY_DM, IFDESC_WAN);

	/* setup wan0 variables */
	set_wan0_vars();
	set_wan_unit_value(0, "uptime", "0000000000");
	set_wan_unit_value(0, "dltime", "0000000000");
	set_wan_unit_value(0, "bytes_rx", "00000000000000000000");
	set_wan_unit_value(0, "bytes_tx", "00000000000000000000");
	set_wan_unit_value(0, "ifname_t", "");
	set_usb_modem_dev_wan(0, 0);
	reset_wan_vars();

	/* setup lan variables */
	reset_lan_vars();
	reset_lan_temp();

	time_zone_x_mapping();
}