Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set Windows timeouts to enforce non-blocking read
Settings ReadIntervalTimeout and ReadTotalTimeoutMultiplier to MAXDWORD in the COMMTIMEOUTS structure on Windows makes Windows behave as normally expected; a read call to the serial port will return immediately if there is any data available, or if a single byte arrives in the buffer. If no data arrives, it will timeout out after the timeout specified in ReadTotalTimeoutConstant. This fixes issues where reading from a serial port would take longer than desired when less data arrives that there is room for in the buffer passed to the read function. See also: https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-commtimeouts
- Loading branch information