示例#1
0
EXPORT gboolean burn_all_helper(void *data, XmlCmdType type)
{
	extern Firmware_Details *firmware;
	extern volatile gboolean offline;
	OutputData *output = NULL;
	Command *command = NULL;
	extern volatile gint last_page;
	gint i = 0;

	if (last_page == -1)
	{
		command = (Command *)data;
		io_cmd(NULL,command->post_functions);
		return TRUE;
	}
	/*printf("burn all helper\n");*/
	if ((type != MS2) && (type != MS1))
		return FALSE;
	if (!offline)
	{
		/* MS2 extra is slightly different as it's paged like MS1 */
		if (((firmware->capabilities & MS2_E) || (firmware->capabilities & MS1) || (firmware->capabilities & MSNS_E)))
		{
	/*		printf("paged burn\n");*/
			output = initialize_outputdata();
			OBJ_SET(output->object,"page",GINT_TO_POINTER(last_page));
			OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[last_page]->phys_ecu_page));
			OBJ_SET(output->object,"canID",GINT_TO_POINTER(firmware->canID));
			OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
			io_cmd(firmware->burn_command,output);
		}
		else if ((firmware->capabilities & MS2) && (!(firmware->capabilities & MS2_E)))
		{
			/* MS2 std allows all pages to be in ram at will*/
			for (i=0;i<firmware->total_pages;i++)
			{
				if (!firmware->page_params[i]->dl_by_default)
					continue;
				output = initialize_outputdata();
				OBJ_SET(output->object,"page",GINT_TO_POINTER(i));
				OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[i]->phys_ecu_page));
				OBJ_SET(output->object,"canID",GINT_TO_POINTER(firmware->canID));
				OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
				io_cmd(firmware->burn_command,output);
			}
		}
	}
	command = (Command *)data;
	io_cmd(NULL,command->post_functions);
	return TRUE;
}
示例#2
0
/*!
 \brief early interrogation() is called from a one shot timeout from main
 in order to start the interrogation process as soon as the gui is up and 
 running.
 */
G_MODULE_EXPORT gboolean early_interrogation(void)
{
	set_title(g_strdup(_("Initiating background ECU interrogation...")));
	update_logbar("interr_view","warning",_("Initiating background ECU interrogation...\n"),FALSE,FALSE,FALSE);
	io_cmd("interrogation",NULL);
	return FALSE;
}
示例#3
0
/*!
  \brief Pre-loads the dependencies related to a tab/group of tabs
  \param data is the pointer to a GPtrArray list of tab infos, used to traverse 
  each tab config file to preload the needed interdependancy structures
  */
gboolean preload_deps(gpointer data)
{
	Firmware_Details *firmware = NULL;
	GPtrArray *array = (GPtrArray *)data;
	TabInfo *tabinfo = NULL;
	GladeInterface *iface = NULL;
	GladeWidgetInfo *info = NULL;
	ConfigFile *cfgfile = NULL;
	guint i = 0;	
	guint j = 0;	

	ENTER();
	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	g_return_val_if_fail(firmware,FALSE);

	for (i=0;i<array->len;i++)
	{
		tabinfo = (TabInfo *)g_ptr_array_index(array,i);
		iface = glade_parser_parse_file(tabinfo->glade_file,NULL);
		cfgfile = cfg_open_file(tabinfo->datamap_file);
		if ((!cfgfile) || (!iface))
			continue;
		for(j=0;j<iface->n_toplevels;j++)
		{
			info = iface->toplevels[j];
			descend_tree(info,cfgfile);
		}
		glade_interface_destroy(iface);
		cfg_free(cfgfile);
	}
	io_cmd(firmware->get_all_command,NULL);
	EXIT();
	return FALSE; /* Make it not run again... */
}
示例#4
0
EXPORT void spawn_read_ve_const_pf(void)
{
	extern Firmware_Details *firmware;
	if (!firmware)
		return;

	gdk_threads_enter();
	set_title(g_strdup(_("Queuing read of all ECU data...")));
	gdk_threads_leave();
	io_cmd(firmware->get_all_command,NULL);
}
示例#5
0
/*!
  \brief initiates an offline ECU restore from file. Prompts for file, if
  valid, it calles the restore_all function from the ECU plugin
  */
