X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fplatform%2Fwindows%2Fserialport.cpp;h=9e4cc486e64138a56185f1f3d30b357cc74005bd;hb=7879fa15cd1d00d3334a258ae0fce065c92f6e39;hp=b028ff32e5e8810f5bb01bcb70cf8aa2810722db;hpb=722869e27e6f6ef9db09fa9114994e167b7e8894;p=deb_libcec.git diff --git a/src/lib/platform/windows/serialport.cpp b/src/lib/platform/windows/serialport.cpp index b028ff3..9e4cc48 100644 --- a/src/lib/platform/windows/serialport.cpp +++ b/src/lib/platform/windows/serialport.cpp @@ -65,8 +65,9 @@ CSerialPort::~CSerialPort(void) bool CSerialPort::Open(string name, uint32_t baudrate, uint8_t databits, uint8_t stopbits, uint8_t parity) { + CStdString strComPath = "\\\\.\\" + name; CLockObject lock(&m_mutex); - m_handle = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + m_handle = CreateFile(strComPath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (m_handle == INVALID_HANDLE_VALUE) { m_error = "Unable to open COM port"; @@ -77,7 +78,7 @@ bool CSerialPort::Open(string name, uint32_t baudrate, uint8_t databits, uint8_t COMMCONFIG commConfig = {0}; DWORD dwSize = sizeof(commConfig); commConfig.dwSize = dwSize; - if (GetDefaultCommConfig(name.c_str(), &commConfig,&dwSize)) + if (GetDefaultCommConfig(strComPath.c_str(), &commConfig,&dwSize)) { if (!SetCommConfig(m_handle, &commConfig,dwSize)) { @@ -166,7 +167,7 @@ void CSerialPort::Close(void) } } -int8_t CSerialPort::Write(CCECAdapterMessagePtr data) +int8_t CSerialPort::Write(CCECAdapterMessage *data) { CLockObject lock(&m_mutex); DWORD iBytesWritten = 0;