[Pkg-electronics-devel] Bug#990863: libserialport0: libserialport tries to use termiox on bullseye, and fails to open serial ports

Tim Small tim at seoss.co.uk
Fri Jul 9 17:55:52 BST 2021


Package: libserialport0
Version: 0.1.1-3+b1
Severity: important
Tags: upstream patch
X-Debbugs-Cc: tim at seoss.co.uk

Serial port open seems to fail on bullseye.  Strace output follows:

1512868 openat(AT_FDCWD, "/dev/ttyACM0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 9
1512868 ioctl(9, TCGETS, {B9600 opost isig icanon echo ...}) = 0
1512868 ioctl(9, TIOCMGET, [TIOCM_DTR|TIOCM_RTS|TIOCM_CTS]) = 0
1512868 ioctl(9, TCGETX, 0x55cd7cc80df0) = -1 ENOTTY (Inappropriate ioctl for device)
1512868 close(9)                        = 0
1512868 write(2, "sr: ", 4)             = 4
1512868 write(2, "serial-libsp: Error opening port"..., 71) = 71
1512868 write(2, "No devices found.\n", 18) = 18

Applying upstream commit 6f9b03e597ea fixes the issue.  I tested this
with:

/usr/local/bin/sigrok-cli --driver=rdtech-tc:conn=/dev/ttyACM0 --continuous

Patch here:

https://github.com/sigrokproject/libserialport/commit/6f9b03e597ea7200eb616a4e410add3dd1690cb1

I suspect that libserialport0 will fail to open all serial ports on
bullseye without this fix, so this bug may unfortunately be RC?

Cheers,

Tim.



-- System Information:
Debian Release: 11.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-7-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_WARN, TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libserialport0 depends on:
ii  libc6  2.31-12

libserialport0 recommends no packages.

libserialport0 suggests no packages.

-- no debconf information
-------------- next part --------------
>From 6f9b03e597ea7200eb616a4e410add3dd1690cb1 Mon Sep 17 00:00:00 2001
From: Karl Palsson <karlp at etactica.com>
Date: Fri, 11 Jun 2021 17:07:09 +0000
Subject: [PATCH] HACK: don't even check for termiox

termiox was removed from linux in e0efb3168d34
Some more information available in https://www.spinics.net/lists/linux-serial/msg41926.html

Attempting to use the termiox ioctls on more modern kernels results in
"Inappropriate IOCTL" errors.

While the "right" solution might be to remove the termiox code from the
linux path, simply not checking for termiox builds a libserialport that
functions on modern linux kernels.

Signed-off-by: Karl Palsson <karlp at etactica.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index b1af16f..a26b851 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,7 @@ AC_SYS_LARGEFILE
 AC_TYPE_SIZE_T
 
 # Check for specific termios structures.
-AC_CHECK_TYPES([struct termios2, struct termiox],,,
+AC_CHECK_TYPES([struct termios2],,,
 	[[#include <linux/termios.h>]])
 AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed,
 		struct termios2.c_ispeed, struct termios2.c_ospeed],,,
-- 
2.30.2



More information about the Pkg-electronics-devel mailing list