G_MODULE_EXPORT void offline_ecu_restore_pf(void)
{
	MtxFileIO *fileio = NULL;
	gchar *filename = NULL;
	void (*restore_all_f)(const gchar *);
	Firmware_Details *firmware = NULL;

	ENTER();
	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	get_symbol("restore_all_ecu_settings",(void **)&restore_all_f);

	g_return_if_fail(firmware);
	g_return_if_fail(restore_all_f);

	if (!DATA_GET(global_data,"interrogated"))
	{
		EXIT();
		return;
	}

	fileio = g_new0(MtxFileIO ,1);
	fileio->default_path = g_strdup(BACKUP_DATA_DIR);
	fileio->project = (const gchar *)DATA_GET(global_data,"project_name");
	fileio->parent = lookup_widget("main_window");
	fileio->on_top = TRUE;
	fileio->title = g_strdup("You should load an ECU backup from a file");
	fileio->action = GTK_FILE_CHOOSER_ACTION_OPEN;
	fileio->shortcut_folders = g_strdup(BACKUP_DATA_DIR);
	if (DATA_GET(global_data,"last_offline_filename"))
	fileio->default_filename = g_strdup((gchar *)DATA_GET(global_data,"last_offline_filename"));

	filename = choose_file(fileio);
	if (filename)
	{
		DATA_SET_FULL(global_data,"last_offline_filename",g_strdup(filename),g_free);
		update_logbar("tools_view",NULL,_("Full Restore of ECU Initiated\n"),FALSE,FALSE,FALSE);
		restore_all_f(filename);
		g_free(filename);
	}
	else
		io_cmd(firmware->get_all_command,NULL);

	free_mtxfileio(fileio);
	EXIT();
	return;
}
示例#6
0
EXPORT gboolean read_ve_const(void *data, XmlCmdType type)
{
	extern Firmware_Details *firmware;
	extern volatile gboolean offline;
	extern volatile gboolean outstanding_data;
	extern volatile gint last_page;
	OutputData *output = NULL;
	Command *command = NULL;
	gint i = 0;

	switch (type)
	{
		case MS1_VECONST:

			if (!offline)
			{
				g_list_foreach(get_list("get_data_buttons"),set_widget_sensitive,GINT_TO_POINTER(FALSE));
				if (outstanding_data)
					queue_burn_ecu_flash(last_page);
				for (i=0;i<firmware->total_pages;i++)
				{
					if (!firmware->page_params[i]->dl_by_default)
						continue;
					queue_ms1_page_change(i);
					output = initialize_outputdata();
					OBJ_SET(output->object,"page",GINT_TO_POINTER(i));
					OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[i]->phys_ecu_page));
					OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
					io_cmd(firmware->ve_command,output);
				}
			}
			command = (Command *)data;
			io_cmd(NULL,command->post_functions);
			break;
		case MS2_VECONST:
			if (!offline)
			{
				g_list_foreach(get_list("get_data_buttons"),set_widget_sensitive,GINT_TO_POINTER(FALSE));
				if ((firmware->capabilities & MS2_E) && (outstanding_data))
					queue_burn_ecu_flash(last_page);
				for (i=0;i<firmware->total_pages;i++)
				{
					if (!firmware->page_params[i]->dl_by_default)
						continue;
					output = initialize_outputdata();
					OBJ_SET(output->object,"page",GINT_TO_POINTER(i));
					OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[i]->phys_ecu_page));
					OBJ_SET(output->object,"canID",GINT_TO_POINTER(firmware->canID));
					OBJ_SET(output->object,"offset", GINT_TO_POINTER(0));
					OBJ_SET(output->object,"num_bytes", GINT_TO_POINTER(firmware->page_params[i]->length));
					OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
					io_cmd(firmware->ve_command,output);
				}
			}
			command = (Command *)data;
			io_cmd(NULL,command->post_functions);
			break;
		case MS2_E_COMPOSITEMON:
			if (!offline)
			{
				if ((firmware->capabilities & MS2_E) && (outstanding_data))
					queue_burn_ecu_flash(last_page);
				output = initialize_outputdata();
				OBJ_SET(output->object,"page",GINT_TO_POINTER(firmware->compositemon_page));
				OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[firmware->compositemon_page]->phys_ecu_page));
				OBJ_SET(output->object,"canID",GINT_TO_POINTER(firmware->canID));
				OBJ_SET(output->object,"offset", GINT_TO_POINTER(0));
				OBJ_SET(output->object,"num_bytes", GINT_TO_POINTER(firmware->page_params[firmware->compositemon_page]->length));
				OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
				io_cmd(firmware->ve_command,output);
			}
			command = (Command *)data;
			io_cmd(NULL,command->post_functions);
			break;
		case MS2_E_TRIGMON:
			if (!offline)
			{
				if ((firmware->capabilities & MS2_E) && (outstanding_data))
					queue_burn_ecu_flash(last_page);
				output = initialize_outputdata();
				OBJ_SET(output->object,"page",GINT_TO_POINTER(firmware->trigmon_page));
				OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[firmware->trigmon_page]->phys_ecu_page));
				OBJ_SET(output->object,"canID",GINT_TO_POINTER(firmware->canID));
				OBJ_SET(output->object,"offset", GINT_TO_POINTER(0));
				OBJ_SET(output->object,"num_bytes", GINT_TO_POINTER(firmware->page_params[firmware->trigmon_page]->length));
				OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
				io_cmd(firmware->ve_command,output);
			}
			command = (Command *)data;
			io_cmd(NULL,command->post_functions);
			break;
		case MS2_E_TOOTHMON:
			if (!offline)
			{
				if ((firmware->capabilities & MS2_E) && (outstanding_data))
					queue_burn_ecu_flash(last_page);
				output = initialize_outputdata();
				OBJ_SET(output->object,"page",GINT_TO_POINTER(firmware->toothmon_page));
				OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[firmware->toothmon_page]->phys_ecu_page));
				OBJ_SET(output->object,"canID",GINT_TO_POINTER(firmware->canID));
				OBJ_SET(output->object,"offset", GINT_TO_POINTER(0));
				OBJ_SET(output->object,"num_bytes", GINT_TO_POINTER(firmware->page_params[firmware->toothmon_page]->length));
				OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
				io_cmd(firmware->ve_command,output);
			}
			command = (Command *)data;
			io_cmd(NULL,command->post_functions);
			break;
		case MS1_E_TRIGMON:
			if (!offline)
			{
				if (outstanding_data)
					queue_burn_ecu_flash(last_page);
				queue_ms1_page_change(firmware->trigmon_page);
				output = initialize_outputdata();
				OBJ_SET(output->object,"page",GINT_TO_POINTER(firmware->trigmon_page));
				OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[firmware->trigmon_page]->phys_ecu_page));
				OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
				io_cmd(firmware->ve_command,output);
				command = (Command *)data;
				io_cmd(NULL,command->post_functions);
			}
			break;
		case MS1_E_TOOTHMON:
			if (!offline)
			{
				if (outstanding_data)
					queue_burn_ecu_flash(last_page);
				queue_ms1_page_change(firmware->toothmon_page);
				output = initialize_outputdata();
				OBJ_SET(output->object,"page",GINT_TO_POINTER(firmware->toothmon_page));
				OBJ_SET(output->object,"phys_ecu_page",GINT_TO_POINTER(firmware->page_params[firmware->toothmon_page]->phys_ecu_page));
				OBJ_SET(output->object,"mode", GINT_TO_POINTER(MTX_CMD_WRITE));
				io_cmd(firmware->ve_command,output);
				command = (Command *)data;
				io_cmd(NULL,command->post_functions);
			}
			break;
		default:
			break;
	}
	return TRUE;
}
示例#7
0
/*!
  \brief personality_choice() is called from a one shot timeout from main
  in order to open the window to ask the user what ECU family to deal with
  running.
  */
