diff --git a/emulator/btdev.c b/emulator/btdev.c
index 675a638..b50df0f 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
return;
sce = data;
if (btdev->conn) {
- encrypt_change(btdev, sce->encr_mode,
- BT_HCI_ERR_SUCCESS);
- encrypt_change(btdev->conn, sce->encr_mode,
- BT_HCI_ERR_SUCCESS);
+ uint8_t mode;
+
+ if (!sce->encr_mode)
+ mode = 0x00;
+ else if (btdev->secure_conn_support &&
+ btdev->conn->secure_conn_support)
+ mode = 0x02;
+ else
+ mode = 0x01;
+
+ encrypt_change(btdev, mode, BT_HCI_ERR_SUCCESS);
+ encrypt_change(btdev->conn, mode, BT_HCI_ERR_SUCCESS);
}
break;