From f08a25a8f77a00a06152be69fe64bdf2e764caf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=86=E2=9C=A0Sa=CD=A5b=CD=A3e=CD=ABr=F0=9F=91=91?= =?UTF-8?q?=E2=B0=80?= Date: Fri, 14 Aug 2026 09:47:36 +0800 Subject: [PATCH] Fixes opening posix serial connection --- Common/Cpp/SerialConnection/SerialConnectionPOSIX.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Common/Cpp/SerialConnection/SerialConnectionPOSIX.h b/Common/Cpp/SerialConnection/SerialConnectionPOSIX.h index 54cab14fc0..d9fd6b8e7a 100644 --- a/Common/Cpp/SerialConnection/SerialConnectionPOSIX.h +++ b/Common/Cpp/SerialConnection/SerialConnectionPOSIX.h @@ -39,7 +39,11 @@ class SerialConnection : public UnreliableStreamConnectionPushing{ { // std::cout << "desired baud = " << baud << std::endl; - m_fd = open(name.c_str(), O_RDWR | O_NOCTTY); + if (name.starts_with("/dev/")){ + m_fd = open(name.c_str(), O_RDWR | O_NOCTTY); + } else{ + m_fd = open(("/dev/"+name).c_str(), O_RDWR | O_NOCTTY); + } if (m_fd == -1){ int error = errno; std::string str = "Unable to open serial connection. Error = " + std::to_string(error);