Diff between 27d79b3a73cb8068138103a697774159894672db and 162882534bc1c67a82717d2d4dfb795e560c1b83

Changed Files

File Additions Deletions Status
emulator/btdev.c +9 -3 modified

Full Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 0baf93b..22680a2 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -58,7 +58,8 @@ struct btdev {
 	uint16_t pin[16];
 	uint8_t pin_len;
 	uint8_t io_cap;
-	bool ssp_auth_rsp;
+	bool ssp_auth_complete;
+	uint8_t ssp_status;
 
 	btdev_command_func command_handler;
 	void *command_data;
@@ -1254,11 +1255,16 @@ static void ssp_complete(struct btdev *btdev, const uint8_t *bdaddr,
 	if (!remote)
 		return;
 
-	btdev->ssp_auth_rsp = true;
+	btdev->ssp_status = status;
+	btdev->ssp_auth_complete = true;
 
-	if (!remote->ssp_auth_rsp)
+	if (!remote->ssp_auth_complete)
 		return;
 
+	if (status == BT_HCI_ERR_SUCCESS &&
+				remote->ssp_status != BT_HCI_ERR_SUCCESS)
+		status = remote->ssp_status;
+
 	iev.status = status;
 	aev.status = status;