Ejemplo n.º 1
0
static void win_rs232upg_start()
{
	UINT16 channel;

	OSD_SetProgressBarPos(&rs232upg_bar_progress,(INT16)0);
	OSD_SetTextFieldContent(&rs232upg_txt_progress, STRING_NUM_PERCENT, (UINT32)0);

	sys_upgrade(win_rs232upg_update,upg_check_exit_key/*UIGetExitKey*/);
	FreeSlavelist();
	if(screen_back_state == SCREEN_BACK_VIDEO)
	{
		channel = sys_data_get_cur_group_cur_mode_channel();
		api_play_channel(channel, TRUE, TRUE,FALSE);
	}
}
Ejemplo n.º 2
0
void
// do_upgrade_post(char *url, FILE *stream, int len, char *boundary)
do_upgrade_post(char *url, webs_t stream, int len, char *boundary)	// jimmy, 
									// https, 
									// 8/6/2003
{
	killall("udhcpc", SIGKILL);
#ifndef ANTI_FLASH
	char buf[1024];
	int type = 0;

	upgrade_ret = EINVAL;

	// Let below files loaded to memory
	// To avoid the successful screen is blank after web upgrade.
	// system2 ("cat /www/Success_u_s.asp > /dev/null");
	// system2 ("cat /www/Fail_u_s.asp > /dev/null");

	/*
	 * Look for our part 
	 */
	while (len > 0) {
		if (!wfgets(buf, MIN(len + 1, sizeof(buf)), stream))
			return;
		len -= strlen(buf);
		if (!strncasecmp(buf, "Content-Disposition:", 20)) {
			if (strstr(buf, "name=\"erase\"")) {
				while (len > 0 && strcmp(buf, "\n")
				       && strcmp(buf, "\r\n")) {
					if (!wfgets(buf, MIN(len + 1, sizeof(buf)), stream))
						return;
					len -= strlen(buf);
				}
				if (!wfgets(buf, MIN(len + 1, sizeof(buf)), stream))
					return;
				len -= strlen(buf);
				buf[1] = '\0';	// we only want the 1st digit
				nvram_set("sv_restore_defaults", buf);
				nvram_commit();
			} else if (strstr(buf, "name=\"file\""))	// upgrade image
			{
				type = 0;
				break;
			}
		}
	}

	/*
	 * Skip boundary and headers 
	 */
	while (len > 0) {
		if (!wfgets(buf, MIN(len + 1, sizeof(buf)), stream))
			return;
		len -= strlen(buf);
		if (!strcmp(buf, "\n") || !strcmp(buf, "\r\n"))
			break;
	}
	upgrade_ret = sys_upgrade(NULL, stream, &len, type);
	fprintf(stderr, "core upgrade done() %d\n", len);
	/*
	 * Restore factory original settings if told to. This will also cause a
	 * restore defaults on reboot of a Sveasoft firmware. 
	 */
	if (nvram_match("sv_restore_defaults", "1")) {
		system2("rm -f /usr/local/nvram/nvram.bin");
	}
	/*
	 * Slurp anything remaining in the request 
	 */
	while (len--) {
#ifdef HAVE_HTTPS
		if (do_ssl) {
			wfgets(buf, 1, stream);
		} else {
			(void)fgetc(stream);
		}
#else
		(void)fgetc(stream);
#endif

	}
#endif
	fprintf(stderr, "upgrade done()\n");

}