sys: Fixed Windows TTY COM Port view

This commit is contained in:
WerWolv 2021-12-20 21:50:59 +01:00
parent e11a5d0d44
commit b3906e770f
1 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ namespace hex::plugin::windows {
if (!this->connect()) if (!this->connect())
View::showErrorPopup("hex.windows.view.tty_console.connect_error"_lang); View::showErrorPopup("hex.windows.view.tty_console.connect_error"_lang);
} else { } else {
if (ImGui::Button("hex.windows.view.tty_console.disconnect")) if (ImGui::Button("hex.windows.view.tty_console.disconnect"_lang))
this->disconnect(); this->disconnect();
} }
@ -195,6 +195,9 @@ namespace hex::plugin::windows {
auto closeHandle = SCOPE_GUARD { CloseHandle(this->m_portHandle); }; auto closeHandle = SCOPE_GUARD { CloseHandle(this->m_portHandle); };
if(!::SetupComm(this->m_portHandle, 10000, 10000))
return false;
DCB serialParams; DCB serialParams;
serialParams.DCBlength = sizeof(DCB); serialParams.DCBlength = sizeof(DCB);
@ -220,9 +223,6 @@ namespace hex::plugin::windows {
if (!::SetCommTimeouts(this->m_portHandle, &timeouts)) if (!::SetCommTimeouts(this->m_portHandle, &timeouts))
return false; return false;
if(!::SetupComm(this->m_portHandle, 10000, 10000))
return false;
closeHandle.release(); closeHandle.release();
this->m_receiveThread = std::jthread([this](const std::stop_token &token) { this->m_receiveThread = std::jthread([this](const std::stop_token &token) {