Skip to content

Fixes for Linux and POSIX speed interfaces; support "sane" termios systems - #24

Open
hpax wants to merge 5 commits into
sigrokproject:masterfrom
hpax:master
Open

Fixes for Linux and POSIX speed interfaces; support "sane" termios systems#24
hpax wants to merge 5 commits into
sigrokproject:masterfrom
hpax:master

Conversation

@hpax

@hpax hpax commented Sep 11, 2025

Copy link
Copy Markdown

I ran into a problem with libserialport on Fedora 43 beta, which
includes glibc 2.42 which updates termios to actually handle arbitrary
speeds.

The first patch contains the fix for that problem (must clean CIBAUD.)

The second patch contains a fix for reading the current speed: per
POSIX, if only one speed is supported, it is the output speed that
counts, not the input speed.

The third patch contains machinery to detect if termios.h Bxxx
constants are identity mapped, and if so, simply uses them as numbers
-- which is of course what they should have been from the start.

abraxa and others added 4 commits October 13, 2024 13:22
In case the serial port was already set up with split speed, using one
of the standard speed constants (i.e. not BOTHER) it is necessary to
clear CIBAUD to revert back to single speed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
POSIX is pretty clear that if only one speed is supported, it is the
output speed setting that counts. On some platforms, the input speed
can even end up being reported as 0 for single speed configuration.

Thus, look at the output speed setting, not the input speed setting.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
If termios speed_t is a direct mapping to bauds, it is presumably safe
to assume that it can be used as a generic interface.  This applies to
Linux with glibc 2.42+, GNU Hurd, and at least some BSDs.

Try to detect this case and if so, do the simple thing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
@f5bud

f5bud commented Oct 31, 2025

Copy link
Copy Markdown

I regularly use gtkterm to send commands to a serial device. On the latest version of Fedora (43), there is no communication. I don't know if the command is being sent or if the response is not being received.

I recreated the gtkterm profile, but the problem persists.

This could be related to changes made to termios in glibc 2.42 that were integrated into Fedora 43.

  • Did everything work correctly in Fedora 42?
    Yes, it works in version 42 and older versions.
    I am using a CH340 USB-to-serial adapter.

@hpax

hpax commented Nov 1, 2025

Copy link
Copy Markdown
Author

I regularly use gtkterm to send commands to a serial device. On the latest version of Fedora (43), there is no communication. I don't know if the command is being sent or if the response is not being received.

This is not related to libserialport as gtkterm doesn't use it; you should file a bug report to the appropriate plate for gtkterm or to the Fedora bugzilla.

You can use stty to verify or adjust the serial port parameters; the stty in Fedora 43 is aware of arbitrary baud rates and split speed.

libserialport 0.1.2 release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants