OSDN Git Service

emulator: Add support for reading IAC information
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Oct 2013 21:43:58 +0000 (14:43 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Oct 2013 21:43:58 +0000 (14:43 -0700)
emulator/btdev.c
monitor/bt.h

index f98b523..5f04bd1 100644 (file)
@@ -30,6 +30,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include <alloca.h>
 
 #include "monitor/bt.h"
 #include "btdev.h"
@@ -1072,6 +1073,8 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
        struct bt_hci_rsp_read_auth_enable rae;
        struct bt_hci_rsp_read_class_of_dev rcod;
        struct bt_hci_rsp_read_voice_setting rvs;
+       struct bt_hci_rsp_read_num_supported_iac rnsi;
+       struct bt_hci_rsp_read_current_iac_lap *rcil;
        struct bt_hci_rsp_read_inquiry_mode rim;
        struct bt_hci_rsp_read_afh_assessment_mode raam;
        struct bt_hci_rsp_read_ext_inquiry_response reir;
@@ -1415,6 +1418,26 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
                cmd_complete(btdev, opcode, &status, sizeof(status));
                break;
 
+       case BT_HCI_CMD_READ_NUM_SUPPORTED_IAC:
+               if (btdev->type == BTDEV_TYPE_LE)
+                       goto unsupported;
+               rnsi.status = BT_HCI_ERR_SUCCESS;
+               rnsi.num_iac = 0x01;
+               cmd_complete(btdev, opcode, &rnsi, sizeof(rnsi));
+               break;
+
+       case BT_HCI_CMD_READ_CURRENT_IAC_LAP:
+               if (btdev->type == BTDEV_TYPE_LE)
+                       goto unsupported;
+               rcil = alloca(sizeof(*rcil) + 3);
+               rcil->status = BT_HCI_ERR_SUCCESS;
+               rcil->num_iac = 0x01;
+               rcil->iac_lap[0] = 0x33;
+               rcil->iac_lap[1] = 0x8b;
+               rcil->iac_lap[2] = 0x9e;
+               cmd_complete(btdev, opcode, rcil, sizeof(*rcil) + 3);
+               break;
+
        case BT_HCI_CMD_WRITE_CURRENT_IAC_LAP:
                if (btdev->type == BTDEV_TYPE_LE)
                        goto unsupported;
index d82fdda..33831a0 100644 (file)
@@ -741,6 +741,11 @@ struct bt_hci_rsp_read_num_supported_iac {
 } __attribute__ ((packed));
 
 #define BT_HCI_CMD_READ_CURRENT_IAC_LAP                0x0c39
+struct bt_hci_rsp_read_current_iac_lap {
+       uint8_t  status;
+       uint8_t  num_iac;
+       uint8_t  iac_lap[0];
+} __attribute__ ((packed));
 
 #define BT_HCI_CMD_WRITE_CURRENT_IAC_LAP       0x0c3a