G_MODULE_EXPORT gboolean personality_choice(void)
{
	GtkWidget *dialog = NULL;
	GtkWidget *vbox = NULL;
	GtkWidget *hbox = NULL;
	GtkWidget *ebox = NULL;
	GtkWidget *sep = NULL;
	GtkWidget *button = NULL;
	GtkWidget *label = NULL;
	gchar ** dirs = NULL;
	gchar * filename = NULL;
	PersonaElement *element = NULL;
	gchar *tmpbuf = NULL;
	gboolean shouldjump = FALSE;
	gchar *name = NULL;
	GArray *classes = NULL;
	GSList *group = NULL;
	GList *p_list = NULL;
	GList *s_list = NULL;
	ConfigFile *cfgfile = NULL;
	guint i = 0;
	gint result = 0;
	gchar * pathstub = NULL;
	extern gconstpointer *global_data;

	pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",NULL);
	dirs = get_dirs((const gchar *)DATA_GET(global_data,"project_name"),pathstub,&classes);
	if (!dirs)
	{
		MTXDBG(CRITICAL,_("NO Interrogation profiles found, was MegaTunix installed properly?\n"));
		return FALSE;
	}
	i = 0;
	while (dirs[i])
	{
		tmpbuf = g_build_filename(dirs[i],"details.cfg",NULL);
		cfgfile = cfg_open_file(tmpbuf);
		if (!cfgfile)
		{
			/*MTXDBG(CRITICAL,_("\"%s\" file missing!, was MegaTunix installed properly?\n"),tmpbuf);*/
			i++;
			g_free(tmpbuf);
			continue;

		}
		g_free(tmpbuf);
		element = g_new0(PersonaElement, 1);
		cfg_read_string(cfgfile,"Family","sequence",&element->sequence);
		cfg_read_string(cfgfile,"Family","friendly_name",&element->name);
		cfg_read_string(cfgfile,"Family","persona",&element->persona);
		cfg_read_string(cfgfile,"Family","ecu_lib",&element->ecu_lib);
		cfg_read_string(cfgfile,"Family","common_lib",&element->common_lib);
		if (!cfg_read_string(cfgfile,"Family","baud",&element->baud_str))
			MTXDBG(CRITICAL,_("\"details.cfg\" baud string undefined!, was MegaTunix installed properly?\n"));
		element->dirname = g_strdup(dirs[i]);
		element->filename = g_path_get_basename(dirs[i]);
		if (g_strcasecmp(element->filename,(gchar *)DATA_GET(global_data,"last_ecu_family")) == 0)
			element->def = TRUE;
		if ((DATA_GET(global_data,"cli_persona")) && (element->persona))
		{
			if (g_strcasecmp(element->persona, (gchar *)DATA_GET(global_data,"cli_persona")) == 0)
			{
				button = gtk_toggle_button_new();
				gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
				persona_selection(button,(gpointer)element);
				g_object_ref_sink(button);
				g_object_unref(button);
				shouldjump = TRUE;
			}
		}

		if (g_array_index(classes,FileClass,i) == PERSONAL)
			p_list = g_list_prepend(p_list,(gpointer)element);
		if (g_array_index(classes,FileClass,i) == SYSTEM)
			s_list = g_list_prepend(s_list,(gpointer)element);
		g_free(name);
		i++;
		cfg_free(cfgfile);	
	}
	p_list = g_list_sort(p_list,persona_seq_sort);
	s_list = g_list_sort(s_list,persona_seq_sort);
	g_strfreev(dirs);
	g_array_free(classes,TRUE);
	if (shouldjump)
	{
		g_list_foreach(p_list,free_persona_element,NULL);
		g_list_foreach(s_list,free_persona_element,NULL);
		g_list_free(p_list);
		g_list_free(s_list);
		DATA_SET(global_data,"cli_persona",NULL);
		if (DATA_GET(global_data,"offline"))
			goto jumpahead_offline;
		else
			goto jumpahead;
	}

	set_title(g_strdup(_("Choose an ECU family?")));
	update_logbar("interr_view","warning",_("Prompting user for ECU family to interrogate...\n"),FALSE,FALSE,FALSE);

	dialog = gtk_dialog_new_with_buttons("Select ECU Personality",
			GTK_WINDOW(lookup_widget("main_window")),
			GTK_DIALOG_DESTROY_WITH_PARENT,
			"Exit MegaTunix",
			GTK_RESPONSE_CLOSE,
			"Go Offline",
			GTK_RESPONSE_CANCEL,
			"Find my ECU",
			GTK_RESPONSE_OK,
			NULL);
	vbox = gtk_vbox_new(TRUE,2);
	gtk_container_set_border_width(GTK_CONTAINER(vbox),5);
	//gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),vbox,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),vbox,TRUE,TRUE,0);
	if (g_list_length(p_list) > 0)
	{
		label = gtk_label_new("Custom (personal) Profiles");
		gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);

		group = NULL;
		/* Cycle list for PERSONAL profile files */
		for (i=0;i<g_list_length(p_list);i++)
		{
			element = (PersonaElement *)g_list_nth_data(p_list,i);

			ebox = gtk_event_box_new();
			gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0);
			hbox = gtk_hbox_new(FALSE,10);
			gtk_container_add(GTK_CONTAINER(ebox),hbox);
			label = gtk_label_new(element->name);
			gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0);
			if (!check_for_files (element->dirname,"prof"))
			{
				gtk_widget_set_sensitive(ebox,FALSE);
				button = gtk_radio_button_new(NULL);
			}
			else
			{
				button = gtk_radio_button_new(group);
				group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
			}
			g_signal_connect(button,
					"toggled",
					G_CALLBACK(persona_selection),
					element);
			gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
			if (element->def)
			{
				gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
				gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button));
			}
		}

		sep = gtk_hseparator_new();
		gtk_box_pack_start(GTK_BOX(vbox),sep,TRUE,TRUE,0);
	}
	label = gtk_label_new("System Wide ECU Profiles");
	gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);
	/* Cycle list for System interogation files */
	for (i=0;i<g_list_length(s_list);i++)
	{
		element = (PersonaElement *)g_list_nth_data(s_list,i);
		ebox = gtk_event_box_new();
		gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0);
		hbox = gtk_hbox_new(FALSE,10);
		gtk_container_add(GTK_CONTAINER(ebox),hbox);
		label = gtk_label_new(element->name);
		gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0);
		if (!check_for_files (element->dirname,"prof"))
		{
			gtk_widget_set_sensitive(ebox,FALSE);
			button = gtk_radio_button_new(NULL);
		}
		else
		{
			button = gtk_radio_button_new(group);
			group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
		}
		g_signal_connect(button,
				"toggled",
				G_CALLBACK(persona_selection),
				element);
		gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
		if (element->def)
		{
			gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
			gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button));
		}
	}

	gtk_widget_show_all(dialog);
	result = gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
	g_list_foreach(p_list,free_persona_element,NULL);
	g_list_foreach(s_list,free_persona_element,NULL);
	g_list_free(p_list);
	g_list_free(s_list);
	switch (result)
	{
		case GTK_RESPONSE_CLOSE:
			leave(NULL,NULL);
			break;
		case GTK_RESPONSE_ACCEPT:
		case GTK_RESPONSE_OK: /* Normal mode */
jumpahead:
			plugins_init();
			pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL);
			filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL);
			g_free(pathstub);
			load_comm_xml(filename);
			g_free(filename);
			io_cmd("interrogation",NULL);
			break;
		default: /* Offline */
