Windows: Support serial ports > COM9

Windows requires the use of the DOS UNC path name for COM ports
greater than COM9.  Prefix the port name with \\.\
This commit is contained in:
Howard M. Harte
2021-12-17 14:21:19 -08:00
parent 45fe83951a
commit 9ee5b3eaf3

View File

@@ -18,8 +18,9 @@
public:
SerialPortImpl(const std::string& name)
{
std::string dos_name = "\\\\.\\" + name;
_handle = CreateFileA(
name.c_str(),
dos_name.c_str(),
/* dwDesiredAccess= */ GENERIC_READ|GENERIC_WRITE,
/* dwShareMode= */ 0,
/* lpSecurityAttribues= */ nullptr,