diff --git a/emulator/btdev.c b/emulator/btdev.c
index 18af1b0..0baf93b 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
btdev->commands[1] |= 0x10; /* PIN Code Request Reply */
btdev->commands[1] |= 0x20; /* PIN Code Request Negative Reply */
btdev->commands[1] |= 0x80; /* Authentication Requested */
+ btdev->commands[2] |= 0x01; /* Set Connection Encryption */
btdev->commands[2] |= 0x08; /* Remote Name Request */
btdev->commands[2] |= 0x10; /* Cancel Remote Name Request */
btdev->commands[2] |= 0x20; /* Read Remote Supported Features */
cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode);
break;
+ case BT_HCI_CMD_SET_CONN_ENCRYPT:
+ if (btdev->type == BTDEV_TYPE_LE)
+ goto unsupported;
+ cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode);
+ break;
+
case BT_HCI_CMD_REMOTE_NAME_REQUEST:
if (btdev->type == BTDEV_TYPE_LE)
goto unsupported;
const struct bt_hci_cmd_accept_conn_request *acr;
const struct bt_hci_cmd_reject_conn_request *rcr;
const struct bt_hci_cmd_auth_requested *ar;
+ const struct bt_hci_cmd_set_conn_encrypt *sce;
const struct bt_hci_cmd_link_key_request_reply *lkrr;
const struct bt_hci_cmd_link_key_request_neg_reply *lkrnr;
const struct bt_hci_cmd_pin_code_request_neg_reply *pcrnr;
auth_request_complete(btdev, le16_to_cpu(ar->handle));
break;
+ case BT_HCI_CMD_SET_CONN_ENCRYPT:
+ if (btdev->type == BTDEV_TYPE_LE)
+ return;
+ sce = data;
+ encrypt_change(btdev, sce->encr_mode, BT_HCI_ERR_SUCCESS);
+ if (btdev->conn)
+ encrypt_change(btdev->conn, sce->encr_mode, BT_HCI_ERR_SUCCESS);
+ break;
+
case BT_HCI_CMD_REMOTE_NAME_REQUEST:
if (btdev->type == BTDEV_TYPE_LE)
return;