From b3906e770f7bf881f4ae89b152839143f5079b55 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 20 Dec 2021 21:50:59 +0100 Subject: [PATCH] sys: Fixed Windows TTY COM Port view --- plugins/windows/source/views/view_tty_console.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/windows/source/views/view_tty_console.cpp b/plugins/windows/source/views/view_tty_console.cpp index 664df9451..4e0a94ffa 100644 --- a/plugins/windows/source/views/view_tty_console.cpp +++ b/plugins/windows/source/views/view_tty_console.cpp @@ -72,7 +72,7 @@ namespace hex::plugin::windows { if (!this->connect()) View::showErrorPopup("hex.windows.view.tty_console.connect_error"_lang); } else { - if (ImGui::Button("hex.windows.view.tty_console.disconnect")) + if (ImGui::Button("hex.windows.view.tty_console.disconnect"_lang)) this->disconnect(); } @@ -195,6 +195,9 @@ namespace hex::plugin::windows { auto closeHandle = SCOPE_GUARD { CloseHandle(this->m_portHandle); }; + if(!::SetupComm(this->m_portHandle, 10000, 10000)) + return false; + DCB serialParams; serialParams.DCBlength = sizeof(DCB); @@ -220,9 +223,6 @@ namespace hex::plugin::windows { if (!::SetCommTimeouts(this->m_portHandle, &timeouts)) return false; - if(!::SetupComm(this->m_portHandle, 10000, 10000)) - return false; - closeHandle.release(); this->m_receiveThread = std::jthread([this](const std::stop_token &token) {