jumpahead_offline:
			plugins_init();
			pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL);
			filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL);
			g_free(pathstub);
			load_comm_xml(filename);
			g_free(filename);
			g_timeout_add(100,(GSourceFunc)set_offline_mode,NULL);
			return FALSE;
	}
	return FALSE;
}
示例#8
0
/*!
  \brief set_offline_mode() is called when the "Offline Mode" button is clicked
  in the general tab and is used to present the user with list of firmware 
  choices to select one for loading to work in offline mode (no connection to
  an ECU)
  */
G_MODULE_EXPORT gboolean set_offline_mode(void)
{
	GtkWidget * widget = NULL;
	gchar * filename = NULL;
	gboolean tmp = TRUE;
	GArray *pfuncs = NULL;
	PostFunction *pf = NULL;
	GAsyncQueue *io_repair_queue = NULL;
	Firmware_Details *firmware = NULL;
	void (*load_firmware_details)(void *,const gchar *) = NULL;

	ENTER();
	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	io_repair_queue = (GAsyncQueue *)DATA_GET(global_data,"io_repair_queue");

	/* Cause Serial Searcher thread to abort.... */
	if (io_repair_queue)
		g_async_queue_push(io_repair_queue,&tmp);

	filename = present_firmware_choices();
	if (!filename)
	{
		DATA_SET(global_data,"offline",GINT_TO_POINTER(FALSE));
		DATA_SET(global_data,"interrogated",GINT_TO_POINTER(FALSE));
		widget = lookup_widget("interrogate_button");
		if (GTK_IS_WIDGET(widget))
			gtk_widget_set_sensitive(GTK_WIDGET(widget),TRUE);
		widget = lookup_widget("offline_button");
		if (GTK_IS_WIDGET(widget))
			gtk_widget_set_sensitive(GTK_WIDGET(widget),TRUE);
		plugins_shutdown();
		/* Does this need a delay? */
		personality_choice();

		EXIT();
		return FALSE;
	}

	DATA_SET_FULL(global_data,"last_offline_profile",g_strdup(filename),g_free);
	DATA_SET(global_data,"offline",GINT_TO_POINTER(TRUE));
	DATA_SET(global_data,"interrogated",GINT_TO_POINTER(TRUE));

	/* Disable interrogation button */
	widget = lookup_widget("interrogate_button");
	if (GTK_IS_WIDGET(widget))
		gtk_widget_set_sensitive(GTK_WIDGET(widget),FALSE);

	widget = lookup_widget("netaccess_table");
	if (GTK_IS_WIDGET(widget))
		gtk_widget_set_sensitive(GTK_WIDGET(widget),FALSE);

	queue_function("kill_conn_warning");

	if (!firmware)
	{
		firmware = g_new0(Firmware_Details,1);
		DATA_SET(global_data,"firmware",firmware);
	}
	if (get_symbol("load_firmware_details",(void **)&load_firmware_details))
	{
		load_firmware_details(firmware,filename);
	}
	else
		printf("Unable to load firmware details!\n");

	pfuncs = g_array_new(FALSE,TRUE,sizeof(PostFunction *));

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("update_interrogation_gui_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("load_realtime_map_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("initialize_dashboards_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("load_status_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("load_rt_text_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("load_gui_tabs_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("start_statuscounts_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("disable_burner_buttons_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	/* BUG, causes deadlock
	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("offline_ecu_restore_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);
	*/

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("setup_menu_handlers_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("enable_3d_buttons_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("ready_msg_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("cleanup_pf");
	get_symbol(pf->name,(void **)&pf->function_w_arg);
	pf->w_arg = TRUE;
	pfuncs = g_array_append_val(pfuncs,pf);

	io_cmd(NULL,pfuncs);

	/*
	   io_cmd(firmware->get_all_command,NULL);
	 */

	widget = lookup_widget("binary_logging_frame");
	if (GTK_IS_WIDGET(widget))
		gtk_widget_set_sensitive(GTK_WIDGET(widget),FALSE);
	widget = lookup_widget("interrogate_button");
	if (GTK_IS_WIDGET(widget))
		gtk_widget_set_sensitive(GTK_WIDGET(widget),FALSE);
	widget = lookup_widget("offline_button");
	if (GTK_IS_WIDGET(widget))
		gtk_widget_set_sensitive(GTK_WIDGET(widget),FALSE);
	g_list_foreach(get_list("get_data_buttons"),set_widget_sensitive,GINT_TO_POINTER(FALSE));

	pfuncs = g_array_new(FALSE,TRUE,sizeof(PostFunction *));

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("reset_temps_pf");
	get_symbol(pf->name,(void **)&pf->function);
	pf->w_arg = FALSE;
	pfuncs = g_array_append_val(pfuncs,pf);

	pf = g_new0(PostFunction,1);
	pf->name = g_strdup("cleanup_pf");
	get_symbol(pf->name,(void **)&pf->function_w_arg);
	pf->w_arg = TRUE;
	pfuncs = g_array_append_val(pfuncs,pf);
	io_cmd(NULL,pfuncs);
	EXIT();
	return FALSE;
}