Hello Faidon,
I've looked into it further and confirmed thatt he support for
arbitrary baud rates via <termios.h> was introduced in glibc 2.42.
However, most current Debian environments (including stable and
testing) are still using glibc versions < 2.42, so the new support is not yet
available there.
Given this, we’d still need to rely on the <termbits.h>. But
once Debian moves to glibc 2.42, we can definitely consider
simplifying the code by switching to the standard
<termios.h> API conditionally.
I had brought this up with upstream about a year ago. This is about non-standard custom baud rates and platform differences, on either the kernel side, glibc side, or both -- that part is unclear to me. In the time since, glibc 2.41 was released, which includes a news entry on <termios.h> gaining support for arbitrary baud rates, so perhaps the right cross-platform fix here is to change the code to rely on that, instead of using <termbits.h> directly. It needs a bit more research, and ideally to run this by upstream as well, as I don't have any way to test this particular functionality. Feel free to take this on, otherwise I may find some time in the next few months to look at it.