From b9d6d37fd56df25dcc90f050ae1eb33e20df73a8 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Sun, 18 May 2014 13:53:58 +0200 Subject: [PATCH] android/bluetooth: Fix unpairing dual mode device If device is paired on LE and BR/EDR it should be unpaired on both bearers. --- android/bluetooth.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/android/bluetooth.c b/android/bluetooth.c index 4b2b1a20a..86f6cf443 100644 --- a/android/bluetooth.c +++ b/android/bluetooth.c @@ -3430,13 +3430,26 @@ static void handle_remove_bond_cmd(const void *buf, uint16_t len) goto failed; } - cp.addr.type = select_device_bearer(dev); + if (dev->le_paired) { + cp.addr.type = dev->bdaddr_type; - if (mgmt_send(mgmt_if, MGMT_OP_UNPAIR_DEVICE, adapter.index, - sizeof(cp), &cp, unpair_device_complete, - NULL, NULL) == 0) { - status = HAL_STATUS_FAILED; - goto failed; + if (mgmt_send(mgmt_if, MGMT_OP_UNPAIR_DEVICE, adapter.index, + sizeof(cp), &cp, unpair_device_complete, + NULL, NULL) == 0) { + status = HAL_STATUS_FAILED; + goto failed; + } + } + + if (dev->bredr_paired) { + cp.addr.type = BDADDR_BREDR; + + if (mgmt_send(mgmt_if, MGMT_OP_UNPAIR_DEVICE, adapter.index, + sizeof(cp), &cp, unpair_device_complete, + NULL, NULL) == 0) { + status = HAL_STATUS_FAILED; + goto failed; + } } status = HAL_STATUS_SUCCESS; -- 2.47.3