* [PATCH BlueZ v2 1/2] client/btpclient: Fix GAP unpair command
@ 2026-05-19 8:50 Frédéric Danis
2026-05-19 8:50 ` [PATCH BlueZ v2 2/2] client/btpclient: Don't remove all devices on GAP Reset command Frédéric Danis
2026-05-19 12:23 ` [BlueZ,v2,1/2] client/btpclient: Fix GAP unpair command bluez.test.bot
0 siblings, 2 replies; 3+ messages in thread
From: Frédéric Danis @ 2026-05-19 8:50 UTC (permalink / raw)
To: linux-bluetooth
Fix unpair_reply() because the device is no more available on
RemoveDevice reply.
---
client/btpclient/gap.c | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/client/btpclient/gap.c b/client/btpclient/gap.c
index 68e029dcc..a14cd4795 100644
--- a/client/btpclient/gap.c
+++ b/client/btpclient/gap.c
@@ -2174,17 +2174,15 @@ failed:
btp_send_error(btp, BTP_GAP_SERVICE, index, status);
}
+struct unpair_req {
+ uint8_t index;
+ struct btp_device *device;
+};
+
static void unpair_reply(struct l_dbus_proxy *proxy,
struct l_dbus_message *result, void *user_data)
{
- struct btp_device *device = user_data;
- struct btp_adapter *adapter = find_adapter_by_device(device);
-
- if (!adapter) {
- btp_send_error(btp, BTP_GAP_SERVICE, BTP_INDEX_NON_CONTROLLER,
- BTP_ERROR_FAIL);
- return;
- }
+ struct unpair_req *req = user_data;
if (l_dbus_message_is_error(result)) {
const char *name, *desc;
@@ -2192,19 +2190,19 @@ static void unpair_reply(struct l_dbus_proxy *proxy,
l_dbus_message_get_error(result, &name, &desc);
l_error("Failed to unpair (%s), %s", name, desc);
- btp_send_error(btp, BTP_GAP_SERVICE, adapter->index,
- BTP_ERROR_FAIL);
+ btp_send_error(btp, BTP_GAP_SERVICE, req->index,
+ BTP_ERROR_FAIL);
return;
}
- btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_UNPAIR, adapter->index, 0,
- NULL);
+ btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_UNPAIR, req->index, 0,
+ NULL);
}
static void unpair_setup(struct l_dbus_message *message, void *user_data)
{
- struct btp_device *device = user_data;
- const char *path = l_dbus_proxy_get_path(device->proxy);
+ struct unpair_req *req = user_data;
+ const char *path = l_dbus_proxy_get_path(req->device->proxy);
struct l_dbus_message_builder *builder;
builder = l_dbus_message_builder_new(message);
@@ -2223,6 +2221,7 @@ static void btp_gap_unpair(uint8_t index, const void *param, uint16_t length,
uint8_t status = BTP_ERROR_FAIL;
struct btp_device *device;
bool prop;
+ struct unpair_req *req;
if (!adapter) {
status = BTP_ERROR_INVALID_INDEX;
@@ -2237,14 +2236,21 @@ static void btp_gap_unpair(uint8_t index, const void *param, uint16_t length,
device = find_device_by_address(adapter, &cp->address,
cp->address_type);
- if (!device)
- goto failed;
+ if (!device) {
+ btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_UNPAIR,
+ adapter->index, 0,
+ NULL);
+ return;
+ }
/* There is no direct unpair method, removing device will clear pairing
* information.
*/
+ req = l_new(struct unpair_req, 1);
+ req->index = index;
+ req->device = device;
l_dbus_proxy_method_call(adapter->proxy, "RemoveDevice", unpair_setup,
- unpair_reply, device, NULL);
+ unpair_reply, req, l_free);
return;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH BlueZ v2 2/2] client/btpclient: Don't remove all devices on GAP Reset command
2026-05-19 8:50 [PATCH BlueZ v2 1/2] client/btpclient: Fix GAP unpair command Frédéric Danis
@ 2026-05-19 8:50 ` Frédéric Danis
2026-05-19 12:23 ` [BlueZ,v2,1/2] client/btpclient: Fix GAP unpair command bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: Frédéric Danis @ 2026-05-19 8:50 UTC (permalink / raw)
To: linux-bluetooth
Currently running auto-pts remove all paired devices, instead of just
removing the PTS devices.
This removes this behavior, expecting auto-pts to explicitly remove the
PTS devices using Unpair command.
---
v1->v2: Fix build error
client/btpclient/gap.c | 55 +++---------------------------------------
1 file changed, 4 insertions(+), 51 deletions(-)
diff --git a/client/btpclient/gap.c b/client/btpclient/gap.c
index a14cd4795..f6b920b37 100644
--- a/client/btpclient/gap.c
+++ b/client/btpclient/gap.c
@@ -200,39 +200,6 @@ failed:
btp_send_error(btp, BTP_GAP_SERVICE, index, status);
}
-static void remove_device_setup(struct l_dbus_message *message,
- void *user_data)
-{
- struct btp_device *device = user_data;
-
- l_dbus_message_set_arguments(message, "o",
- l_dbus_proxy_get_path(device->proxy));
-}
-
-static void remove_device_reply(struct l_dbus_proxy *proxy,
- struct l_dbus_message *result,
- void *user_data)
-{
- struct btp_device *device = user_data;
- struct btp_adapter *adapter = find_adapter_by_proxy(proxy);
-
- if (!adapter)
- return;
-
- if (l_dbus_message_is_error(result)) {
- const char *name;
-
- l_dbus_message_get_error(result, &name, NULL);
-
- l_error("Failed to remove device %s (%s)",
- l_dbus_proxy_get_path(device->proxy),
- name);
- return;
- }
-
- l_queue_remove(adapter->devices, device);
-}
-
static void unreg_advertising_setup(struct l_dbus_message *message,
void *user_data)
{
@@ -351,9 +318,7 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
{
struct btp_adapter *adapter = find_adapter_by_index(index);
struct btp_agent *ag = get_agent();
- const struct l_queue_entry *entry;
uint8_t status;
- bool prop;
uint32_t default_settings;
if (!adapter) {
@@ -361,22 +326,10 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
goto failed;
}
- /* Adapter needs to be powered to be able to remove devices */
- if (!l_dbus_proxy_get_property(adapter->proxy, "Powered", "b", &prop) ||
- !prop) {
- status = BTP_ERROR_FAIL;
- goto failed;
- }
-
- for (entry = l_queue_get_entries(adapter->devices); entry;
- entry = entry->next) {
- struct btp_device *device = entry->data;
-
- l_dbus_proxy_method_call(adapter->proxy, "RemoveDevice",
- remove_device_setup,
- remove_device_reply, device,
- NULL);
- }
+ /* PTS devices should be removed explicitly by calling
+ * BTP_OP_GAP_UNPAIR to prevent removing all paired devices
+ * from the IUT.
+ */
if (adapter->ad_proxy && ad.registered)
if (!l_dbus_proxy_method_call(adapter->ad_proxy,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [BlueZ,v2,1/2] client/btpclient: Fix GAP unpair command
2026-05-19 8:50 [PATCH BlueZ v2 1/2] client/btpclient: Fix GAP unpair command Frédéric Danis
2026-05-19 8:50 ` [PATCH BlueZ v2 2/2] client/btpclient: Don't remove all devices on GAP Reset command Frédéric Danis
@ 2026-05-19 12:23 ` bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-05-19 12:23 UTC (permalink / raw)
To: linux-bluetooth, frederic.danis
[-- Attachment #1: Type: text/plain, Size: 825 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1097183
---Test result---
Test Summary:
CheckPatch PASS 0.68 seconds
GitLint PASS 0.44 seconds
BuildEll PASS 20.92 seconds
BluezMake PASS 495.39 seconds
CheckSmatch PASS 250.90 seconds
bluezmakeextell PASS 127.61 seconds
IncrementalBuild PASS 498.62 seconds
ScanBuild PASS 709.32 seconds
https://github.com/bluez/bluez/pull/2136
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-19 12:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19 8:50 [PATCH BlueZ v2 1/2] client/btpclient: Fix GAP unpair command Frédéric Danis
2026-05-19 8:50 ` [PATCH BlueZ v2 2/2] client/btpclient: Don't remove all devices on GAP Reset command Frédéric Danis
2026-05-19 12:23 ` [BlueZ,v2,1/2] client/btpclient: Fix GAP unpair command bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox