This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 5d2e1d40dc arch/tiva: Fix inability to control serial CTS/RTS via
termios
5d2e1d40dc is described below
commit 5d2e1d40dcb21c4895f02566947737307311463a
Author: Nathan Hartman <[email protected]>
AuthorDate: Tue Feb 7 18:07:21 2023 -0500
arch/tiva: Fix inability to control serial CTS/RTS via termios
* arch/arm/src/tiva/common/tiva_serial.c:
(up_ioctl): PR #8406 (commit 1edec0aaa1) added support for
configuring the serial port's CTS/RTS flow control at runtime using
termios when built with CONFIG_SERIAL_TERMIOS and either or both of
CONFIG_SERIAL_OFLOWCONTROL and CONFIG_SERIAL_IFLOWCONTROL. However,
a runtime sanity check left over from before prevented this from
working: When processing ioctl TCSETS, we would return -EINVAL if
one or both of CCTS_OFLOW and CRTS_IFLOW were requested, which was
not deserved if the requested features were in fact supported.
Fixing the sanity check so it depends on features actually
configured.
---
arch/arm/src/tiva/common/tiva_serial.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/arm/src/tiva/common/tiva_serial.c
b/arch/arm/src/tiva/common/tiva_serial.c
index 6e4ff4a6ab..e1ce628bb9 100644
--- a/arch/arm/src/tiva/common/tiva_serial.c
+++ b/arch/arm/src/tiva/common/tiva_serial.c
@@ -1193,15 +1193,25 @@ static int up_ioctl(struct file *filep, int cmd,
unsigned long arg)
/* Perform some sanity checks before accepting any changes */
- if (termiosp->c_cflag & CRTSCTS)
+#ifndef CONFIG_SERIAL_OFLOWCONTROL
+ if (termiosp->c_cflag & CCTS_OFLOW)
{
- /* We don't support for flow control right now, so we report an
- * error
- */
+ /* CTS not supported in this build, so report error */
ret = -EINVAL;
break;
}
+#endif /* !CONFIG_SERIAL_OFLOWCONTROL */
+
+#ifndef CONFIG_SERIAL_IFLOWCONTROL
+ if (termiosp->c_cflag & CRTS_IFLOW)
+ {
+ /* RTS not supported in this build, so report error */
+
+ ret = -EINVAL;
+ break;
+ }
+#endif /* !CONFIG_SERIAL_IFLOWCONTROL */
if (termiosp->c_cflag & PARENB)
{