diff mbox series

[BlueZ,1/3] adapter: Preserve pending flags when setting the Device Privacy Mode

Message ID 20250325172846.139431-2-ludovico.denittis@collabora.com
State New
Headers show
Series Fix wake_allowed reported error and not being set after pairing | expand

Commit Message

Ludovico de Nittis March 25, 2025, 5:28 p.m. UTC
If there are already flags that are pending to be applied, we should
keep them to avoid overwriting them.
At that point we only want to add the Device Privacy Mode on top of the
existing flags.
---
 src/adapter.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 5d4117a49..d4e42eed8 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -5630,8 +5630,11 @@  static void add_device_complete(uint8_t status, uint16_t length,
 	if (btd_opts.device_privacy) {
 		uint32_t flags = btd_device_get_current_flags(dev);
 
-		/* Set Device Privacy Mode has not set the flag yet. */
+		/* Set Device Privacy Mode if it has not set the flag yet. */
 		if (!(flags & DEVICE_FLAG_DEVICE_PRIVACY)) {
+			/* Include the pending flags, or they may get overwritten. */
+			flags |= btd_device_get_pending_flags(dev);
+
 			adapter_set_device_flags(adapter, dev, flags |
 						DEVICE_FLAG_DEVICE_PRIVACY,
 						set_device_privacy_complete,