From: Aaron Brice <aaron@embeddedts.com>
To: linux-bluetooth@vger.kernel.org
Cc: Aaron Brice <aaron@embeddedts.com>
Subject: [PATCH BlueZ v2] btattach: Update for glibc 2.42 compatibility
Date: Thu, 3 Sep 2026 15:20:05 -0700 [thread overview]
Message-ID: <20260903222005.482058-1-aaron@embeddedts.com> (raw)
btattach is not setting the baud rate correctly on systems with newer
glibc such as Ubuntu 26.04. In glibc 2.42 the baud rate termios.h
constants changed value, B115200 was 0x1002 which was the struct
termios c_cflag enum bits, but in 2.42 they changed cfsetspeed() to
accept arbitrary rates and not just the baud enum values, and B115200
was changed to the value 115200. This means you can no longer set the
speed with c_cflag |= B115200 and should use cfsetspeed() to be
compatible with both versions.
---
tools/btattach.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/btattach.c b/tools/btattach.c
index 5f7d19093..cdd7b125b 100644
--- a/tools/btattach.c
+++ b/tools/btattach.c
@@ -64,7 +64,12 @@ static int open_serial(const char *path, unsigned int speed, bool flowctl)
memset(&ti, 0, sizeof(ti));
cfmakeraw(&ti);
- ti.c_cflag |= (speed | CLOCAL | CREAD);
+ ti.c_cflag |= (CLOCAL | CREAD);
+ if (cfsetspeed(&ti, speed) < 0) {
+ perror("Failed to set serial port speed");
+ close(fd);
+ return -1;
+ }
if (flowctl) {
/* Set flow control */
--
2.53.0
next reply other threads:[~2026-09-03 22:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 22:20 Aaron Brice [this message]
2026-09-03 23:47 ` [BlueZ,v2] btattach: Update for glibc 2.42 compatibility bluez.test.bot
2026-09-04 20:20 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260903222005.482058-1-aaron@embeddedts.com \
--to=aaron@embeddedts.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox