diff --git a/lib/usb/serial.cc b/lib/usb/serial.cc index dff4b8b5..4276559b 100644 --- a/lib/usb/serial.cc +++ b/lib/usb/serial.cc @@ -50,7 +50,7 @@ ~SerialPortImpl() override { - CloseHandle(h); + CloseHandle(_handle); } public: @@ -71,6 +71,8 @@ ssize_t write(const uint8_t* buffer, size_t len) override { DWORD wlen; + /* Windows gets unhappy if we try to transfer too much... */ + len = std::min(4096U, len); bool r = WriteFile( /* hFile= */ _handle, /* lpBuffer= */ buffer,