From: Jefferson Delfes <jefferson.delfes@xxxxxxxxxxxxx> The LE command set scan enable can change the scan state of virtual controller. --- emulator/btdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 316d816..a7af6b3 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -89,6 +89,8 @@ struct btdev { uint8_t le_event_mask[8]; uint8_t le_adv_data[31]; uint8_t le_adv_data_len; + uint8_t le_scan_enable; + uint8_t le_filter_dup; uint8_t le_adv_enable; uint16_t sync_train_interval; @@ -908,6 +910,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, const struct bt_hci_cmd_le_set_event_mask *lsem; const struct bt_hci_cmd_le_set_adv_data *lsad; const struct bt_hci_cmd_le_set_adv_enable *lsae; + const struct bt_hci_cmd_le_set_scan_enable *lsse; struct bt_hci_rsp_read_default_link_policy rdlp; struct bt_hci_rsp_read_stored_link_key rslk; struct bt_hci_rsp_write_stored_link_key wslk; @@ -1542,7 +1545,14 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_LE_SET_SCAN_ENABLE: if (btdev->type == BTDEV_TYPE_BREDR) goto unsupported; - status = BT_HCI_ERR_SUCCESS; + lsse = data; + if (btdev->le_scan_enable == lsse->enable) + status = BT_HCI_ERR_COMMAND_DISALLOWED; + else { + btdev->le_scan_enable = lsse->enable; + btdev->le_filter_dup = lsse->filter_dup; + status = BT_HCI_ERR_SUCCESS; + } cmd_complete(btdev, opcode, &status, sizeof(status)); break; -- 1.7.9.5 -- 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