Skip to content

Commit

Permalink
windows/serialInterface: Cleaned up handling of data in the receive b…
Browse files Browse the repository at this point in the history
…uffer using PurgeComm()
  • Loading branch information
dragonmux committed Jan 16, 2024
1 parent 07c3e59 commit 0c74034
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/windows/serialInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ serialInterface_t::serialInterface_t(const usbDevice_t &usbDevice) : device
if (!SetCommTimeouts(device, &timeouts))
handleDeviceError("set communications timeouts for device"sv);

// Having adjusted the line state, try to do a read of the serial state notification which will be sat in the buffer
std::array<uint8_t, 10U> serialState{};
static_cast<void>(ReadFile(device, serialState.data(), serialState.size(), nullptr, nullptr));
// Having adjusted the line state, discard anything sat in the receive buffer
PurgeComm(device, PURGE_RXCLEAR);
}

// NOLINTNEXTLINE(modernize-use-equals-default)
Expand Down

0 comments on commit 0c74034

Please sign in to comment.