core: Prefer BR/EDR over LE if it set in advertisement flag
Luiz Augusto von Dentz
maintainerPATCH 1/1 core: Prefer BR/EDR over LE if it set in advertisement flag
From: Luiz Augusto von Dentz <[email protected]>
This makes the code prefer BR/EDR if the last advertisement has it set in the flags.
--- src/adapter.c | 5 ++++- src/device.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)
src/adapter.c +4 -1
@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter,* supports this we can make the non-zero check conditional. */ if (bdaddr_type !=BDADDR_BREDR && eir_data.flags && - !(eir_data.flags &EIR_BREDR_UNSUP )) + !(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 ); + }if (eir_data.name !=NULL && eir_data.name_complete)device_store_cached_name (dev, eir_data.name);
src/device.c +5 -1
@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev)if (dev->le && (!dev->bredr || bredr_last ==NVAL_TIME ))return dev->bdaddr_type; -if (bredr_last < le_last) +/* +* Prefer BR/EDR if time is the same since it might be from an +* advertisement with BR/EDR flag set. +*/ +if (bredr_last <= le_last)return BDADDR_BREDR ;return dev->bdaddr_type;
Signature · 1 line
2.7.4
Hi,
Quoted 44 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This makes the code prefer BR/EDR if the last advertisement has it set in the flags.
--- src/adapter.c | 5 ++++- src/device.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)src/adapter.c +4
-1@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter,* supports this we can make the non-zero check conditional. */ if (bdaddr_type !=BDADDR_BREDR && eir_data.flags && - !(eir_data.flags &EIR_BREDR_UNSUP )) + !(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 ); + }if (eir_data.name !=NULL && eir_data.name_complete)device_store_cached_name (dev, eir_data.name);src/device.c +5
-2@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev)if (dev->le && (!dev->bredr || bredr_last ==NVAL_TIME ))return dev->bdaddr_type; -if (bredr_last < le_last) +/* +* Prefer BR/EDR if time is the same since it might be from an +* advertisement with BR/EDR flag set. +*/ +if (bredr_last <= le_last)return BDADDR_BREDR ;return dev->bdaddr_type; --
Quoted 1 line
2.7.4
Applied.
Signature · 1 line
Luiz Augusto von Dentz
Hi Luiz,
I found that this patch stops me to test connect GDBus API, especially connecting to BLE device.
After calling scan dbus api, bredr_last and le_last are updated at the same time when update_found_devices() got called.
Then connecting to ble device is failed because bredr_last and le_last has no differences and this leads changing bdaddr type to bredr which is wrong in this case.
Please consider my analysis.
Thanks in advance,
SLKI
Quoted 59 lines · Luiz Augusto von Dentz
Hi,
Quoted 44 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This makes the code prefer BR/EDR if the last advertisement has it set in the flags.
--- src/adapter.c | 5 ++++- src/device.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)src/adapter.c +4
-1@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter,* supports this we can make the non-zero check conditional. */ if (bdaddr_type !=BDADDR_BREDR && eir_data.flags && - !(eir_data.flags &EIR_BREDR_UNSUP )) + !(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 ); + }if (eir_data.name !=NULL && eir_data.name_complete)device_store_cached_name (dev, eir_data.name);src/device.c +5
-2@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev)if (dev->le && (!dev->bredr || bredr_last ==NVAL_TIME ))return dev->bdaddr_type; -if (bredr_last < le_last) +/* +* Prefer BR/EDR if time is the same since it might be from an +* advertisement with BR/EDR flag set. +*/ +if (bredr_last <= le_last)return BDADDR_BREDR ;return dev->bdaddr_type; --Quoted 1 line
2.7.4
Applied.
--
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Luiz Augusto von Dentz
maintainerHi,
Quoted 5 lines · Seulki Shin
Hi Luiz,
I found that this patch stops me to test connect GDBus API, especially connecting to BLE device.
Quoted 7 lines
After calling scan dbus api,
bredr_lastandle_lastare updated at the same time whenupdate_found_devices()got called.
Then connecting to ble device is failed becausebredr_lastandle_lasthas no differences and this leads changing bdaddr type to bredr which is wrong in this case.Please consider my analysis.
Actually this is valid only if the device is advertising as a dual mode device, so perhaps you want to check why does it advertise as BR/EDR capable device. In the other if it is indeed a dual mode device a second connect attempt will then trigger the LE connection, this in on purpose since we don't yet have bearer specific Connect methods so we have to prefer BR/EDR over LE as the first bearer to connect.
Quoted 64 lines
Thanks in advance,
SLKIQuoted 59 lines · Luiz Augusto von Dentz
Hi,
Quoted 44 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This makes the code prefer BR/EDR if the last advertisement has it set in the flags.
--- src/adapter.c | 5 ++++- src/device.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)src/adapter.c +4
-1@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter,* supports this we can make the non-zero check conditional. */ if (bdaddr_type !=BDADDR_BREDR && eir_data.flags && - !(eir_data.flags &EIR_BREDR_UNSUP )) + !(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 ); + }if (eir_data.name !=NULL && eir_data.name_complete)device_store_cached_name (dev, eir_data.name);src/device.c +5
-2@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev)if (dev->le && (!dev->bredr || bredr_last ==NVAL_TIME ))return dev->bdaddr_type; -if (bredr_last < le_last) +/* +* Prefer BR/EDR if time is the same since it might be from an +* advertisement with BR/EDR flag set. +*/ +if (bredr_last <= le_last)return BDADDR_BREDR ;return dev->bdaddr_type; --Quoted 1 line
2.7.4
Applied.
--
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Luiz Augusto von Dentz
Luiz,
Thanks for your valuable information.
Quoted 14 lines · Luiz Augusto von Dentz
Hi,
Quoted 11 lines · Seulki Shin
Hi Luiz,
I found that this patch stops me to test connect GDBus API, especially connecting to BLE device.
After calling scan dbus api,
bredr_lastandle_lastare updated at the same time whenupdate_found_devices()got called.
Then connecting to ble device is failed becausebredr_lastandle_lasthas no differences and this leads changing bdaddr type to bredr which is wrong in this case.
Quoted 8 lines
Quoted 1 line
Please consider my analysis.
Actually this is valid only if the device is advertising as a dual mode device, so perhaps you want to check why does it advertise as BR/EDR capable device. In the other if it is indeed a dual mode device a second connect attempt will then trigger the LE connection, this in on purpose since we don't yet have bearer specific Connect methods so we have to prefer BR/EDR over LE as the first bearer to connect.
Yes, the device was advertising as a dual mode.
But the problem is that I got "Host is down" error message from first trial so I don't think I can try to connect again.
Quoted 68 lines
Quoted 65 lines
Thanks in advance,
SLKIQuoted 59 lines · Luiz Augusto von Dentz
Hi,
Quoted 44 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This makes the code prefer BR/EDR if the last advertisement has it set in the flags.
--- src/adapter.c | 5 ++++- src/device.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)src/adapter.c +4
-1@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter,* supports this we can make the non-zero check conditional. */ if (bdaddr_type !=BDADDR_BREDR && eir_data.flags && - !(eir_data.flags &EIR_BREDR_UNSUP )) + !(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 ); + }if (eir_data.name !=NULL && eir_data.name_complete)device_store_cached_name (dev, eir_data.name);src/device.c +5
-2@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev)if (dev->le && (!dev->bredr || bredr_last ==NVAL_TIME ))return dev->bdaddr_type; -if (bredr_last < le_last) +/* +* Prefer BR/EDR if time is the same since it might be from an +* advertisement with BR/EDR flag set. +*/ +if (bredr_last <= le_last)return BDADDR_BREDR ;return dev->bdaddr_type; --Quoted 1 line
2.7.4
Applied.
--
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines
--
Luiz Augusto von Dentz
SLKI