From 2e91c56a719814bb30c88dfe55389718c7ff7ab5 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 31 Oct 2023 06:55:13 +0000 Subject: [PATCH] windows/serialInterface: Added a call to read out the serial state notification when we start comms --- src/windows/serialInterface.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/windows/serialInterface.cxx b/src/windows/serialInterface.cxx index 14cebf4..c3d9393 100644 --- a/src/windows/serialInterface.cxx +++ b/src/windows/serialInterface.cxx @@ -202,6 +202,10 @@ serialInterface_t::serialInterface_t(const usbDevice_t &usbDevice) : device timeouts.WriteTotalTimeoutMultiplier = 10; 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 serialState{}; + static_cast(ReadFile(device, serialState.data(), serialState.size(), nullptr, nullptr)); } serialInterface_t::~serialInterface_t() noexcept