Fix the serial port code on Windows.

This commit is contained in:
David Given
2021-12-10 23:29:20 +00:00
parent 519c30321d
commit fe8be18c4c

View File

@@ -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,