Skip to contentSkip to conversation

core/service: Allow disconnected -> connected state change

PATCH Applied Miroslav Koskar 2 participants 2 messages Jun 10, 2016 – Jun 13, 2016 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 core/service: Allow disconnected -> connected state change

By ignoring case where service->state == BTD_SERVICE_STATE_DISCONNECTED in btd_service_connecting_complete(), state_callbacks don't get executed. Such case occurs when e.g., phone using a2dp-source profile connects to the bluez. Because no state_callbacks are executed (including one added by policy plugin) no reconnection is attempted after connection timeout, although if situation is reversed (bluez connects to the phone) reconnection works.

---
 src/service.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/service.c +2 -1
index f7912f5..0da14ab 100644
@@ -353,7 +353,8 @@ bool btd_service_remove_state_cb(unsigned int id)
 
 void btd_service_connecting_complete(struct btd_service *service, int err)
 {
-	if (service->state != BTD_SERVICE_STATE_CONNECTING)
+	if (service->state != BTD_SERVICE_STATE_DISCONNECTED &&
+			service->state != BTD_SERVICE_STATE_CONNECTING)
 		return;
 
 	if (err == 0)
#1 lore raw

Hi Miroslav,

Quoted 10 lines · Miroslav Koskar

By ignoring case where service->state == BTD_SERVICE_STATE_DISCONNECTED in btd_service_connecting_complete(), state_callbacks don't get executed. Such case occurs when e.g., phone using a2dp-source profile connects to the bluez. Because no state_callbacks are executed (including one added by policy plugin) no reconnection is attempted after connection timeout, although if situation is reversed (bluez connects to the phone) reconnection works.

---
 src/service.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied. Thanks.

Johan