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 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 -- 2.49.0