From 5dbbd42420763fe6f692ce25bf39d66aef98c01b Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 10 Mar 2026 13:53:56 +0100 Subject: [PATCH] Update to 5.86 Re-add btmgmt as it does not require bluetoothd to be running, unlike bluetoothctl mgmt Fix audio output not working in some circumstances Resolves: RHEL-147734 --- ...dp-connect-source-profile-after-sink.patch | 35 ++++ ...nstall-btmgmt-man-page-as-tool-isn-t.patch | 27 --- ...tools-btmgmt-Fix-btmgmt-help-hanging.patch | 32 ++++ 5.83-fixes.patch | 174 ------------------ big-endian-5.86.patch | 41 +++++ bluetoothctl-no-output.patch | 79 ++++++++ bluez.spec | 27 ++- rpminspect.yaml | 2 + sources | 2 +- tests/run_tests.sh | 3 + 10 files changed, 217 insertions(+), 205 deletions(-) create mode 100644 0001-a2dp-connect-source-profile-after-sink.patch delete mode 100644 0001-build-Don-t-install-btmgmt-man-page-as-tool-isn-t.patch create mode 100644 0001-tools-btmgmt-Fix-btmgmt-help-hanging.patch delete mode 100644 5.83-fixes.patch create mode 100644 big-endian-5.86.patch create mode 100644 bluetoothctl-no-output.patch diff --git a/0001-a2dp-connect-source-profile-after-sink.patch b/0001-a2dp-connect-source-profile-after-sink.patch new file mode 100644 index 0000000..26a8986 --- /dev/null +++ b/0001-a2dp-connect-source-profile-after-sink.patch @@ -0,0 +1,35 @@ +From 066a164a524e4983b850f5659b921cb42f84a0e0 Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen +Date: Mon, 16 Feb 2026 18:17:08 +0200 +Subject: [PATCH] a2dp: connect source profile after sink + +Since cdcd845f87ee the order in which profiles with the same priority +are connected is the same order as btd_profile_register() is called, +instead of being the opposite order. When initiating connections, we +want to prefer a2dp-sink profile over a2dp-source, as connecting both at +the same time does not work currently. + +Add .after_services to specify the order. + +Fixes: https://github.com/bluez/bluez/issues/1898 +--- + profiles/audio/a2dp.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c +index 7a37003a2b25..c7e0fc75c09e 100644 +--- a/profiles/audio/a2dp.c ++++ b/profiles/audio/a2dp.c +@@ -3769,6 +3769,9 @@ static struct btd_profile a2dp_source_profile = { + + .adapter_probe = a2dp_sink_server_probe, + .adapter_remove = a2dp_sink_server_remove, ++ ++ /* Connect source after sink, to prefer sink when conflicting */ ++ .after_services = BTD_PROFILE_UUID_CB(NULL, A2DP_SINK_UUID), + }; + + static struct btd_profile a2dp_sink_profile = { +-- +2.53.0 + diff --git a/0001-build-Don-t-install-btmgmt-man-page-as-tool-isn-t.patch b/0001-build-Don-t-install-btmgmt-man-page-as-tool-isn-t.patch deleted file mode 100644 index f5f700a..0000000 --- a/0001-build-Don-t-install-btmgmt-man-page-as-tool-isn-t.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c9ec6137b16aaf371b311f4777a042ec1175719b Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Thu, 29 Jan 2026 13:40:52 +0100 -Subject: [PATCH] build: Don't install btmgmt man page as tool isn't - -The btmgmt tool isn't installed through the Makefiles, so the -man page shouldn't be installed either. ---- - Makefile.tools | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.tools b/Makefile.tools -index 561b03d0b95b..f0b106fae7ef 100644 ---- a/Makefile.tools -+++ b/Makefile.tools -@@ -355,7 +355,7 @@ profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS) - - if MANPAGES - man_MANS += tools/rctest.1 tools/l2ping.1 tools/btattach.1 tools/isotest.1 \ -- tools/btmgmt.1 client/bluetoothctl.1 \ -+ client/bluetoothctl.1 \ - client/bluetoothctl-mgmt.1 \ - client/bluetoothctl-monitor.1 client/bluetoothctl-admin.1 \ - client/bluetoothctl-advertise.1 client/bluetoothctl-endpoint.1 \ --- -2.52.0 - diff --git a/0001-tools-btmgmt-Fix-btmgmt-help-hanging.patch b/0001-tools-btmgmt-Fix-btmgmt-help-hanging.patch new file mode 100644 index 0000000..17071f0 --- /dev/null +++ b/0001-tools-btmgmt-Fix-btmgmt-help-hanging.patch @@ -0,0 +1,32 @@ +From 37f62e78dc3925625c7aaa083dcc410d9bac4940 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Wed, 11 Mar 2026 11:48:45 +0100 +Subject: [PATCH] tools/btmgmt: Fix btmgmt --help hanging + +btmgmt when run interactively would wait for commands on its prompt, but +that prompt is never setup when the help output is requested. + +Handle --help through bt_shell_handle_non_interactive_help() so that the +application exits as soon as the help content has been printed, like +other interactive apps in bluez. +--- + tools/btmgmt.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tools/btmgmt.c b/tools/btmgmt.c +index 0f3de2880014..762a3a141c4a 100644 +--- a/tools/btmgmt.c ++++ b/tools/btmgmt.c +@@ -47,6 +47,9 @@ int main(int argc, char *argv[]) + bt_shell_init(argc, argv, &opt); + + mgmt_add_submenu(); ++ ++ bt_shell_handle_non_interactive_help(); ++ + mgmt_set_index(index_option); + bt_shell_attach(fileno(stdin)); + status = bt_shell_run(); +-- +2.53.0 + diff --git a/5.83-fixes.patch b/5.83-fixes.patch deleted file mode 100644 index 4df039f..0000000 --- a/5.83-fixes.patch +++ /dev/null @@ -1,174 +0,0 @@ -From a3a1298c0f4e2387694ad7ecd952cbd0a0b82c83 Mon Sep 17 00:00:00 2001 -From: Luiz Augusto von Dentz -Date: Thu, 3 Jul 2025 13:30:22 -0400 -Subject: [PATCH 1/2] shared/shell: Fix not calling pre_run for main menu - -When calling bt_shell_run the main menu pre_run was not being called -which cause tools with just one menu to not work as intended. - -Fixes: https://github.com/bluez/bluez/issues/1319 ---- - src/shared/shell.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/shared/shell.c b/src/shared/shell.c -index 3e5959fc1868..c69748594955 100644 ---- a/src/shared/shell.c -+++ b/src/shared/shell.c -@@ -1449,6 +1449,9 @@ int bt_shell_run(void) - int status; - const struct queue_entry *submenu; - -+ if (data.menu && data.menu->pre_run) -+ data.menu->pre_run(data.menu); -+ - for (submenu = queue_get_entries(data.submenus); submenu; - submenu = submenu->next) { - struct bt_shell_menu *menu = submenu->data; --- -2.50.1 - - -From a7ce88a861a0a26b50987ff455f0bb61379aa89c Mon Sep 17 00:00:00 2001 -From: Luiz Augusto von Dentz -Date: Mon, 7 Jul 2025 09:39:43 -0400 -Subject: [PATCH 2/2] shared/shell: Fix not running pre_run on - MODE_NON_INTERACTIVE - -If a command is given to be run in non-interactive mode the code would -not attempt to execute .pre_run first since some (sub)menus requires that -in order to properly initialize things. - -Fixes: https://github.com/bluez/bluez/issues/1394 -Fixes: https://github.com/bluez/bluez/issues/1317 ---- - src/shared/shell.c | 33 +++++++++++++++++++++++---------- - 1 file changed, 23 insertions(+), 10 deletions(-) - -diff --git a/src/shared/shell.c b/src/shared/shell.c -index c69748594955..694ddc0007f5 100644 ---- a/src/shared/shell.c -+++ b/src/shared/shell.c -@@ -423,7 +423,8 @@ static void cmd_script(int argc, char *argv[]) - return bt_shell_noninteractive_quit(EXIT_SUCCESS); - } - --static const struct bt_shell_menu_entry default_menu[] = { -+static const struct bt_shell_menu default_menu = { -+ .entries = { - { "back", NULL, cmd_back, "Return to main menu", NULL, - NULL, cmd_back_exists }, - { "menu", "", cmd_menu, "Select submenu", -@@ -437,7 +438,7 @@ static const struct bt_shell_menu_entry default_menu[] = { - { "export", NULL, cmd_export, - "Print environment variables" }, - { "script", "", cmd_script, "Run script" }, -- { } -+ {} }, - }; - - static void shell_print_help(void) -@@ -480,7 +481,7 @@ static void shell_print_menu(void) - print_menu(entry->cmd, entry->arg ? : "", entry->desc ? : ""); - } - -- for (entry = default_menu; entry->cmd; entry++) { -+ for (entry = default_menu.entries; entry->cmd; entry++) { - if (entry->exists && !entry->exists(data.menu)) - continue; - -@@ -495,7 +496,7 @@ static void shell_print_menu_zsh_complete(void) - for (entry = data.menu->entries; entry->cmd; entry++) - printf("%s:%s\n", entry->cmd, entry->desc ? : ""); - -- for (entry = default_menu; entry->cmd; entry++) { -+ for (entry = default_menu.entries; entry->cmd; entry++) { - if (entry->exists && !entry->exists(data.menu)) - continue; - -@@ -627,9 +628,11 @@ fail: - return -EINVAL; - } - --static int menu_exec(const struct bt_shell_menu_entry *entry, -+static int menu_exec(const struct bt_shell_menu *menu, - int argc, char *argv[]) - { -+ const struct bt_shell_menu_entry *entry = menu->entries; -+ - for (; entry->cmd; entry++) { - if (strcmp(argv[0], entry->cmd)) - continue; -@@ -642,6 +645,9 @@ static int menu_exec(const struct bt_shell_menu_entry *entry, - if (data.menu == data.main && !strcmp(entry->cmd, "back")) - continue; - -+ if (data.mode == MODE_NON_INTERACTIVE && menu->pre_run) -+ menu->pre_run(menu); -+ - return cmd_exec(entry, argc, argv); - } - -@@ -673,7 +679,7 @@ static int submenu_exec(int argc, char *argv[]) - memmove(argv[0], argv[0] + len + 1, tlen - len - 1); - memset(argv[0] + tlen - len - 1, 0, len + 1); - -- return menu_exec(submenu->entries, argc, argv); -+ return menu_exec(submenu, argc, argv); - } - - static int shell_exec(int argc, char *argv[]) -@@ -686,9 +692,9 @@ static int shell_exec(int argc, char *argv[]) - if (!argsisutf8(argc, argv)) - return -EINVAL; - -- err = menu_exec(default_menu, argc, argv); -+ err = menu_exec(&default_menu, argc, argv); - if (err == -ENOENT) { -- err = menu_exec(data.menu->entries, argc, argv); -+ err = menu_exec(data.menu, argc, argv); - if (err == -ENOENT) { - err = submenu_exec(argc, argv); - if (err == -ENOENT) { -@@ -980,7 +986,7 @@ static char *cmd_generator(const char *text, int state) - } - - if (default_menu_enabled) { -- cmd = find_cmd(text, default_menu, &index); -+ cmd = find_cmd(text, default_menu.entries, &index); - if (cmd) { - return cmd; - } else { -@@ -1171,7 +1177,7 @@ static char **shell_completion(const char *text, int start, int end) - if (wordexp(rl_line_buffer, &w, WRDE_NOCMD)) - return NULL; - -- matches = menu_completion(default_menu, text, w.we_wordc, -+ matches = menu_completion(default_menu.entries, text, w.we_wordc, - w.we_wordv[0]); - if (!matches) { - matches = menu_completion(data.menu->entries, text, -@@ -1449,6 +1455,12 @@ int bt_shell_run(void) - int status; - const struct queue_entry *submenu; - -+ /* Check if on non-interactive mode skip pre-run since that is on-demand -+ * by shell_exec() only for the menu in use. -+ */ -+ if (data.mode == MODE_NON_INTERACTIVE) -+ goto done; -+ - if (data.menu && data.menu->pre_run) - data.menu->pre_run(data.menu); - -@@ -1460,6 +1472,7 @@ int bt_shell_run(void) - menu->pre_run(menu); - } - -+done: - status = mainloop_run_with_signal(signal_callback, NULL); - - bt_shell_cleanup(); --- -2.50.1 - diff --git a/big-endian-5.86.patch b/big-endian-5.86.patch new file mode 100644 index 0000000..a0f83e4 --- /dev/null +++ b/big-endian-5.86.patch @@ -0,0 +1,41 @@ +From 3a5c4d311755910f07e60fd30d4736ac98bea8eb Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Tue, 10 Feb 2026 10:06:28 +0100 +Subject: [PATCH] emulator: Fix compilation on big endian systems +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes the build on big endian systems like s390x: + +Remove the "static" so the array doesn't need to be initialised +with constants. + +emulator/bthost.c: In function ‘bthost_setup_sco’: +./src/shared/util.h:43:26: error: initializer element is not constant + 43 | #define cpu_to_le32(val) bswap_32(val) + | ^~~~~~~~ +etc. + +Fixes: 85888a8357ea ("bthost: add bthost_setup_sco() and accept +incoming eSCO") +--- + emulator/bthost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/emulator/bthost.c b/emulator/bthost.c +index d09ad1e76c50..53b12f828675 100644 +--- a/emulator/bthost.c ++++ b/emulator/bthost.c +@@ -3560,7 +3560,7 @@ void bthost_hci_disconnect(struct bthost *bthost, uint16_t handle, + int bthost_setup_sco(struct bthost *bthost, uint16_t acl_handle, + uint16_t setting) + { +- static const struct bt_hci_cmd_setup_sync_conn settings[] = { ++ const struct bt_hci_cmd_setup_sync_conn settings[] = { + { + .tx_bandwidth = cpu_to_le32(0x00001f40), + .rx_bandwidth = cpu_to_le32(0x00001f40), +-- +2.52.0 + diff --git a/bluetoothctl-no-output.patch b/bluetoothctl-no-output.patch new file mode 100644 index 0000000..11a184b --- /dev/null +++ b/bluetoothctl-no-output.patch @@ -0,0 +1,79 @@ +From 33dd33a23ff250902eafa94fce5ea8178de50112 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Fri, 27 Feb 2026 12:07:14 +0100 +Subject: [PATCH 1/2] Revert "shared/shell: Don't init input for + non-interactive shells" + +This reverts commit e73bf582dae60356641a32fc27ae03d359ec4c47. + +The fix caused "bluetoothctl list" to not output any text, breaking +a lot of existing scripts. + +Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2440346 +--- + src/shared/shell.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/shared/shell.c b/src/shared/shell.c +index 78d58c513d3e..b061f8001414 100644 +--- a/src/shared/shell.c ++++ b/src/shared/shell.c +@@ -1642,13 +1642,13 @@ static bool shell_quit(void *data) + + bool bt_shell_attach(int fd) + { +- if (data.mode == MODE_INTERACTIVE) { +- struct input *input; ++ struct input *input; + +- input = input_new(fd); +- if (!input) +- return false; ++ input = input_new(fd); ++ if (!input) ++ return false; + ++ if (data.mode == MODE_INTERACTIVE) { + io_set_read_handler(input->io, input_read, input, NULL); + io_set_disconnect_handler(input->io, input_hup, input, NULL); + +-- +2.53.0 + + +From 0178bc8bda31cf60837fcce91b33e009bc3f7d7d Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Fri, 27 Feb 2026 12:24:13 +0100 +Subject: [PATCH 2/2] tools: Work-around broken stdin handling in home-made + mainloop + +bluetoothd has 3 mainloop implementations, one relying on ell, one +relying on glib, and another home-made. + +The home-made mainloop handler use epoll() without any fallbacks, and +will hang if one tries to epoll() an stdin that redirects from +/dev/null. + +Closes: https://github.com/bluez/bluez/issues/700 +--- + Makefile.tools | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.tools b/Makefile.tools +index 589f7c94f9df..7c52e053ffee 100644 +--- a/Makefile.tools ++++ b/Makefile.tools +@@ -531,8 +531,8 @@ tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \ + + tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c \ + client/mgmt.c +-tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \ +- -lreadline ++tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-glib.la \ ++ $(GLIB_LIBS) -lreadline + if DEPRECATED + noinst_PROGRAMS += attrib/gatttool + +-- +2.53.0 + diff --git a/bluez.spec b/bluez.spec index f5b9d7d..cc7116a 100644 --- a/bluez.spec +++ b/bluez.spec @@ -5,7 +5,7 @@ %endif Name: bluez -Version: 5.85 +Version: 5.86 Release: 1%{?dist} Summary: Bluetooth utilities License: GPLv2+ @@ -18,8 +18,14 @@ Source1: bluez.gitignore Patch1: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch # https://patchwork.kernel.org/project/bluetooth/patch/20240214155019.325715-1-hadess@hadess.net/ Patch2: 0001-Add-missing-mesh-gatt-JSON-files.patch -# https://patchwork.kernel.org/project/bluetooth/patch/20260129125948.2724071-2-hadess@hadess.net/ -Patch3: 0001-build-Don-t-install-btmgmt-man-page-as-tool-isn-t.patch +# https://patchwork.kernel.org/project/bluetooth/list/?series=1052631 +Patch3: big-endian-5.86.patch +# https://patchwork.kernel.org/project/bluetooth/patch/ba0e71b91a24557f088b015a349c6ccee6260ec2.1771258477.git.pav@iki.fi/ +Patch4: 0001-a2dp-connect-source-profile-after-sink.patch +# https://patchwork.kernel.org/project/bluetooth/list/?series=1058931 +Patch5: bluetoothctl-no-output.patch +# https://patchwork.kernel.org/project/bluetooth/patch/20260311111540.2170373-2-hadess@hadess.net/ +Patch6: 0001-tools-btmgmt-Fix-btmgmt-help-hanging.patch BuildRequires: dbus-devel >= 1.6 BuildRequires: glib2-devel @@ -172,6 +178,12 @@ done # Red Hat Bugzilla bug #1699680 install -m0755 tools/avinfo $RPM_BUILD_ROOT%{_bindir} +# btmgmt is not installed by "make install", but it is useful for debugging +# some issues and to set the MAC address on HCIs which don't have their +# MAC address configured +install -m0755 tools/btmgmt $RPM_BUILD_ROOT%{_bindir} +install -m0644 doc/btmgmt.1 $RPM_BUILD_ROOT%{_mandir}/man1/ + # Remove libtool archive find $RPM_BUILD_ROOT -name '*.la' -delete @@ -239,12 +251,14 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/ %{_bindir}/bluemoon %{_bindir}/bluetoothctl %{_bindir}/btattach +%{_bindir}/btmgmt %{_bindir}/btmon %{_bindir}/hex2hcd %{_bindir}/l2ping %{_bindir}/mpris-proxy %{_mandir}/man1/bluetoothctl.1.* %{_mandir}/man1/bluetoothctl-*.1.* +%{_mandir}/man1/btmgmt.1.* %{_mandir}/man1/btattach.1.* %{_mandir}/man1/btmon.1.* %{_mandir}/man1/l2ping.1.* @@ -332,6 +346,13 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/ %{_userunitdir}/obex.service %changelog +* Tue Feb 10 2026 Bastien Nocera - 5.86-1 +- Update to 5.86 +- Re-add btmgmt as it does not require bluetoothd to be running, + unlike bluetoothctl mgmt +- Fix audio output not working in some circumstances + Resolves: RHEL-147734 + * Mon Jan 26 2026 Bastien Nocera - 5.85-1 - Update to 5.85 Resolves: RHEL-142552 diff --git a/rpminspect.yaml b/rpminspect.yaml index 2b4543b..2697490 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -3,3 +3,5 @@ badfuncs: allowed: /usr/bin/btmon: - inet_addr + /usr/libexec/bluetooth/btvirt: + - inet_addr diff --git a/sources b/sources index bb6b4f2..1eafce8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bluez-5.85.tar.xz) = 5bee1734dc0e67e99a655b894b0a191d43a3ca9d7834186dcbf82a0f1e51c510723a9877e0b1a0bf53296c22acc8eae8260a04d8d288d94c37310b4ac6bc0a69 +SHA512 (bluez-5.86.tar.xz) = d3268be43ad869dabd9d9eabc7a0da699837bb5432ecf61e1756e03f9b867a1d989299db1493bd349d73b495d736f55d7518fbb9ee664de49e5d1cf7c2156df7 diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 9c7d570..82d67e7 100644 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -17,6 +17,9 @@ bluetoothctl --timeout 2 --help # Is btattach present and doesn't fail if called btattach --version +# Is btmgmt present and doesn't fail if called +btmgmt --help + # Is bluetoothctl mgmt's menu is present and doesn't fail if called bluetoothctl --timeout 2 --help | grep mgmt