summaryrefslogtreecommitdiff
path: root/include/net/bluetooth/hci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/bluetooth/hci.h')
-rw-r--r--include/net/bluetooth/hci.h297
1 files changed, 128 insertions, 169 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 16587dcd6a91..3f8547f1c6f8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -81,10 +81,54 @@
/* HCI device quirks */
enum {
+ /* When this quirk is set, the HCI Reset command is send when
+ * closing the transport instead of when opening it.
+ *
+ * This quirk must be set before hci_register_dev is called.
+ */
HCI_QUIRK_RESET_ON_CLOSE,
+
+ /* When this quirk is set, the device is turned into a raw-only
+ * device and it will stay in unconfigured state.
+ *
+ * This quirk must be set before hci_register_dev is called.
+ */
HCI_QUIRK_RAW_DEVICE,
+
+ /* When this quirk is set, the buffer sizes reported by
+ * HCI Read Buffer Size command are corrected if invalid.
+ *
+ * This quirk must be set before hci_register_dev is called.
+ */
HCI_QUIRK_FIXUP_BUFFER_SIZE,
+
+ /* When this quirk is set, then no stored link key handling
+ * is performed. This is mainly due to the fact that the
+ * HCI Delete Stored Link Key command is advertised, but
+ * not supported.
+ *
+ * This quirk must be set before hci_register_dev is called.
+ */
HCI_QUIRK_BROKEN_STORED_LINK_KEY,
+
+ /* When this quirk is set, an external configuration step
+ * is required and will be indicated with the controller
+ * configuation.
+ *
+ * This quirk can be set before hci_register_dev is called or
+ * during the hdev->setup vendor callback.
+ */
+ HCI_QUIRK_EXTERNAL_CONFIG,
+
+ /* When this quirk is set, the public Bluetooth address
+ * initially reported by HCI Read BD Address command
+ * is considered invalid. Controller configuration is
+ * required before this device can be used.
+ *
+ * This quirk can be set before hci_register_dev is called or
+ * during the hdev->setup vendor callback.
+ */
+ HCI_QUIRK_INVALID_BDADDR,
};
/* HCI device flags */
@@ -104,24 +148,34 @@ enum {
HCI_RESET,
};
+/* BR/EDR and/or LE controller flags: the flags defined here should represent
+ * states configured via debugfs for debugging and testing purposes only.
+ */
+enum {
+ HCI_DUT_MODE,
+ HCI_FORCE_SC,
+ HCI_FORCE_STATIC_ADDR,
+};
+
/*
* BR/EDR and/or LE controller flags: the flags defined here should represent
* states from the controller.
*/
enum {
HCI_SETUP,
+ HCI_CONFIG,
HCI_AUTO_OFF,
HCI_RFKILLED,
HCI_MGMT,
- HCI_PAIRABLE,
+ HCI_BONDABLE,
HCI_SERVICE_CACHE,
- HCI_DEBUG_KEYS,
- HCI_DUT_MODE,
- HCI_FORCE_SC,
- HCI_FORCE_STATIC_ADDR,
+ HCI_KEEP_DEBUG_KEYS,
+ HCI_USE_DEBUG_KEYS,
HCI_UNREGISTER,
+ HCI_UNCONFIGURED,
HCI_USER_CHANNEL,
-
+ HCI_EXT_CONFIGURED,
+ HCI_LE_ADV,
HCI_LE_SCAN,
HCI_SSP_ENABLED,
HCI_SC_ENABLED,
@@ -139,7 +193,6 @@ enum {
HCI_PERIODIC_INQ,
HCI_FAST_CONNECTABLE,
HCI_BREDR_ENABLED,
- HCI_6LOWPAN_ENABLED,
HCI_LE_SCAN_INTERRUPTED,
};
@@ -147,34 +200,7 @@ enum {
* or the HCI device is closed.
*/
#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
- BIT(HCI_FAST_CONNECTABLE))
-
-/* HCI ioctl defines */
-#define HCIDEVUP _IOW('H', 201, int)
-#define HCIDEVDOWN _IOW('H', 202, int)
-#define HCIDEVRESET _IOW('H', 203, int)
-#define HCIDEVRESTAT _IOW('H', 204, int)
-
-#define HCIGETDEVLIST _IOR('H', 210, int)
-#define HCIGETDEVINFO _IOR('H', 211, int)
-#define HCIGETCONNLIST _IOR('H', 212, int)
-#define HCIGETCONNINFO _IOR('H', 213, int)
-#define HCIGETAUTHINFO _IOR('H', 215, int)
-
-#define HCISETRAW _IOW('H', 220, int)
-#define HCISETSCAN _IOW('H', 221, int)
-#define HCISETAUTH _IOW('H', 222, int)
-#define HCISETENCRYPT _IOW('H', 223, int)
-#define HCISETPTYPE _IOW('H', 224, int)
-#define HCISETLINKPOL _IOW('H', 225, int)
-#define HCISETLINKMODE _IOW('H', 226, int)
-#define HCISETACLMTU _IOW('H', 227, int)
-#define HCISETSCOMTU _IOW('H', 228, int)
-
-#define HCIBLOCKADDR _IOW('H', 230, int)
-#define HCIUNBLOCKADDR _IOW('H', 231, int)
-
-#define HCIINQUIRY _IOR('H', 240, int)
+ BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
/* HCI timeouts */
#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
@@ -185,6 +211,7 @@ enum {
#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
+#define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
/* HCI data types */
#define HCI_COMMAND_PKT 0x01
@@ -301,6 +328,11 @@ enum {
#define LMP_HOST_LE_BREDR 0x04
#define LMP_HOST_SC 0x08
+/* LE features */
+#define HCI_LE_ENCRYPTION 0x01
+#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
+#define HCI_LE_PING 0x10
+
/* Connection modes */
#define HCI_CM_ACTIVE 0x0000
#define HCI_CM_HOLD 0x0001
@@ -347,17 +379,9 @@ enum {
#define HCI_LK_CHANGED_COMBINATION 0x06
#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
#define HCI_LK_AUTH_COMBINATION_P256 0x08
-/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
-#define HCI_SMP_STK 0x80
-#define HCI_SMP_STK_SLAVE 0x81
-#define HCI_SMP_LTK 0x82
-#define HCI_SMP_LTK_SLAVE 0x83
-
-/* Long Term Key types */
-#define HCI_LTK_UNAUTH 0x00
-#define HCI_LTK_AUTH 0x01
/* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CONN_ID 0x02
#define HCI_ERROR_AUTH_FAILURE 0x05
#define HCI_ERROR_MEMORY_EXCEEDED 0x07
#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
@@ -367,6 +391,7 @@ enum {
#define HCI_ERROR_REMOTE_POWER_OFF 0x15
#define HCI_ERROR_LOCAL_HOST_TERM 0x16
#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
+#define HCI_ERROR_INVALID_LL_PARAMS 0x1E
#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
/* Flow control modes */
@@ -376,6 +401,9 @@ enum {
/* The core spec defines 127 as the "not available" value */
#define HCI_TX_POWER_INVALID 127
+#define HCI_ROLE_MASTER 0x00
+#define HCI_ROLE_SLAVE 0x01
+
/* Extended Inquiry Response field types */
#define EIR_FLAGS 0x01 /* flags */
#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
@@ -536,6 +564,11 @@ struct hci_cp_read_remote_version {
__le16 handle;
} __packed;
+#define HCI_OP_READ_CLOCK_OFFSET 0x041f
+struct hci_cp_read_clock_offset {
+ __le16 handle;
+} __packed;
+
#define HCI_OP_SETUP_SYNC_CONN 0x0428
struct hci_cp_setup_sync_conn {
__le16 handle;
@@ -1041,6 +1074,8 @@ struct hci_rp_read_data_block_size {
__le16 num_blocks;
} __packed;
+#define HCI_OP_READ_LOCAL_CODECS 0x100b
+
#define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b
struct hci_rp_read_page_scan_activity {
__u8 status;
@@ -1085,6 +1120,18 @@ struct hci_rp_read_rssi {
__s8 rssi;
} __packed;
+#define HCI_OP_READ_CLOCK 0x1407
+struct hci_cp_read_clock {
+ __le16 handle;
+ __u8 which;
+} __packed;
+struct hci_rp_read_clock {
+ __u8 status;
+ __le16 handle;
+ __le32 clock;
+ __le16 accuracy;
+} __packed;
+
#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
struct hci_rp_read_local_amp_info {
__u8 status;
@@ -1125,6 +1172,8 @@ struct hci_rp_write_remote_amp_assoc {
__u8 phy_handle;
} __packed;
+#define HCI_OP_GET_MWS_TRANSPORT_CONFIG 0x140c
+
#define HCI_OP_ENABLE_DUT_MODE 0x1803
#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
@@ -1291,6 +1340,23 @@ struct hci_rp_le_read_supported_states {
__u8 le_states[8];
} __packed;
+#define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020
+struct hci_cp_le_conn_param_req_reply {
+ __le16 handle;
+ __le16 interval_min;
+ __le16 interval_max;
+ __le16 latency;
+ __le16 timeout;
+ __le16 min_ce_len;
+ __le16 max_ce_len;
+} __packed;
+
+#define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021
+struct hci_cp_le_conn_param_req_neg_reply {
+ __le16 handle;
+ __u8 reason;
+} __packed;
+
/* ---- HCI Events ---- */
#define HCI_EV_INQUIRY_COMPLETE 0x01
@@ -1654,9 +1720,6 @@ struct hci_ev_sync_train_complete {
#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
-/* Low energy meta events */
-#define LE_CONN_ROLE_MASTER 0x00
-
#define HCI_EV_LE_CONN_COMPLETE 0x01
struct hci_ev_le_conn_complete {
__u8 status;
@@ -1670,6 +1733,15 @@ struct hci_ev_le_conn_complete {
__u8 clk_accurancy;
} __packed;
+#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
+struct hci_ev_le_conn_update_complete {
+ __u8 status;
+ __le16 handle;
+ __le16 interval;
+ __le16 latency;
+ __le16 supervision_timeout;
+} __packed;
+
#define HCI_EV_LE_LTK_REQ 0x05
struct hci_ev_le_ltk_req {
__le16 handle;
@@ -1677,6 +1749,15 @@ struct hci_ev_le_ltk_req {
__le16 ediv;
} __packed;
+#define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06
+struct hci_ev_le_remote_conn_param_req {
+ __le16 handle;
+ __le16 interval_min;
+ __le16 interval_max;
+ __le16 latency;
+ __le16 timeout;
+} __packed;
+
/* Advertising report event types */
#define LE_ADV_IND 0x00
#define LE_ADV_DIRECT_IND 0x01
@@ -1768,126 +1849,4 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
#define hci_handle(h) (h & 0x0fff)
#define hci_flags(h) (h >> 12)
-/* ---- HCI Sockets ---- */
-
-/* Socket options */
-#define HCI_DATA_DIR 1
-#define HCI_FILTER 2
-#define HCI_TIME_STAMP 3
-
-/* CMSG flags */
-#define HCI_CMSG_DIR 0x0001
-#define HCI_CMSG_TSTAMP 0x0002
-
-struct sockaddr_hci {
- sa_family_t hci_family;
- unsigned short hci_dev;
- unsigned short hci_channel;
-};
-#define HCI_DEV_NONE 0xffff
-
-#define HCI_CHANNEL_RAW 0
-#define HCI_CHANNEL_USER 1
-#define HCI_CHANNEL_MONITOR 2
-#define HCI_CHANNEL_CONTROL 3
-
-struct hci_filter {
- unsigned long type_mask;
- unsigned long event_mask[2];
- __le16 opcode;
-};
-
-struct hci_ufilter {
- __u32 type_mask;
- __u32 event_mask[2];
- __le16 opcode;
-};
-
-#define HCI_FLT_TYPE_BITS 31
-#define HCI_FLT_EVENT_BITS 63
-#define HCI_FLT_OGF_BITS 63
-#define HCI_FLT_OCF_BITS 127
-
-/* ---- HCI Ioctl requests structures ---- */
-struct hci_dev_stats {
- __u32 err_rx;
- __u32 err_tx;
- __u32 cmd_tx;
- __u32 evt_rx;
- __u32 acl_tx;
- __u32 acl_rx;
- __u32 sco_tx;
- __u32 sco_rx;
- __u32 byte_rx;
- __u32 byte_tx;
-};
-
-struct hci_dev_info {
- __u16 dev_id;
- char name[8];
-
- bdaddr_t bdaddr;
-
- __u32 flags;
- __u8 type;
-
- __u8 features[8];
-
- __u32 pkt_type;
- __u32 link_policy;
- __u32 link_mode;
-
- __u16 acl_mtu;
- __u16 acl_pkts;
- __u16 sco_mtu;
- __u16 sco_pkts;
-
- struct hci_dev_stats stat;
-};
-
-struct hci_conn_info {
- __u16 handle;
- bdaddr_t bdaddr;
- __u8 type;
- __u8 out;
- __u16 state;
- __u32 link_mode;
-};
-
-struct hci_dev_req {
- __u16 dev_id;
- __u32 dev_opt;
-};
-
-struct hci_dev_list_req {
- __u16 dev_num;
- struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
-};
-
-struct hci_conn_list_req {
- __u16 dev_id;
- __u16 conn_num;
- struct hci_conn_info conn_info[0];
-};
-
-struct hci_conn_info_req {
- bdaddr_t bdaddr;
- __u8 type;
- struct hci_conn_info conn_info[0];
-};
-
-struct hci_auth_info_req {
- bdaddr_t bdaddr;
- __u8 type;
-};
-
-struct hci_inquiry_req {
- __u16 dev_id;
- __u16 flags;
- __u8 lap[3];
- __u8 length;
- __u8 num_rsp;
-};
-#define IREQ_CACHE_FLUSH 0x0001
-
#endif /* __HCI_H */