-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openthread_border_router: Deassert DTR/RTS lines for USB devices usin…
…g these for BSL (#3677) * patch terminal to de-assert dtr/rts if flow control disabled * Changelog entry * Bump version 2.9.0 * Update openthread_border_router/CHANGELOG.md Co-authored-by: Stefan Agner <[email protected]> --------- Co-authored-by: Stefan Agner <[email protected]>
- Loading branch information
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
openthread_border_router/0004-Deassert-DTR-and-RTS-if-flow-control-is-disabled.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From b5adc7fb59939a5054e2e2d301b26b5132254262 Mon Sep 17 00:00:00 2001 | ||
From: Tim Lunn <[email protected]> | ||
Date: Mon, 1 Jul 2024 14:27:40 +1000 | ||
Subject: [PATCH] Deassert DTR and RTS if flow control is disabled | ||
|
||
Many USB radio devices (particularly those based on TI CC2652) have | ||
reset and bootloader activation directly connected to DTR/RTS lines. | ||
These devices will fail to start, in the default state where both | ||
DTR/RTS are asserted on connection. | ||
|
||
This patch ensures flow control is disabled and both DTR and RTS are | ||
deasserted on startup while configuring the terminal. | ||
--- | ||
src/posix/platform/hdlc_interface.cpp | 10 ++++++++++ | ||
1 file changed, 10 insertions(+) | ||
|
||
diff --git a/src/posix/platform/hdlc_interface.cpp b/src/posix/platform/hdlc_interface.cpp | ||
index 12726fc72..056224786 100644 | ||
--- a/src/posix/platform/hdlc_interface.cpp | ||
+++ b/src/posix/platform/hdlc_interface.cpp | ||
@@ -600,6 +600,16 @@ int HdlcInterface::OpenFile(const Url::Url &aRadioUrl) | ||
{ | ||
tios.c_cflag |= CRTSCTS; | ||
} | ||
+ else | ||
+ { | ||
+ tios.c_cflag &= ~(CRTSCTS); | ||
+ | ||
+ // Deassert DTR and RTS | ||
+ int flags; | ||
+ VerifyOrExit((ioctl(fd, TIOCMGET, &flags)) != -1, perror("tiocmget")); | ||
+ flags &= ~(TIOCM_DTR | TIOCM_RTS); | ||
+ VerifyOrExit((ioctl(fd, TIOCMSET, &flags)) != -1, perror("tiocmset")); | ||
+ } | ||
|
||
VerifyOrExit((rval = cfsetspeed(&tios, static_cast<speed_t>(speed))) == 0, perror("cfsetspeed")); | ||
rval = tcsetattr(fd, TCSANOW, &tios); | ||
-- | ||
2.43.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters