private bool DongleReset() { BlockingCommandReceiver waiter = new BlockingCommandReceiver(ZToolCMD.SYS_RESET_RESPONSE, _commandInterface); try { _commandInterface.SendAsynchronousCommand(new SYS_RESET(SYS_RESET.RESET_TYPE.SERIAL_BOOTLOADER)); } catch (IOException e) { Log.Error("Failed to send SYS_RESET: {Exception}", e); return(false); } SYS_RESET_RESPONSE response = (SYS_RESET_RESPONSE)waiter.GetCommand(ResetTimeout); if (response == null) { Log.Warning("Dongle reset failed. Assuming bootloader is running and sending magic byte 0x{BootLoaderMagicByte}.", BOOTLOADER_MAGIC_BYTE.ToString("X2")); if (!BootloaderGetOut(BOOTLOADER_MAGIC_BYTE)) { Log.Warning("Attempt to get out from bootloader failed."); return(false); } } return(true); }
private bool DongleReset() { BlockingCommandReceiver waiter = new BlockingCommandReceiver(ZToolCMD.SYS_RESET_RESPONSE, _commandInterface); try { _commandInterface.SendAsynchronousCommand(new SYS_RESET(SYS_RESET.RESET_TYPE.SERIAL_BOOTLOADER)); } catch (IOException e) { _logger.Error("Failed to send SYS_RESET", e); return(false); } SYS_RESET_RESPONSE response = (SYS_RESET_RESPONSE)waiter.GetCommand(ResetTimeout); return(response != null); }