baudrate setting broken on Linux when compiling against glibc >= 2.42
glibc 2.42 added support for arbitrary termios speeds on Linux, i.e. speed_t and Bxxx defines changed from bitmasks to unsigned integers:
* On Linux, the <termios.h> interface now supports arbitrary baud rates;
speed_t is redefined to simply be the baud rate specified as an
unsigned int, which matches the kernel interface.
Therefore speed_t can no longer be used together with c_flag's internal bitmask CBAUD. CBAUD-compatible bitmasks are now available as __Bxxx defines.
minicom has an ancient workaround(?) in src/sysdep.h that redefines cfset{i,o}speed as macros that set c_flag baudrate bits using CBAUD & Bxxx defines. When you compile the code on a system with glibc >= 2.42, f.ex. Fedora 43, then
- an incorrect speed bitmask is stored to
c_flag'sCBAUDbits, and - depending on the baudrate random other bits are set in
c_flag.
On such a system this causes garbled UART output in minicom.
This issue can be fixed by
- either removing the obsolete(?) ancient workaround,
- or disabling it when compiling against glibc >= 2.42
See also