diff mbox series

[BlueZ] adapter: remove eir_data.flags in device_update_last_seen()

Message ID 20200821064927.17578-1-sonnysasaka@chromium.org
State New
Headers show
Series [BlueZ] adapter: remove eir_data.flags in device_update_last_seen() | expand

Commit Message

Sonny Sasaka Aug. 21, 2020, 6:49 a.m. UTC
From: Joseph Hwang <josephsih@chromium.org>

Bluez has difficulty in pairing with Apple Airpods. This issue is
caused by the incorrect selection of BD address type due to two factors:

(1) The LE advertising reports emitted by Airpods do not carry eir
    data flags.
(2) If the eir data flags is missing, the found device would not be
    considered as coming with bredr address for some historical
    obsolete reason.

This patch fixes (2) above.

Tested on Chrome OS by pairing with Airpods.
Without this patch, the pairing success rate is about 20%.
With this patch, the pairing success rate becomes almost 100%.

---
 src/adapter.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 5e896a9f0..36bbed2dd 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -6628,14 +6628,8 @@  static void update_found_devices(struct btd_adapter *adapter,
 
 	device_update_last_seen(dev, bdaddr_type);
 
-	/*
-	 * FIXME: We need to check for non-zero flags first because
-	 * older kernels send separate adv_ind and scan_rsp. Newer
-	 * kernels send them merged, so once we know which mgmt version
-	 * supports this we can make the non-zero check conditional.
-	 */
-	if (bdaddr_type != BDADDR_BREDR && eir_data.flags &&
-					!(eir_data.flags & EIR_BREDR_UNSUP)) {
+	if (bdaddr_type != BDADDR_BREDR &&
+			!(eir_data.flags & EIR_BREDR_UNSUP)) {
 		device_set_bredr_support(dev);
 		/* Update last seen for BR/EDR in case its flag is set */
 		device_update_last_seen(dev, BDADDR_BREDR);