diff mbox series

[wrynose] minicom: fix baud rate setting with glibc 2.42 and newer

Message ID 20261017111813.53186-1-ayoub.zaki@embetrix.com
State New
Headers show
Series [wrynose] minicom: fix baud rate setting with glibc 2.42 and newer | expand

Commit Message

Ayoub Zaki Oct. 17, 2026, 11:18 a.m. UTC
Backport the upstream baud rate fix to minicom 2.10 in wrynose.

glibc 2.42 added support for arbitrary termios baud rates on Linux and
changed the Bxxx speed constants from bitmasks to integer baud rates.
The macros combine these values directly with c_cflag, resulting in
incorrect baud rates and garbled UART output. Use the libc functions
instead.

Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
---
 ...ove-cfset-i-o-speed-macros-for-glibc.patch | 41 +++++++++++++++++++
 meta/recipes-extended/minicom/minicom_2.10.bb |  4 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/minicom/files/0001-src-sysdep.h-remove-cfset-i-o-speed-macros-for-glibc.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/minicom/files/0001-src-sysdep.h-remove-cfset-i-o-speed-macros-for-glibc.patch b/meta/recipes-extended/minicom/files/0001-src-sysdep.h-remove-cfset-i-o-speed-macros-for-glibc.patch
new file mode 100644
index 0000000000..3b1136768a
--- /dev/null
+++ b/meta/recipes-extended/minicom/files/0001-src-sysdep.h-remove-cfset-i-o-speed-macros-for-glibc.patch
@@ -0,0 +1,41 @@ 
+From 964ae563cb5a78545ae1a4a3b6784c69ec73bc48 Mon Sep 17 00:00:00 2001
+From: Stefan Becker <chemobejk@gmail.com>
+Date: Mon, 17 Nov 2025 11:57:32 +0200
+Subject: [PATCH] src/sysdep.h: remove cfset{i,o}speed macros for glibc
+
+glibc 2.42 added support for arbitrary termios speeds on Linux, i.e.
+speed_t and Bxxx defines changed from bitmasks to unsigned integers:
+Therefore speed_t can no longer be used together with c_flag's internal
+bitmask CBAUD.
+
+When minicom is compiled on such a system the baudrate setting is broken
+and the user experiences garbled UART output.
+
+Remove the macros for glibc, i.e. call cfset{i,o}speed() instead.
+
+Fixes #17
+
+Upstream-Status: Backport [https://salsa.debian.org/minicom-team/minicom/-/commit/964ae563cb5a78545ae1a4a3b6784c69ec73bc48]
+
+Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
+---
+ src/sysdep.h | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/src/sysdep.h b/src/sysdep.h
+index b11945c..9ba8836 100644
+--- a/src/sysdep.h
++++ b/src/sysdep.h
+@@ -141,12 +141,3 @@
+ #  define cfsetospeed(tty, spd)
+ #endif
+ #endif
+-
+-/* Redefine cfset{i,o}speed for Linux > 1.1.68 && libc < 4.5.21 */
+-#if defined (__GLIBC__) && defined(CBAUDEX)
+-#  undef cfsetispeed
+-#  undef cfsetospeed
+-#  define cfsetispeed(xtty, xspd) \
+-		((xtty)->c_cflag = ((xtty)->c_cflag & ~CBAUD) | (xspd))
+-#  define cfsetospeed(tty, spd)
+-#endif
diff --git a/meta/recipes-extended/minicom/minicom_2.10.bb b/meta/recipes-extended/minicom/minicom_2.10.bb
index 20ce5662c2..c78d70f21a 100644
--- a/meta/recipes-extended/minicom/minicom_2.10.bb
+++ b/meta/recipes-extended/minicom/minicom_2.10.bb
@@ -7,7 +7,9 @@  LICENSE = "GPL-2.0-or-later"
 LIC_FILES_CHKSUM = "file://COPYING;md5=420477abc567404debca0a2a1cb6b645 \
                     file://src/minicom.h;beginline=1;endline=12;md5=a58838cb709f0db517f4e42730c49e81"
 
-SRC_URI = "${DEBIAN_MIRROR}/main/m/${BPN}/${BPN}_${PV}.orig.tar.bz2"
+SRC_URI = "${DEBIAN_MIRROR}/main/m/${BPN}/${BPN}_${PV}.orig.tar.bz2 \
+           file://0001-src-sysdep.h-remove-cfset-i-o-speed-macros-for-glibc.patch \
+           "
 
 SRC_URI[sha256sum] = "90e7ce2856b3eaaa3f452354d17981c49d32c426a255b6f0d3063a227c101538"