diff options
-rw-r--r-- | src/dbus-hci.c | 5 | ||||
-rw-r--r-- | src/device.c | 15 | ||||
-rw-r--r-- | src/device.h | 1 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 5c5f1c6d..3577043b 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -937,6 +937,11 @@ void hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer, return; } + /* If this is not the first link key set a flag so a subsequent auth + * complete event doesn't trigger SDP */ + if (old_key_type != 0xFF) + device_set_renewed_key(device, TRUE); + if (!device_is_connected(device)) device_set_secmode3_conn(device, TRUE); else if (!device_is_bonding(device, NULL) && old_key_type == 0xFF) diff --git a/src/device.c b/src/device.c index b6d8695f..ba705288 100644 --- a/src/device.c +++ b/src/device.c @@ -110,6 +110,8 @@ struct btd_device { gboolean secmode3; sdp_list_t *tmp_records; + + gboolean renewed_key; }; struct browse_req { @@ -1814,6 +1816,12 @@ void device_bonding_complete(struct btd_device *device, uint8_t status) device->temporary = FALSE; + g_free(device->authr); + device->authr = NULL; + + if (device->renewed_key) + return; + /* If we were initiators start service discovery immediately. * However if the other end was the initator wait a few seconds * before SDP. This is due to potential IOP issues if the other @@ -1838,8 +1846,6 @@ void device_bonding_complete(struct btd_device *device, uint8_t status) device_set_paired(device, TRUE); - g_free(device->authr); - device->authr = NULL; bonding_request_free(bonding); return; @@ -2040,6 +2046,11 @@ gboolean device_is_authenticating(struct btd_device *device) return (device->authr != NULL); } +void device_set_renewed_key(struct btd_device *device, gboolean renewed) +{ + device->renewed_key = renewed; +} + void btd_device_add_uuid(struct btd_device *device, const char *uuid) { GSList *uuid_list; diff --git a/src/device.h b/src/device.h index 2b2735c0..bc28755f 100644 --- a/src/device.h +++ b/src/device.h @@ -68,6 +68,7 @@ int device_request_authentication(struct btd_device *device, auth_type_t type, uint32_t passkey, void *cb); void device_cancel_authentication(struct btd_device *device); gboolean device_is_authenticating(struct btd_device *device); +void device_set_renewed_key(struct btd_device *device, gboolean renewed); void device_add_connection(struct btd_device *device, DBusConnection *conn, uint16_t handle); void device_remove_connection(struct btd_device *device, DBusConnection *conn, |