示例#1
0
int 
start_wps_method(void)
{
	if(getpid()!=1) {
		notify_rc("start_wps_method");
		return 0;
	}

	start_wsc();
}
示例#2
0
int 
start_wps_method(void)
{
	if(getpid()!=1) {
		notify_rc("start_wps_method");
		return 0;
	}

#ifdef RTCONFIG_WPS_ENROLLEE
	if (nvram_match("wps_enrollee", "1"))
		start_wsc_enrollee();
	else
#endif
		start_wsc();

	return 0;
}
示例#3
0
static void catch_sig(int sig)
{
	if (sig == SIGUSR1)
	{
		dbg("[watchdog] Catch SIGUSR1 for rc_service\n");
		if (nvram_get("rc_service"))
			service_handle();
	}
	else if (sig == SIGUSR2)
	{
//		dbg("[watchdog] Catch Reset to Default Signal 2\n");
	}
	else if (sig == SIGTSTP && !nvram_match("sw_mode_ex", "3"))
	{
		if (nvram_match("wps_oob_flag", "1"))
		{
#if defined (W7_LOGO) || defined (WIFI_LOGO)
			if (nvram_match("wps_band", "0"))
				if (nvram_match("wl_radio_x", "0"))
					return;
			else
				if (nvram_match("rt_radio_x", "0"))
					return;
#else
#if 0
			if (nvram_match("wl_radio_x", "0") || nvram_match("rt_radio_x", "0"))
#else
			if (nvram_match("wl_radio_x", "0") && nvram_match("rt_radio_x", "0"))
#endif
				return;
#endif
#if (!defined(W7_LOGO) && !defined(WIFI_LOGO))
			nvram_set("wps_triggered", "1");	// psp fix
			count_to_stop_wps = 0;
#endif
			nvram_set("wps_oob_flag", "0");
			wsc_timeout = 0;
			btn_pressed_setup = BTNSETUP_NONE;
			btn_count_setup = 0;
			LED_CONTROL(LED_POWER, LED_ON);
			alarmtimer(NORMAL_PERIOD, 0);

#if defined (W7_LOGO) || defined (WIFI_LOGO)
			if (nvram_match("wps_band", "0"))
				wps_oob();
			else
				wps_oob_2g();
#else
			wps_oob_both();
#endif
			WscStatus_old = -1;
			WscStatus_old_2g = -1;
		}
		else if (nvram_match("wps_start_flag", "3") || nvram_match("wps_start_flag", "4"))	// let the SW push button be the same as the HW push button
		{
#if defined (W7_LOGO) || defined (WIFI_LOGO)
			if (nvram_match("wps_band", "0"))
				if (nvram_match("wl_radio_x", "0"))
					return;
			else
				if (nvram_match("rt_radio_x", "0"))
					return;
#else
#if 0
			if (nvram_match("wl_radio_x", "0") || nvram_match("rt_radio_x", "0"))
#else
			if (nvram_match("wl_radio_x", "0") && nvram_match("rt_radio_x", "0"))
#endif
				return;
#endif
//			if (nvram_match("wl_radio_x", "1"))
			stop_wsc();
//			if (nvram_match("rt_radio_x", "1"))
			stop_wsc_2g();
			nvram_set("wps_enable", "0");
#if (!defined(W7_LOGO) && !defined(WIFI_LOGO))
			nvram_set("wps_triggered", "1");	// psp fix
			count_to_stop_wps = 0;
			if (nvram_match("wps_start_flag", "3"))
                                nvram_set("wps_band", "1");
                        else
				nvram_set("wps_band", "0");
#endif
			nvram_set("wps_start_flag", "0");
			alarmtimer(NORMAL_PERIOD, 0);
			btn_pressed_setup = BTNSETUP_START;
			btn_count_setup = 0;
			btn_count_setup_second = 0;
#if defined (W7_LOGO) || defined (WIFI_LOGO)
			if (nvram_match("wps_band", "0"))
				start_wsc_pbc();
			else
				start_wsc_pbc_2g();
#else
#if 0
			start_wsc_pbc_both();
#else
			if (nvram_match("wps_band", "1"))
				start_wsc_pbc_2g();
			else
				start_wsc_pbc();
#endif
#endif
			WscStatus_old = -1;
			WscStatus_old_2g = -1;
			wsc_timeout = 120*20;
			alarmtimer(0, RUSHURGENT_PERIOD);
		}
		else if (nvram_match("wps_enable", "0"))
		{
#if (!defined(W7_LOGO) && !defined(WIFI_LOGO))
			nvram_set("wps_triggered", "1");	// psp fix
			count_to_stop_wps = 0;
#endif
			wsc_timeout = 1;
			btn_pressed_setup = BTNSETUP_NONE;
			btn_count_setup = 0;
			LED_CONTROL(LED_POWER, LED_ON);
			alarmtimer(NORMAL_PERIOD, 0);
//			if (nvram_match("wps_band", "0"))
//				if (nvram_match("wl_radio_x", "1"))
					stop_wsc();
//			else
//				if (nvram_match("rt_radio_x", "1"))
					stop_wsc_2g();
		}
		else if (nvram_match("wps_start_flag", "1"))
		{
			if (nvram_match("wps_band", "0"))
				if (nvram_match("wl_radio_x", "0"))
					return;
			else
				if (nvram_match("rt_radio_x", "0"))
					return;

#if (!defined(W7_LOGO) && !defined(WIFI_LOGO))
			nvram_set("wps_triggered", "1");	// psp fix
			count_to_stop_wps = 15;
#endif
			nvram_set("wps_start_flag", "0");

			wsc_timeout = 1;
			btn_pressed_setup = BTNSETUP_NONE;
			btn_count_setup = 0;
			LED_CONTROL(LED_POWER, LED_ON);
			alarmtimer(NORMAL_PERIOD, 0);

			WscStatus_old = -1;
			WscStatus_old_2g = -1;
			if (nvram_match("wps_band", "0"))
				start_wsc();
			else
				start_wsc_2g();
		}
		else if (nvram_match("wps_start_flag", "2"))
		{
			if (nvram_match("wps_mode", "1"))
			{
				if (nvram_match("wps_band", "0"))
					if (nvram_match("wl_radio_x", "0"))
						return;
				else
					if (nvram_match("rt_radio_x", "0"))
						return;
			}
			else
			{
#if defined (W7_LOGO) || defined (WIFI_LOGO)
				if (nvram_match("wps_band", "0"))
					if (nvram_match("wl_radio_x", "0"))
						return;
				else
					if (nvram_match("rt_radio_x", "0"))
						return;
#else
#if 0
				if (nvram_match("wl_radio_x", "0") || nvram_match("rt_radio_x", "0"))
#else
				if (nvram_match("wl_radio_x", "0") && nvram_match("rt_radio_x", "0"))
#endif
					return;
#endif
			}

#if (!defined(W7_LOGO) && !defined(WIFI_LOGO))
			nvram_set("wps_triggered", "1");	// psp fix
			count_to_stop_wps = 0;
#endif
			nvram_set("wps_start_flag", "0");
			alarmtimer(NORMAL_PERIOD, 0);
			btn_pressed_setup = BTNSETUP_START;
			btn_count_setup = 0;

			if (nvram_match("wps_mode", "1"))
			{
				if (nvram_match("wps_pin_web", ""))
				{
					if (nvram_match("wps_band", "0"))
						wps_pin("0");
					else
						wps_pin_2g("0");
				}
				else
				{
					if (nvram_match("wps_band", "0"))
						wps_pin(nvram_safe_get("wps_pin_web"));
					else
						wps_pin_2g(nvram_safe_get("wps_pin_web"));
				}
			}
			else
			{
#if defined (W7_LOGO) || defined (WIFI_LOGO)
				if (nvram_match("wps_band", "0"))
					wps_pbc();
				else
					wps_pbc_2g();
#else
#if 0
				wps_pbc_both();
#else
				nvram_set("wps_band", "1");
				wps_pbc_2g();
#endif
#endif
			}

			WscStatus_old = -1;
			WscStatus_old_2g = -1;
			wsc_timeout = 120*20;
			alarmtimer(0, RUSHURGENT_PERIOD);
		}
	}
	else if (sig == SIGTTIN)
	{
		wsc_user_commit();
	}
}