From fe897284c1147fb3c646f53aa439603eab6da60d Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Jul 01 2023 13:44:46 +0000 Subject: 5.68 --- diff --git a/0001-adapter-Use-regular-discovery-for-filters-which-only.patch b/0001-adapter-Use-regular-discovery-for-filters-which-only.patch deleted file mode 100644 index d4ca62c..0000000 --- a/0001-adapter-Use-regular-discovery-for-filters-which-only.patch +++ /dev/null @@ -1,124 +0,0 @@ -From de8e7cfce25b8d717f5ee60ee3b79d426fdcc681 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 31 Mar 2023 22:03:29 +0200 -Subject: [PATCH] adapter: Use regular discovery for filters which only have - discoverable set - -discovery_filter_to_mgmt_cp() does not add discovery_filter.discoverable -to the created mgmt_cp_start_service_discovery struct. - -Instead update_discovery_filter() separately checks -client->discovery_filter->discoverable for all clients. - -This means that for discovery-filters which only have the discoverable -flag set, to put the adapter in discoverable mode while discovering, -the created mgmt_cp_start_service_discovery struct is empty. - -This empty mgmt_cp_start_service_discovery struct then gets sent -to the kernel as part of a MGMT_OP_START_SERVICE_DISCOVERY msg -by start_discovery_timeout(). - -This use of an empty filter with MGMT_OP_START_SERVICE_DISCOVERY -causes some bluetooth devices to not get seen with some (most?) -Broadcom bluetooth adapters. This problem has been observed with -the following Broadcom models: BCM4343A0, BCM43430A1, BCM43341B0 . - -On these models the following 2 devices were not being discovered -when starting a scan with a filter with just discoverable set -in the filter (as gnome-bluetooth does): - -Device 09:02:01:03:0F:87 (public) - Name: Bluetooth 3.0 Keyboard - Alias: Bluetooth 3.0 Keyboard - Class: 0x00000540 - Icon: input-keyboard - Paired: yes - Bonded: yes - Trusted: yes - Blocked: no - Connected: yes - WakeAllowed: yes - LegacyPairing: yes - UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb) - UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb) - UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) - Modalias: bluetooth:v05ACp022Cd011B - -Device 00:60:D1:00:00:34 (public) - Name: Bluetooth Mouse - Alias: Bluetooth Mouse - Class: 0x00002580 - Icon: input-mouse - Paired: yes - Bonded: yes - Trusted: yes - Blocked: no - Connected: yes - WakeAllowed: yes - LegacyPairing: no - UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb) - UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) - Modalias: usb:v0103p0204d001E - -Since setting the discoverable flag on a filter only is a way to -automatically put the adapter in discoverable mode itself while -it is discovering; and since this does not any device filtering -at all; modify merge_discovery_filters() to treat discovery with -such filters as regular unfiltered discovery. - -This results in start_discovery_timeout() starting regular -discovery through a MGMT_OP_START_DISCOVERY message and this -fixes these 2 example devices not getting discovered by the -mentioned Broadcom BT adapter models. - -Link: https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/merge_requests/163 -Reviewed-by: Bastien Nocera ---- - src/adapter.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/src/adapter.c b/src/adapter.c -index 7947160a6c5c..cc7f891d96d9 100644 ---- a/src/adapter.c -+++ b/src/adapter.c -@@ -2192,6 +2192,7 @@ static int merge_discovery_filters(struct btd_adapter *adapter, int *rssi, - bool empty_uuid = false; - bool has_regular_discovery = false; - bool has_filtered_discovery = false; -+ uint8_t adapter_scan_type = get_scan_type(adapter); - - for (l = adapter->discovery_list; l != NULL; l = g_slist_next(l)) { - struct discovery_client *client = l->data; -@@ -2202,6 +2203,20 @@ static int merge_discovery_filters(struct btd_adapter *adapter, int *rssi, - continue; - } - -+ /* -+ * Detect empty filter with only discoverable -+ * (which does not require a kernel filter) set. -+ */ -+ if (item->uuids == NULL && -+ item->pathloss == DISTANCE_VAL_INVALID && -+ item->rssi == DISTANCE_VAL_INVALID && -+ item->type == adapter_scan_type && -+ item->duplicate == false && -+ item->pattern == NULL) { -+ has_regular_discovery = true; -+ continue; -+ } -+ - has_filtered_discovery = true; - - *transport |= item->type; -@@ -2251,7 +2266,7 @@ static int merge_discovery_filters(struct btd_adapter *adapter, int *rssi, - * It there is both regular and filtered scan running, then - * clear whole fitler to report all devices. - */ -- *transport = get_scan_type(adapter); -+ *transport = adapter_scan_type; - *rssi = HCI_RSSI_INVALID; - g_slist_free(*uuids); - *uuids = NULL; --- -2.41.0 - diff --git a/bluez.spec b/bluez.spec index c6ca949..eacf426 100644 --- a/bluez.spec +++ b/bluez.spec @@ -5,8 +5,8 @@ %endif Name: bluez -Version: 5.66 -Release: 6%{?dist} +Version: 5.68 +Release: 1%{?dist} Summary: Bluetooth utilities License: GPLv2+ URL: http://www.bluez.org/ @@ -15,12 +15,10 @@ Source0: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.xz Source1: bluez.gitignore # https://github.com/hadess/bluez/commits/obex-5.46 -Patch1: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch +# Upstream's logic has changed so needs a rebase +#Patch1: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch # https://lore.kernel.org/linux-bluetooth/20220901110719.176944-1-hadess@hadess.net/T/#m9c08d004cd5422783ee1d93154f42303bba9169f Patch2: power-state-adapter-property.patch -# Upstreamed patches -Patch3: transient-hostname-fix.patch -Patch4: 0001-adapter-Use-regular-discovery-for-filters-which-only.patch BuildRequires: dbus-devel >= 1.6 BuildRequires: glib2-devel @@ -235,7 +233,7 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/ %license COPYING %doc AUTHORS ChangeLog %dir %{_sysconfdir}/bluetooth -%config %{_sysconfdir}/bluetooth/main.conf +%config(noreplace) %{_sysconfdir}/bluetooth/main.conf %config %{_sysconfdir}/dbus-1/system.d/bluetooth.conf %{_bindir}/avinfo %{_bindir}/bluemoon @@ -306,7 +304,7 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/ %files mesh #%doc tools/mesh-gatt/*.json -%config %{_sysconfdir}/bluetooth/mesh-main.conf +%config(noreplace) %{_sysconfdir}/bluetooth/mesh-main.conf %config %{_sysconfdir}/dbus-1/system.d/bluetooth-mesh.conf %{_bindir}/mesh-cfgclient %{_bindir}/mesh-cfgtest @@ -322,6 +320,10 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/ %{_userunitdir}/obex.service %changelog +* Sat Jul 01 2023 Peter Robinson - 5.68-1 +- Update to 5.68 +- Don't replace modified configs on upgrade (rhbz#2173029) + * Sun Jun 25 2023 Bastien Nocera - 5.66-6 - Add patch that fixes some devices not being discoverable in GNOME's Bluetooth Settings diff --git a/sources b/sources index 1820189..899fdb0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bluez-5.66.tar.xz) = ed0994932687eacf27207867366671b323671f5d5199daf36ea5eff8f254f2bc99ef989ef7df9883b35c06f2af60452be8bad0a06109428a4717cf2b247b4865 +SHA512 (bluez-5.68.tar.xz) = 1805fb68923a5e098777b69835d7593396f8f2bbf52e1cfe58e7447621497a700b23389c79e96b2d663c611335f6ea9df11efe8aa75a8842f6b73105f66e799c diff --git a/transient-hostname-fix.patch b/transient-hostname-fix.patch deleted file mode 100644 index fef2776..0000000 --- a/transient-hostname-fix.patch +++ /dev/null @@ -1,185 +0,0 @@ -From e515f4b6e25c971c47ab79e9cbdfa17119bbde23 Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Wed, 9 Nov 2022 16:17:55 +0100 -Subject: [PATCH 1/2] hostname: Add '' around printed strings - -Otherwise we can't see whether the string is nul, or empty. ---- - plugins/hostname.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/plugins/hostname.c b/plugins/hostname.c -index 1a9513adb..14b6450b5 100644 ---- a/plugins/hostname.c -+++ b/plugins/hostname.c -@@ -128,7 +128,7 @@ static void property_changed(GDBusProxy *proxy, const char *name, - - dbus_message_iter_get_basic(iter, &str); - -- DBG("pretty hostname: %s", str); -+ DBG("pretty hostname: '%s'", str); - - g_free(pretty_hostname); - pretty_hostname = g_strdup(str); -@@ -146,7 +146,7 @@ static void property_changed(GDBusProxy *proxy, const char *name, - - dbus_message_iter_get_basic(iter, &str); - -- DBG("static hostname: %s", str); -+ DBG("static hostname: '%s'", str); - - g_free(static_hostname); - static_hostname = g_strdup(str); -@@ -165,7 +165,7 @@ static void property_changed(GDBusProxy *proxy, const char *name, - - dbus_message_iter_get_basic(iter, &str); - -- DBG("chassis: %s", str); -+ DBG("chassis: '%s'", str); - - for (i = 0; chassis_table[i].chassis; i++) { - if (strcmp(chassis_table[i].chassis, str)) --- -2.37.3 - - -From e2b2b1675f310023862319ea10ffd205a75cc0cb Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Wed, 9 Nov 2022 16:17:56 +0100 -Subject: [PATCH 2/2] hostname: Fallback to transient hostname - -After pretty hostname, and static hostname, also support transient -hostname as a last resort before 'BlueZ X.XX'. - -This happens on Fedora's Workstation installation as it calls -"hostnamectl set-hostname" on startup. In Fedora Silverblue, the default -hostname is set as fedora in /etc/os-release. - -In both cases, we should fall back to that transient hostname, as bad as -it could be. - -Note that the transient hostname needs to be monitored through the -kernel directly, as explained in: -https://www.freedesktop.org/software/systemd/man/org.freedesktop.hostname1.html ---- - plugins/hostname.c | 57 ++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 55 insertions(+), 2 deletions(-) - -diff --git a/plugins/hostname.c b/plugins/hostname.c -index 14b6450b5..51707f07d 100644 ---- a/plugins/hostname.c -+++ b/plugins/hostname.c -@@ -16,6 +16,8 @@ - #include - #include - #include -+#include -+#include - - #include "lib/bluetooth.h" - #include "lib/sdp.h" -@@ -44,8 +46,10 @@ - static uint8_t major_class = MAJOR_CLASS_MISCELLANEOUS; - static uint8_t minor_class = MINOR_CLASS_UNCATEGORIZED; - --static char *pretty_hostname = NULL; --static char *static_hostname = NULL; -+static char *pretty_hostname = NULL; -+static char *static_hostname = NULL; -+static char *transient_hostname = NULL; -+static guint hostname_id = 0; - - /* - * Fallback to static hostname only if empty pretty hostname was already -@@ -60,6 +64,10 @@ static const char *get_hostname(void) - if (static_hostname && - g_str_equal(static_hostname, "") == FALSE) - return static_hostname; -+ -+ if (transient_hostname && -+ g_str_equal(transient_hostname, "") == FALSE) -+ return transient_hostname; - } - - return NULL; -@@ -181,6 +189,32 @@ static void property_changed(GDBusProxy *proxy, const char *name, - } - } - -+static void read_transient_hostname(void) -+{ -+ struct utsname u; -+ -+ if (uname(&u) != 0) { -+ g_free(transient_hostname); -+ transient_hostname = NULL; -+ DBG("failed to read transient hostname"); -+ return; -+ } -+ -+ g_free(transient_hostname); -+ transient_hostname = g_strdup(u.nodename); -+ -+ DBG("read transient hostname: '%s'", transient_hostname); -+} -+ -+static gboolean hostname_cb(GIOChannel *io, GIOCondition cond, -+ gpointer user_data) -+{ -+ DBG("transient hostname changed"); -+ read_transient_hostname(); -+ adapter_foreach(update_class, NULL); -+ return TRUE; -+} -+ - static int hostname_probe(struct btd_adapter *adapter) - { - DBG(""); -@@ -261,9 +295,11 @@ static GDBusProxy *hostname_proxy = NULL; - static int hostname_init(void) - { - DBusConnection *conn = btd_get_dbus_connection(); -+ int fd; - int err; - - read_dmi_fallback(); -+ read_transient_hostname(); - - hostname_client = g_dbus_client_new(conn, "org.freedesktop.hostname1", - "/org/freedesktop/hostname1"); -@@ -289,6 +325,17 @@ static int hostname_init(void) - hostname_client = NULL; - } - -+ fd = open("/proc/sys/kernel/hostname", O_RDONLY); -+ if (fd < 0) { -+ error("open(/proc/sys/kernel/hostname): %s (%d)", -+ strerror(errno), errno); -+ } else { -+ GIOChannel *io = g_io_channel_unix_new(fd); -+ -+ hostname_id = g_io_add_watch(io, G_IO_ERR, hostname_cb, NULL); -+ g_io_channel_unref(io); -+ } -+ - return err; - } - -@@ -306,8 +353,14 @@ static void hostname_exit(void) - hostname_client = NULL; - } - -+ if (hostname_id != 0) { -+ g_source_remove(hostname_id); -+ hostname_id = 0; -+ } -+ - g_free(pretty_hostname); - g_free(static_hostname); -+ g_free(transient_hostname); - } - - BLUETOOTH_PLUGIN_DEFINE(hostname, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, --- -2.37.3 -