void do_ms1_load(gint port_fd, gint file_fd) { gboolean result = FALSE; EcuState ecu_state = NOT_LISTENING; ecu_state = detect_ecu(port_fd); switch (ecu_state) { case NOT_LISTENING: output("NO response to signature request\n",FALSE); break; case IN_BOOTLOADER: output("ECU is in bootloader mode, good!\n",FALSE); break; case LIVE_MODE: output("ECU detected in LIVE! mode, attempting to access bootloader\n",FALSE); result = jump_to_bootloader(port_fd); if (result) { ecu_state = detect_ecu(port_fd); if (ecu_state == IN_BOOTLOADER) { output("ECU is in bootloader mode, good!\n",FALSE); break; } else output("Could NOT attain bootloader mode\n",FALSE); } else output("Could NOT attain bootloader mode\n",FALSE); break; } if (ecu_state != IN_BOOTLOADER) { /*output("Please jump the boot jumper on the ECU and power cycle it\n\nPress any key to continue\n",FALSE);*/ boot_jumper_prompt(); ecu_state = detect_ecu(port_fd); if (ecu_state != IN_BOOTLOADER) { output("Unable to get to the bootloader, update FAILED!\n",FALSE); boot_jumper_prompt(); } else output("Got into the bootloader, good!\n",FALSE); } result = prepare_for_upload(port_fd); if (!result) { output("Failure getting ECU into a state to accept the new firmware\n",FALSE); exit (-1); } upload_firmware(port_fd,file_fd); output("Firmware upload completed...\n",FALSE); reboot_ecu(port_fd); output("ECU reboot complete\n",FALSE); return; }
/////////////////////////////////////////////////////// // Submit all debug info - confirmation callback static void roadmap_confirmed_debug_info_submit(int exit_code, void *context){ if (exit_code != dec_yes) return; #ifdef J2ME roadmap_log_close_log_file(); #endif in_process = 1; if (!prepare_for_upload()) { roadmap_messagebox_timeout("Oops", "Error sending files",5); in_process = 0; return; } if (!upload()) { roadmap_messagebox_timeout("Oops", "Error sending files",5); in_process = 0; return; } }