aboutsummaryrefslogtreecommitdiffstats
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.h214
1 files changed, 200 insertions, 14 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index bcbdd6d4e6dd..0c20227e57f6 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1,4 +1,4 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 4
@@ -12,13 +12,13 @@
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED. 22 SOFTWARE IS DISCLAIMED.
23*/ 23*/
24 24
@@ -54,7 +54,7 @@
54 54
55/* HCI controller types */ 55/* HCI controller types */
56#define HCI_BREDR 0x00 56#define HCI_BREDR 0x00
57#define HCI_80211 0x01 57#define HCI_AMP 0x01
58 58
59/* HCI device quirks */ 59/* HCI device quirks */
60enum { 60enum {
@@ -76,6 +76,16 @@ enum {
76 HCI_INQUIRY, 76 HCI_INQUIRY,
77 77
78 HCI_RAW, 78 HCI_RAW,
79
80 HCI_SETUP,
81 HCI_AUTO_OFF,
82 HCI_MGMT,
83 HCI_PAIRABLE,
84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
87
88 HCI_RESET,
79}; 89};
80 90
81/* HCI ioctl defines */ 91/* HCI ioctl defines */
@@ -111,6 +121,7 @@ enum {
111#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 121#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
112#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 122#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
113#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 123#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
124#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
114 125
115/* HCI data types */ 126/* HCI data types */
116#define HCI_COMMAND_PKT 0x01 127#define HCI_COMMAND_PKT 0x01
@@ -150,6 +161,7 @@ enum {
150#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 161#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
151 162
152/* ACL flags */ 163/* ACL flags */
164#define ACL_START_NO_FLUSH 0x00
153#define ACL_CONT 0x01 165#define ACL_CONT 0x01
154#define ACL_START 0x02 166#define ACL_START 0x02
155#define ACL_ACTIVE_BCAST 0x04 167#define ACL_ACTIVE_BCAST 0x04
@@ -159,6 +171,8 @@ enum {
159#define SCO_LINK 0x00 171#define SCO_LINK 0x00
160#define ACL_LINK 0x01 172#define ACL_LINK 0x01
161#define ESCO_LINK 0x02 173#define ESCO_LINK 0x02
174/* Low Energy links do not have defined link type. Use invented one */
175#define LE_LINK 0x80
162 176
163/* LMP features */ 177/* LMP features */
164#define LMP_3SLOT 0x01 178#define LMP_3SLOT 0x01
@@ -183,17 +197,25 @@ enum {
183#define LMP_PSCHEME 0x02 197#define LMP_PSCHEME 0x02
184#define LMP_PCONTROL 0x04 198#define LMP_PCONTROL 0x04
185 199
200#define LMP_RSSI_INQ 0x40
186#define LMP_ESCO 0x80 201#define LMP_ESCO 0x80
187 202
188#define LMP_EV4 0x01 203#define LMP_EV4 0x01
189#define LMP_EV5 0x02 204#define LMP_EV5 0x02
205#define LMP_LE 0x40
190 206
191#define LMP_SNIFF_SUBR 0x02 207#define LMP_SNIFF_SUBR 0x02
208#define LMP_PAUSE_ENC 0x04
192#define LMP_EDR_ESCO_2M 0x20 209#define LMP_EDR_ESCO_2M 0x20
193#define LMP_EDR_ESCO_3M 0x40 210#define LMP_EDR_ESCO_3M 0x40
194#define LMP_EDR_3S_ESCO 0x80 211#define LMP_EDR_3S_ESCO 0x80
195 212
213#define LMP_EXT_INQ 0x01
196#define LMP_SIMPLE_PAIR 0x08 214#define LMP_SIMPLE_PAIR 0x08
215#define LMP_NO_FLUSH 0x40
216
217#define LMP_LSTO 0x01
218#define LMP_INQ_TX_PWR 0x02
197 219
198/* Connection modes */ 220/* Connection modes */
199#define HCI_CM_ACTIVE 0x0000 221#define HCI_CM_ACTIVE 0x0000
@@ -224,7 +246,18 @@ enum {
224#define HCI_AT_GENERAL_BONDING 0x04 246#define HCI_AT_GENERAL_BONDING 0x04
225#define HCI_AT_GENERAL_BONDING_MITM 0x05 247#define HCI_AT_GENERAL_BONDING_MITM 0x05
226 248
249/* Link Key types */
250#define HCI_LK_COMBINATION 0x00
251#define HCI_LK_LOCAL_UNIT 0x01
252#define HCI_LK_REMOTE_UNIT 0x02
253#define HCI_LK_DEBUG_COMBINATION 0x03
254#define HCI_LK_UNAUTH_COMBINATION 0x04
255#define HCI_LK_AUTH_COMBINATION 0x05
256#define HCI_LK_CHANGED_COMBINATION 0x06
257
227/* ----- HCI Commands ---- */ 258/* ----- HCI Commands ---- */
259#define HCI_OP_NOP 0x0000
260
228#define HCI_OP_INQUIRY 0x0401 261#define HCI_OP_INQUIRY 0x0401
229struct hci_cp_inquiry { 262struct hci_cp_inquiry {
230 __u8 lap[3]; 263 __u8 lap[3];
@@ -292,11 +325,19 @@ struct hci_cp_pin_code_reply {
292 __u8 pin_len; 325 __u8 pin_len;
293 __u8 pin_code[16]; 326 __u8 pin_code[16];
294} __packed; 327} __packed;
328struct hci_rp_pin_code_reply {
329 __u8 status;
330 bdaddr_t bdaddr;
331} __packed;
295 332
296#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 333#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
297struct hci_cp_pin_code_neg_reply { 334struct hci_cp_pin_code_neg_reply {
298 bdaddr_t bdaddr; 335 bdaddr_t bdaddr;
299} __packed; 336} __packed;
337struct hci_rp_pin_code_neg_reply {
338 __u8 status;
339 bdaddr_t bdaddr;
340} __packed;
300 341
301#define HCI_OP_CHANGE_CONN_PTYPE 0x040f 342#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
302struct hci_cp_change_conn_ptype { 343struct hci_cp_change_conn_ptype {
@@ -377,6 +418,43 @@ struct hci_cp_reject_sync_conn_req {
377 __u8 reason; 418 __u8 reason;
378} __packed; 419} __packed;
379 420
421#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
422struct hci_cp_io_capability_reply {
423 bdaddr_t bdaddr;
424 __u8 capability;
425 __u8 oob_data;
426 __u8 authentication;
427} __packed;
428
429#define HCI_OP_USER_CONFIRM_REPLY 0x042c
430struct hci_cp_user_confirm_reply {
431 bdaddr_t bdaddr;
432} __packed;
433struct hci_rp_user_confirm_reply {
434 __u8 status;
435 bdaddr_t bdaddr;
436} __packed;
437
438#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
439
440#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
441struct hci_cp_remote_oob_data_reply {
442 bdaddr_t bdaddr;
443 __u8 hash[16];
444 __u8 randomizer[16];
445} __packed;
446
447#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
448struct hci_cp_remote_oob_data_neg_reply {
449 bdaddr_t bdaddr;
450} __packed;
451
452#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
453struct hci_cp_io_capability_neg_reply {
454 bdaddr_t bdaddr;
455 __u8 reason;
456} __packed;
457
380#define HCI_OP_SNIFF_MODE 0x0803 458#define HCI_OP_SNIFF_MODE 0x0803
381struct hci_cp_sniff_mode { 459struct hci_cp_sniff_mode {
382 __le16 handle; 460 __le16 handle;
@@ -474,22 +552,30 @@ struct hci_cp_set_event_flt {
474#define HCI_CONN_SETUP_AUTO_OFF 0x01 552#define HCI_CONN_SETUP_AUTO_OFF 0x01
475#define HCI_CONN_SETUP_AUTO_ON 0x02 553#define HCI_CONN_SETUP_AUTO_ON 0x02
476 554
555#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
556struct hci_cp_delete_stored_link_key {
557 bdaddr_t bdaddr;
558 __u8 delete_all;
559} __packed;
560
561#define HCI_MAX_NAME_LENGTH 248
562
477#define HCI_OP_WRITE_LOCAL_NAME 0x0c13 563#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
478struct hci_cp_write_local_name { 564struct hci_cp_write_local_name {
479 __u8 name[248]; 565 __u8 name[HCI_MAX_NAME_LENGTH];
480} __packed; 566} __packed;
481 567
482#define HCI_OP_READ_LOCAL_NAME 0x0c14 568#define HCI_OP_READ_LOCAL_NAME 0x0c14
483struct hci_rp_read_local_name { 569struct hci_rp_read_local_name {
484 __u8 status; 570 __u8 status;
485 __u8 name[248]; 571 __u8 name[HCI_MAX_NAME_LENGTH];
486} __packed; 572} __packed;
487 573
488#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 574#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
489 575
490#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 576#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
491 577
492#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 578#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
493 #define SCAN_DISABLED 0x00 579 #define SCAN_DISABLED 0x00
494 #define SCAN_INQUIRY 0x01 580 #define SCAN_INQUIRY 0x01
495 #define SCAN_PAGE 0x02 581 #define SCAN_PAGE 0x02
@@ -537,6 +623,16 @@ struct hci_cp_host_buffer_size {
537 __le16 sco_max_pkt; 623 __le16 sco_max_pkt;
538} __packed; 624} __packed;
539 625
626#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
627
628#define HCI_MAX_EIR_LENGTH 240
629
630#define HCI_OP_WRITE_EIR 0x0c52
631struct hci_cp_write_eir {
632 uint8_t fec;
633 uint8_t data[HCI_MAX_EIR_LENGTH];
634} __packed;
635
540#define HCI_OP_READ_SSP_MODE 0x0c55 636#define HCI_OP_READ_SSP_MODE 0x0c55
541struct hci_rp_read_ssp_mode { 637struct hci_rp_read_ssp_mode {
542 __u8 status; 638 __u8 status;
@@ -548,6 +644,15 @@ struct hci_cp_write_ssp_mode {
548 __u8 mode; 644 __u8 mode;
549} __packed; 645} __packed;
550 646
647#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
648struct hci_rp_read_local_oob_data {
649 __u8 status;
650 __u8 hash[16];
651 __u8 randomizer[16];
652} __packed;
653
654#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
655
551#define HCI_OP_READ_LOCAL_VERSION 0x1001 656#define HCI_OP_READ_LOCAL_VERSION 0x1001
552struct hci_rp_read_local_version { 657struct hci_rp_read_local_version {
553 __u8 status; 658 __u8 status;
@@ -593,6 +698,47 @@ struct hci_rp_read_bd_addr {
593 bdaddr_t bdaddr; 698 bdaddr_t bdaddr;
594} __packed; 699} __packed;
595 700
701#define HCI_OP_LE_SET_EVENT_MASK 0x2001
702struct hci_cp_le_set_event_mask {
703 __u8 mask[8];
704} __packed;
705
706#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
707struct hci_rp_le_read_buffer_size {
708 __u8 status;
709 __le16 le_mtu;
710 __u8 le_max_pkt;
711} __packed;
712
713#define HCI_OP_LE_CREATE_CONN 0x200d
714struct hci_cp_le_create_conn {
715 __le16 scan_interval;
716 __le16 scan_window;
717 __u8 filter_policy;
718 __u8 peer_addr_type;
719 bdaddr_t peer_addr;
720 __u8 own_address_type;
721 __le16 conn_interval_min;
722 __le16 conn_interval_max;
723 __le16 conn_latency;
724 __le16 supervision_timeout;
725 __le16 min_ce_len;
726 __le16 max_ce_len;
727} __packed;
728
729#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
730
731#define HCI_OP_LE_CONN_UPDATE 0x2013
732struct hci_cp_le_conn_update {
733 __le16 handle;
734 __le16 conn_interval_min;
735 __le16 conn_interval_max;
736 __le16 conn_latency;
737 __le16 supervision_timeout;
738 __le16 min_ce_len;
739 __le16 max_ce_len;
740} __packed;
741
596/* ---- HCI Events ---- */ 742/* ---- HCI Events ---- */
597#define HCI_EV_INQUIRY_COMPLETE 0x01 743#define HCI_EV_INQUIRY_COMPLETE 0x01
598 744
@@ -639,7 +785,7 @@ struct hci_ev_auth_complete {
639struct hci_ev_remote_name { 785struct hci_ev_remote_name {
640 __u8 status; 786 __u8 status;
641 bdaddr_t bdaddr; 787 bdaddr_t bdaddr;
642 __u8 name[248]; 788 __u8 name[HCI_MAX_NAME_LENGTH];
643} __packed; 789} __packed;
644 790
645#define HCI_EV_ENCRYPT_CHANGE 0x08 791#define HCI_EV_ENCRYPT_CHANGE 0x08
@@ -833,6 +979,25 @@ struct hci_ev_io_capa_request {
833 bdaddr_t bdaddr; 979 bdaddr_t bdaddr;
834} __packed; 980} __packed;
835 981
982#define HCI_EV_IO_CAPA_REPLY 0x32
983struct hci_ev_io_capa_reply {
984 bdaddr_t bdaddr;
985 __u8 capability;
986 __u8 oob_data;
987 __u8 authentication;
988} __packed;
989
990#define HCI_EV_USER_CONFIRM_REQUEST 0x33
991struct hci_ev_user_confirm_req {
992 bdaddr_t bdaddr;
993 __le32 passkey;
994} __packed;
995
996#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
997struct hci_ev_remote_oob_data_request {
998 bdaddr_t bdaddr;
999} __packed;
1000
836#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 1001#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
837struct hci_ev_simple_pair_complete { 1002struct hci_ev_simple_pair_complete {
838 __u8 status; 1003 __u8 status;
@@ -845,6 +1010,25 @@ struct hci_ev_remote_host_features {
845 __u8 features[8]; 1010 __u8 features[8];
846} __packed; 1011} __packed;
847 1012
1013#define HCI_EV_LE_META 0x3e
1014struct hci_ev_le_meta {
1015 __u8 subevent;
1016} __packed;
1017
1018/* Low energy meta events */
1019#define HCI_EV_LE_CONN_COMPLETE 0x01
1020struct hci_ev_le_conn_complete {
1021 __u8 status;
1022 __le16 handle;
1023 __u8 role;
1024 __u8 bdaddr_type;
1025 bdaddr_t bdaddr;
1026 __le16 interval;
1027 __le16 latency;
1028 __le16 supervision_timeout;
1029 __u8 clk_accurancy;
1030} __packed;
1031
848/* Internal events generated by Bluetooth stack */ 1032/* Internal events generated by Bluetooth stack */
849#define HCI_EV_STACK_INTERNAL 0xfd 1033#define HCI_EV_STACK_INTERNAL 0xfd
850struct hci_ev_stack_internal { 1034struct hci_ev_stack_internal {
@@ -874,7 +1058,7 @@ struct hci_ev_si_security {
874 1058
875struct hci_command_hdr { 1059struct hci_command_hdr {
876 __le16 opcode; /* OCF & OGF */ 1060 __le16 opcode; /* OCF & OGF */
877 __u8 plen; 1061 __u8 plen;
878} __packed; 1062} __packed;
879 1063
880struct hci_event_hdr { 1064struct hci_event_hdr {
@@ -892,7 +1076,6 @@ struct hci_sco_hdr {
892 __u8 dlen; 1076 __u8 dlen;
893} __packed; 1077} __packed;
894 1078
895#ifdef __KERNEL__
896#include <linux/skbuff.h> 1079#include <linux/skbuff.h>
897static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 1080static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
898{ 1081{
@@ -908,7 +1091,6 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
908{ 1091{
909 return (struct hci_sco_hdr *) skb->data; 1092 return (struct hci_sco_hdr *) skb->data;
910} 1093}
911#endif
912 1094
913/* Command opcode pack/unpack */ 1095/* Command opcode pack/unpack */
914#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 1096#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
@@ -934,9 +1116,13 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
934struct sockaddr_hci { 1116struct sockaddr_hci {
935 sa_family_t hci_family; 1117 sa_family_t hci_family;
936 unsigned short hci_dev; 1118 unsigned short hci_dev;
1119 unsigned short hci_channel;
937}; 1120};
938#define HCI_DEV_NONE 0xffff 1121#define HCI_DEV_NONE 0xffff
939 1122
1123#define HCI_CHANNEL_RAW 0
1124#define HCI_CHANNEL_CONTROL 1
1125
940struct hci_filter { 1126struct hci_filter {
941 unsigned long type_mask; 1127 unsigned long type_mask;
942 unsigned long event_mask[2]; 1128 unsigned long event_mask[2];