Skip to content

Commit f08a25a

Browse files
committed
Fixes opening posix serial connection
1 parent 3bf230f commit f08a25a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Common/Cpp/SerialConnection/SerialConnectionPOSIX.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ class SerialConnection : public UnreliableStreamConnectionPushing{
3939
{
4040
// std::cout << "desired baud = " << baud << std::endl;
4141

42-
m_fd = open(name.c_str(), O_RDWR | O_NOCTTY);
42+
if (name.starts_with("/dev/")){
43+
m_fd = open(name.c_str(), O_RDWR | O_NOCTTY);
44+
} else{
45+
m_fd = open(("/dev/"+name).c_str(), O_RDWR | O_NOCTTY);
46+
}
4347
if (m_fd == -1){
4448
int error = errno;
4549
std::string str = "Unable to open serial connection. Error = " + std::to_string(error);

0 commit comments

Comments
 (0)