From 264bf951f2d687f520898fa3e182291f1261e3a7 Mon Sep 17 00:00:00 2001 From: Ludovico de Nittis Date: Tue, 28 Jan 2025 12:56:59 +0100 Subject: [PATCH] device: Clear pending_flags on error If setting WakeAllowed, or the device privacy, fails, we may end up in a situation where `pending_flags` is still set to some `DEVICE_FLAG_*` values, for example from `device_set_wake_allowed()` or `adapter_set_device_flags()`. This can confuse further requests because they'll assume that there is still a pending request in progress. --- src/adapter.c | 1 + src/device.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index da602a7b8..cbe5b1979 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -5583,6 +5583,7 @@ static void set_device_privacy_complete(uint8_t status, uint16_t length, if (status != MGMT_STATUS_SUCCESS) { error("Set device flags return status: %s", mgmt_errstr(status)); + btd_device_set_pending_flags(dev, 0); return; } diff --git a/src/device.c b/src/device.c index 39416de01..ec97fc889 100644 --- a/src/device.c +++ b/src/device.c @@ -1575,6 +1575,7 @@ static void set_wake_allowed_complete(uint8_t status, uint16_t length, dev->wake_id = -1U; } dev->pending_wake_allowed = FALSE; + dev->pending_flags = 0; return; } -- 2.47.3