Commit b4cb9fb2 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Gustavo Padovan

Bluetooth: Read number of supported IAC on controller setup

When initializing a controller make sure to read out the number of
supported IAC and store its result. This value is needed to determine
if limited discoverable for BR/EDR can be configured or not.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 899e1075
...@@ -815,6 +815,12 @@ struct hci_cp_host_buffer_size { ...@@ -815,6 +815,12 @@ struct hci_cp_host_buffer_size {
__le16 sco_max_pkt; __le16 sco_max_pkt;
} __packed; } __packed;
#define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38
struct hci_rp_read_num_supported_iac {
__u8 status;
__u8 num_iac;
} __packed;
#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
#define HCI_MAX_EIR_LENGTH 240 #define HCI_MAX_EIR_LENGTH 240
......
...@@ -159,6 +159,7 @@ struct hci_dev { ...@@ -159,6 +159,7 @@ struct hci_dev {
__u16 manufacturer; __u16 manufacturer;
__u16 lmp_subver; __u16 lmp_subver;
__u16 voice_setting; __u16 voice_setting;
__u8 num_iac;
__u8 io_capability; __u8 io_capability;
__s8 inq_tx_power; __s8 inq_tx_power;
__u16 page_scan_interval; __u16 page_scan_interval;
......
...@@ -370,6 +370,9 @@ static void bredr_setup(struct hci_request *req) ...@@ -370,6 +370,9 @@ static void bredr_setup(struct hci_request *req)
/* Read Voice Setting */ /* Read Voice Setting */
hci_req_add(req, HCI_OP_READ_VOICE_SETTING, 0, NULL); hci_req_add(req, HCI_OP_READ_VOICE_SETTING, 0, NULL);
/* Read Number of Supported IAC */
hci_req_add(req, HCI_OP_READ_NUM_SUPPORTED_IAC, 0, NULL);
/* Clear Event Filters */ /* Clear Event Filters */
flt_type = HCI_FLT_CLEAR_ALL; flt_type = HCI_FLT_CLEAR_ALL;
hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type); hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type);
...@@ -2271,7 +2274,8 @@ struct hci_dev *hci_alloc_dev(void) ...@@ -2271,7 +2274,8 @@ struct hci_dev *hci_alloc_dev(void)
hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1); hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1);
hdev->esco_type = (ESCO_HV1); hdev->esco_type = (ESCO_HV1);
hdev->link_mode = (HCI_LM_ACCEPT); hdev->link_mode = (HCI_LM_ACCEPT);
hdev->io_capability = 0x03; /* No Input No Output */ hdev->num_iac = 0x01; /* One IAC support is mandatory */
hdev->io_capability = 0x03; /* No Input No Output */
hdev->inq_tx_power = HCI_TX_POWER_INVALID; hdev->inq_tx_power = HCI_TX_POWER_INVALID;
hdev->adv_tx_power = HCI_TX_POWER_INVALID; hdev->adv_tx_power = HCI_TX_POWER_INVALID;
......
...@@ -418,6 +418,21 @@ static void hci_cc_write_voice_setting(struct hci_dev *hdev, ...@@ -418,6 +418,21 @@ static void hci_cc_write_voice_setting(struct hci_dev *hdev,
hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING);
} }
static void hci_cc_read_num_supported_iac(struct hci_dev *hdev,
struct sk_buff *skb)
{
struct hci_rp_read_num_supported_iac *rp = (void *) skb->data;
BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
if (rp->status)
return;
hdev->num_iac = rp->num_iac;
BT_DBG("%s num iac %d", hdev->name, hdev->num_iac);
}
static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb)
{ {
__u8 status = *((__u8 *) skb->data); __u8 status = *((__u8 *) skb->data);
...@@ -2135,6 +2150,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -2135,6 +2150,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
hci_cc_write_voice_setting(hdev, skb); hci_cc_write_voice_setting(hdev, skb);
break; break;
case HCI_OP_READ_NUM_SUPPORTED_IAC:
hci_cc_read_num_supported_iac(hdev, skb);
break;
case HCI_OP_WRITE_SSP_MODE: case HCI_OP_WRITE_SSP_MODE:
hci_cc_write_ssp_mode(hdev, skb); hci_cc_write_ssp_mode(hdev, skb);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment