From 45c5fe475b281b80c426f2e9e80433dc5992a403 Mon Sep 17 00:00:00 2001 From: Suvesh Pratapa <66088488+suveshpratapa@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:38:31 -0400 Subject: [PATCH] [posix] add radio URL parameter `uart-init-deassert` to deassert DTR and RTS on init when flow control is disabled (#10644) This lets us preserve legacy behavior where `uart-flow-control` was not required even with hardware flow control enabled. --- src/posix/platform/hdlc_interface.cpp | 3 ++- src/posix/platform/radio_url.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/posix/platform/hdlc_interface.cpp b/src/posix/platform/hdlc_interface.cpp index 235af9ac8..321bfbae2 100644 --- a/src/posix/platform/hdlc_interface.cpp +++ b/src/posix/platform/hdlc_interface.cpp @@ -600,8 +600,9 @@ int HdlcInterface::OpenFile(const Url::Url &aRadioUrl) { tios.c_cflag |= CRTSCTS; } - else + else if (aRadioUrl.HasParam("uart-init-deassert")) { + // When flow control is disabled, deassert DTR and RTS on init #ifndef __APPLE__ int flags; #endif diff --git a/src/posix/platform/radio_url.cpp b/src/posix/platform/radio_url.cpp index 57e1df0c2..c91baacba 100644 --- a/src/posix/platform/radio_url.cpp +++ b/src/posix/platform/radio_url.cpp @@ -84,6 +84,7 @@ const char *otSysGetRadioUrlHelpString(void) " uart-stop[=number-of-bits] Uart stop bit, default is 1.\n" \ " uart-baudrate[=baudrate] Uart baud rate, default is 115200.\n" \ " uart-flow-control Enable flow control, disabled by default.\n" \ + " uart-init-deassert Deassert lines on init when flow control is disabled.\n" \ " uart-reset Reset connection after hard resetting RCP(USB CDC ACM).\n" \ "\n" #else