From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx> The network interface handles the connected state as boolean so we never get an intermediate state CONNECTING. The old code was preventing the transition from DISCONNECTED to CONNECTED in network to be signaled in the Device interface. --- src/device.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index 57bfc86..34511bd 100644 --- a/src/device.c +++ b/src/device.c @@ -4506,10 +4506,20 @@ static void service_state_changed(struct btd_service *service, struct btd_device *device = btd_service_get_device(service); int err = btd_service_get_error(service); - if (old_state == BTD_SERVICE_STATE_CONNECTING) - device_profile_connected(device, profile, err); - else if (old_state == BTD_SERVICE_STATE_DISCONNECTING) + switch (new_state) { + case BTD_SERVICE_STATE_CONNECTED: + if (old_state == BTD_SERVICE_STATE_CONNECTING || + old_state == BTD_SERVICE_STATE_DISCONNECTED) + device_profile_connected(device, profile, err); + break; + + case BTD_SERVICE_STATE_DISCONNECTED: device_profile_disconnected(device, profile, err); + break; + + default: + break; + } } struct btd_service *btd_device_get_service(struct btd_device *dev, -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html