From 41cfe55ea759d528db7a0042056eb39e3bab84a6 Mon Sep 17 00:00:00 2001 From: Ludovico de Nittis Date: Tue, 25 Mar 2025 18:28:45 +0100 Subject: [PATCH] device: Preserve pending flags when setting the wake allowed 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 --git a/src/device.c b/src/device.c index 57577e579..0e563f961 100644 --- a/src/device.c +++ b/src/device.c @@ -1628,6 +1628,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 -- 2.47.3