diff mbox series

[BlueZ,2/3] device: Preserve pending flags when setting the wake allowed

Message ID 20250325172846.139431-3-ludovico.denittis@collabora.com (mailing list archive)
State New
Headers show
Series Fix wake_allowed reported error and not being set after pairing | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

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.
In device_set_wake_allowed() we only want to either add or remove the
remote wakeup flag, while keeping the existing flags as-is.
---
 src/device.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index e8bff718c..474ec5763 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1605,6 +1605,10 @@  void device_set_wake_allowed(struct btd_device *device, bool wake_allowed,
 	device->pending_wake_allowed = wake_allowed;
 
 	flags = device->current_flags;
+
+	/* Include the pending flags, or they may get overwritten. */
+	flags |= device->pending_flags;
+
 	if (wake_allowed)
 		flags |= DEVICE_FLAG_REMOTE_WAKEUP;
 	else