Beispiel #1
0
static void watchdog(void)
{
	int brand = getRouterBrand();
	int registered = -1;
	int radiostate0 = -1;
	int oldstate0 = -1;
	int radiostate1 = -1;
	int oldstate1 = -1;
	int counter = 0;
	int radioledinitcount = 0;
	int fd = open("/dev/misc/watchdog", O_WRONLY);
	if (fd == -1)
	    fd = open("/dev/watchdog", O_WRONLY);

	if (fd == -1) {
		return;
	}
	
#ifdef HAVE_MADWIFI
	int cnt = getdevicecount();
#else
	int cnt = get_wl_instances();
#endif
	
	
	while (1) {
		write(fd, "\0", 1);
		fsync(fd);

#ifdef HAVE_REGISTER
		if (!nvram_match("flash_active", "1")) {
			if (registered == -1)
				registered = isregistered_real();
			if (!registered)
				isregistered();	//to poll
		}
#endif
		/* 
		 * software wlan led control 
		 */
		if (radioledinitcount < 5) {
			radioledinitcount++;
			oldstate0 = -1;
			oldstate1 = -1;
		}
		 
#ifdef HAVE_MADWIFI
		if (!nvram_match("flash_active", "1")) {
			radiostate0 = get_radiostate("ath0");
			if (cnt == 2)
				radiostate1 = get_radiostate("ath1");
		}
#else
		wl_ioctl(get_wl_instance_name(0), WLC_GET_RADIO, &radiostate0, sizeof(int));
		if (cnt == 2)
			wl_ioctl(get_wl_instance_name(1), WLC_GET_RADIO, &radiostate1, sizeof(int));
#endif

		if (radiostate0 != oldstate0) {
#ifdef HAVE_MADWIFI
			if (radiostate0 == 1)
#else
			if ((radiostate0 & WL_RADIO_SW_DISABLE) == 0)
#endif
				led_control(LED_WLAN0, LED_ON);
			else {
				led_control(LED_WLAN0, LED_OFF);
#ifndef HAVE_MADWIFI
				/* 
				 * Disable wireless will cause diag led blink, so we want to
				 * stop it. 
				 */
				if (brand == ROUTER_WRT54G)
					diag_led(DIAG, STOP_LED);
				/* 
				 * Disable wireless will cause power led off, so we want to
				 * turn it on. 
				 */
				if (brand == ROUTER_WRT54G_V8)
					led_control(LED_POWER, LED_ON);
#endif
			}
			
			oldstate0 = radiostate0;
		}

		if (radiostate1 != oldstate1) {
#ifdef HAVE_MADWIFI
			if (radiostate1 == 1)
#else
			if ((radiostate1 & WL_RADIO_SW_DISABLE) == 0)
#endif
				led_control(LED_WLAN1, LED_ON);
			else {
				led_control(LED_WLAN1, LED_OFF);
			}

			oldstate1 = radiostate1;
		}
		/* 
		 * end software wlan led control 
		 */

		sleep(10);
		if (nvram_match("warn_enabled", "1")) {
			counter++;
			if (!(counter % 60))
				system("notifier&");	// 
		}
	}
}
Beispiel #2
0
void ej_get_firmware_version(webs_t wp, int argc, char_t ** argv)
{
#if defined(HAVE_ESPOD) || defined(HAVE_ONNET) || defined(HAVE_IMMERSIVE) || defined(HAVE_HDWIFI)
	char *p;
	char string[32], date[16];
	sprintf(string, CYBERTAN_VERSION);
	p = strtok(string, "(");
	if (p != NULL) {
		p = strtok(NULL, ")");
		if (p != NULL) {
			sprintf(date, "%s", p);
		}
	}
#endif
#ifdef HAVE_BUFFALO
	websWrite(wp, "%s%s %s%s", CYBERTAN_VERSION, MINOR_VERSION, nvram_safe_get("dist_type"), DIST_OPT);
#else

#ifdef HAVE_REGISTER
	if (isregistered() && !isregistered_real()) {
		websWrite(wp, "Click here to ACTIVATE %d Hour Trial", getTrialCount());
	} else
#endif
	{
#ifdef HAVE_WIKINGS
#ifdef HAVE_SUB3
#define V "ExcelMed"
#elif HAVE_SUB6
#define V "ExcelMin"
#else
#define V "Excellent"
#endif
		websWrite(wp, "Excel Networks (%s series) V 2.10", V);
#undef V
#elif HAVE_ESPOD
#ifdef HAVE_SUB3
#define V "A600"
#elif HAVE_SUB6
#define V "A1000"
#else
#define V "MIMO"
#endif
		if (argc == 2) {
			websWrite(wp, "ESPOD v1.0611 (%s) / ESPOD %s Series", date, V);
		} else {
			websWrite(wp, "ESPOD v1.0611 (%s)</a><div>\");document.write(\"<div class=\\\"info\\\">Device: ESPOD %s Series<a>", date, V);
		}
#undef V
#elif HAVE_CARLSONWIRELESS
		websWrite(wp, "Carlson Wireless v5.3 (%s)", SVN_REVISION);
#elif HAVE_IMMERSIVE
		if (argc == 2) {
			websWrite(wp, "Build date %s", date);
		} else {
			websWrite(wp, "SUPPORT %s (%s)", SVN_REVISION, date);
		}
#elif HAVE_HDWIFI
		if (argc == 2) {
			websWrite(wp, "Build date %s", date);
		} else {
			websWrite(wp, "HDWIFI r%s (%s)", SVN_REVISION, date);
		}
#elif HAVE_IPR
		websWrite(wp, "IPR-CP v1.0 (%s)", SVN_REVISION);
#elif HAVE_ONNET_BLANK
		websWrite(wp, "Enterprise AP (%s)", date);
#elif HAVE_ONNET
		if (nvram_match("DD_BOARD", "Atheros Hornet")) {
			websWrite(wp, "OTAi 9331 (%s)", date);
		} else if (nvram_match("DD_BOARD", "Compex WPE72")) {
			websWrite(wp, "OTAi 724 (%s)", date);
		} else if (nvram_match("DD_BOARD", "ACCTON AC622")) {
			if (iscpe()) {
				websWrite(wp, "OTAi 724S (%s)", date);
			} else {
				websWrite(wp, "OTAi 724AP (%s)", date);
			}
		} else if (nvram_match("DD_BOARD", "ACCTON AC722")) {
			if (iscpe()) {
				websWrite(wp, "OTAi 724S (%s)", date);
			} else {
				websWrite(wp, "OTAi 724AP (%s)", date);
			}
		} else if (nvram_match("DD_BOARD", "Compex WP546")) {
			websWrite(wp, "OTAi 724S (%s)", date);
		} else {
			websWrite(wp, "OTAi %s (%s)", nvram_get("DD_BOARD"), date);
		}
#elif HAVE_KORENRON
		websWrite(wp, "KORENRON %s %s%s", MINOR_VERSION, nvram_safe_get("dist_type"), DIST_OPT);
#elif HAVE_SANSFIL
		websWrite(wp, "SANSFIL %s %s%s", MINOR_VERSION, nvram_safe_get("dist_type"), DIST_OPT);
#else
		websWrite(wp, "%s%s %s%s", CYBERTAN_VERSION, MINOR_VERSION, nvram_safe_get("dist_type"), DIST_OPT);
#endif
	}
#endif
}