Skip to contentSkip to conversation

btattach: Update for glibc 2.42 compatibility

PATCH Applied Aaron Brice 3 participants 3 messages Sep 3 – Sep 4 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 btattach: Update for glibc 2.42 compatibility

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(-)
tools/btattach.c +6 -1
index 5f7d19093..cdd7b125b 100644
@@ -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 */
Signature · 1 line
2.53.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1157441

---Test result---

Test Summary:

CheckPatch                    PASS      0.45 seconds
GitLint                       PASS      0.31 seconds
BuildEll                      PASS      15.85 seconds
BluezMake                     PASS      494.98 seconds
CheckSmatch                   PASS      231.22 seconds
bluezmakeextell               PASS      74.44 seconds
IncrementalBuild              PASS      453.86 seconds
ScanBuild                     PASS      718.81 seconds

https://github.com/bluez/bluez/pull/2490

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Aaron Brice
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Thu, 3 Sep 2026 15:20:05 -0700 you wrote:

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.

[...]

Here is the summary with links:
- [BlueZ,v2] btattach: Update for glibc 2.42 compatibility

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=12f5eb726c6e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html