From 8d2986c58f762fccb716dad753f281f71abe388a Mon Sep 17 00:00:00 2001 From: John Date: Mon, 11 Nov 2024 20:36:56 +0100 Subject: [PATCH] fix for symlinks with colon (fixes #1374) --- src/lib/ebus/protocol.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/ebus/protocol.cpp b/src/lib/ebus/protocol.cpp index f74450a9..70123479 100644 --- a/src/lib/ebus/protocol.cpp +++ b/src/lib/ebus/protocol.cpp @@ -70,7 +70,8 @@ ProtocolHandler* ProtocolHandler::create(const ebus_protocol_config_t config, } } Transport* transport; - if (strchr(name, '/') == nullptr || strchr(name, ':') != nullptr) { + // symlink device name may contain colon, so only check for absence of slash only + if (strchr(name, '/') == nullptr) { char* in = strdup(name); bool udp = false; char* addrpos = in; @@ -97,6 +98,7 @@ ProtocolHandler* ProtocolHandler::create(const ebus_protocol_config_t config, transport = new NetworkTransport(name, config.extraLatency, hostOrIp, port, udp); } else { // support ens:/dev/, enh:/dev/, and /dev/ + // as well as symlinks like /dev/serial/by-id/...Espressif_00:01:02:03... transport = new SerialTransport(name, config.extraLatency, !config.noDeviceCheck, speed); } Device* device;