diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ssb/ssb_regs.h | 7 | ||||
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 33 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 122 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 152 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 53 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 142 | ||||
-rw-r--r-- | include/net/bluetooth/smp.h | 76 |
7 files changed, 548 insertions, 37 deletions
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index 489f7b6d61c5..402955ae48ce 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -85,6 +85,8 @@ | |||
85 | #define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ | 85 | #define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ |
86 | #define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ | 86 | #define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ |
87 | #define SSB_IMSTATE_TO 0x00040000 /* Timeout */ | 87 | #define SSB_IMSTATE_TO 0x00040000 /* Timeout */ |
88 | #define SSB_IMSTATE_BUSY 0x01800000 /* Busy (Backplane rev >= 2.3 only) */ | ||
89 | #define SSB_IMSTATE_REJECT 0x02000000 /* Reject (Backplane rev >= 2.3 only) */ | ||
88 | #define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ | 90 | #define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ |
89 | #define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ | 91 | #define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ |
90 | #define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ | 92 | #define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ |
@@ -97,7 +99,6 @@ | |||
97 | #define SSB_TMSLOW_RESET 0x00000001 /* Reset */ | 99 | #define SSB_TMSLOW_RESET 0x00000001 /* Reset */ |
98 | #define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ | 100 | #define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ |
99 | #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ | 101 | #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ |
100 | #define SSB_TMSLOW_PHYCLK 0x00000010 /* MAC PHY Clock Control Enable */ | ||
101 | #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ | 102 | #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ |
102 | #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ | 103 | #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ |
103 | #define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ | 104 | #define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ |
@@ -268,6 +269,8 @@ | |||
268 | /* SPROM Revision 4 */ | 269 | /* SPROM Revision 4 */ |
269 | #define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ | 270 | #define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ |
270 | #define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ | 271 | #define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ |
272 | #define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */ | ||
273 | #define SSB_SPROM4_BFL2HI 0x004A /* Board flags 2 Hi */ | ||
271 | #define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ | 274 | #define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ |
272 | #define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ | 275 | #define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ |
273 | #define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ | 276 | #define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ |
@@ -358,6 +361,8 @@ | |||
358 | #define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ | 361 | #define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ |
359 | #define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ | 362 | #define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ |
360 | #define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ | 363 | #define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ |
364 | #define SSB_SPROM5_BFL2LO 0x004E /* Board flags 2 (low 16 bits) */ | ||
365 | #define SSB_SPROM5_BFL2HI 0x0050 /* Board flags 2 Hi */ | ||
361 | #define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ | 366 | #define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ |
362 | #define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ | 367 | #define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ |
363 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ | 368 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 0c5e72503b77..43750439c521 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -64,6 +64,11 @@ struct bt_security { | |||
64 | 64 | ||
65 | #define BT_DEFER_SETUP 7 | 65 | #define BT_DEFER_SETUP 7 |
66 | 66 | ||
67 | #define BT_FLUSHABLE 8 | ||
68 | |||
69 | #define BT_FLUSHABLE_OFF 0 | ||
70 | #define BT_FLUSHABLE_ON 1 | ||
71 | |||
67 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) | 72 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) |
68 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) | 73 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) |
69 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) | 74 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) |
@@ -200,4 +205,32 @@ extern void bt_sysfs_cleanup(void); | |||
200 | 205 | ||
201 | extern struct dentry *bt_debugfs; | 206 | extern struct dentry *bt_debugfs; |
202 | 207 | ||
208 | #ifdef CONFIG_BT_L2CAP | ||
209 | int l2cap_init(void); | ||
210 | void l2cap_exit(void); | ||
211 | #else | ||
212 | static inline int l2cap_init(void) | ||
213 | { | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static inline void l2cap_exit(void) | ||
218 | { | ||
219 | } | ||
220 | #endif | ||
221 | |||
222 | #ifdef CONFIG_BT_SCO | ||
223 | int sco_init(void); | ||
224 | void sco_exit(void); | ||
225 | #else | ||
226 | static inline int sco_init(void) | ||
227 | { | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | static inline void sco_exit(void) | ||
232 | { | ||
233 | } | ||
234 | #endif | ||
235 | |||
203 | #endif /* __BLUETOOTH_H */ | 236 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 29a7a8ca0438..a5f8c4684a32 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -76,6 +76,14 @@ 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, | ||
79 | }; | 87 | }; |
80 | 88 | ||
81 | /* HCI ioctl defines */ | 89 | /* HCI ioctl defines */ |
@@ -111,6 +119,7 @@ enum { | |||
111 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ | 119 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ |
112 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ | 120 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
113 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | 121 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ |
122 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ | ||
114 | 123 | ||
115 | /* HCI data types */ | 124 | /* HCI data types */ |
116 | #define HCI_COMMAND_PKT 0x01 | 125 | #define HCI_COMMAND_PKT 0x01 |
@@ -150,6 +159,7 @@ enum { | |||
150 | #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) | 159 | #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) |
151 | 160 | ||
152 | /* ACL flags */ | 161 | /* ACL flags */ |
162 | #define ACL_START_NO_FLUSH 0x00 | ||
153 | #define ACL_CONT 0x01 | 163 | #define ACL_CONT 0x01 |
154 | #define ACL_START 0x02 | 164 | #define ACL_START 0x02 |
155 | #define ACL_ACTIVE_BCAST 0x04 | 165 | #define ACL_ACTIVE_BCAST 0x04 |
@@ -159,6 +169,8 @@ enum { | |||
159 | #define SCO_LINK 0x00 | 169 | #define SCO_LINK 0x00 |
160 | #define ACL_LINK 0x01 | 170 | #define ACL_LINK 0x01 |
161 | #define ESCO_LINK 0x02 | 171 | #define ESCO_LINK 0x02 |
172 | /* Low Energy links do not have defined link type. Use invented one */ | ||
173 | #define LE_LINK 0x80 | ||
162 | 174 | ||
163 | /* LMP features */ | 175 | /* LMP features */ |
164 | #define LMP_3SLOT 0x01 | 176 | #define LMP_3SLOT 0x01 |
@@ -183,17 +195,25 @@ enum { | |||
183 | #define LMP_PSCHEME 0x02 | 195 | #define LMP_PSCHEME 0x02 |
184 | #define LMP_PCONTROL 0x04 | 196 | #define LMP_PCONTROL 0x04 |
185 | 197 | ||
198 | #define LMP_RSSI_INQ 0x40 | ||
186 | #define LMP_ESCO 0x80 | 199 | #define LMP_ESCO 0x80 |
187 | 200 | ||
188 | #define LMP_EV4 0x01 | 201 | #define LMP_EV4 0x01 |
189 | #define LMP_EV5 0x02 | 202 | #define LMP_EV5 0x02 |
203 | #define LMP_LE 0x40 | ||
190 | 204 | ||
191 | #define LMP_SNIFF_SUBR 0x02 | 205 | #define LMP_SNIFF_SUBR 0x02 |
206 | #define LMP_PAUSE_ENC 0x04 | ||
192 | #define LMP_EDR_ESCO_2M 0x20 | 207 | #define LMP_EDR_ESCO_2M 0x20 |
193 | #define LMP_EDR_ESCO_3M 0x40 | 208 | #define LMP_EDR_ESCO_3M 0x40 |
194 | #define LMP_EDR_3S_ESCO 0x80 | 209 | #define LMP_EDR_3S_ESCO 0x80 |
195 | 210 | ||
211 | #define LMP_EXT_INQ 0x01 | ||
196 | #define LMP_SIMPLE_PAIR 0x08 | 212 | #define LMP_SIMPLE_PAIR 0x08 |
213 | #define LMP_NO_FLUSH 0x40 | ||
214 | |||
215 | #define LMP_LSTO 0x01 | ||
216 | #define LMP_INQ_TX_PWR 0x02 | ||
197 | 217 | ||
198 | /* Connection modes */ | 218 | /* Connection modes */ |
199 | #define HCI_CM_ACTIVE 0x0000 | 219 | #define HCI_CM_ACTIVE 0x0000 |
@@ -225,6 +245,8 @@ enum { | |||
225 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 | 245 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 |
226 | 246 | ||
227 | /* ----- HCI Commands ---- */ | 247 | /* ----- HCI Commands ---- */ |
248 | #define HCI_OP_NOP 0x0000 | ||
249 | |||
228 | #define HCI_OP_INQUIRY 0x0401 | 250 | #define HCI_OP_INQUIRY 0x0401 |
229 | struct hci_cp_inquiry { | 251 | struct hci_cp_inquiry { |
230 | __u8 lap[3]; | 252 | __u8 lap[3]; |
@@ -292,11 +314,19 @@ struct hci_cp_pin_code_reply { | |||
292 | __u8 pin_len; | 314 | __u8 pin_len; |
293 | __u8 pin_code[16]; | 315 | __u8 pin_code[16]; |
294 | } __packed; | 316 | } __packed; |
317 | struct hci_rp_pin_code_reply { | ||
318 | __u8 status; | ||
319 | bdaddr_t bdaddr; | ||
320 | } __packed; | ||
295 | 321 | ||
296 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e | 322 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e |
297 | struct hci_cp_pin_code_neg_reply { | 323 | struct hci_cp_pin_code_neg_reply { |
298 | bdaddr_t bdaddr; | 324 | bdaddr_t bdaddr; |
299 | } __packed; | 325 | } __packed; |
326 | struct hci_rp_pin_code_neg_reply { | ||
327 | __u8 status; | ||
328 | bdaddr_t bdaddr; | ||
329 | } __packed; | ||
300 | 330 | ||
301 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f | 331 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f |
302 | struct hci_cp_change_conn_ptype { | 332 | struct hci_cp_change_conn_ptype { |
@@ -377,6 +407,20 @@ struct hci_cp_reject_sync_conn_req { | |||
377 | __u8 reason; | 407 | __u8 reason; |
378 | } __packed; | 408 | } __packed; |
379 | 409 | ||
410 | #define HCI_OP_IO_CAPABILITY_REPLY 0x042b | ||
411 | struct hci_cp_io_capability_reply { | ||
412 | bdaddr_t bdaddr; | ||
413 | __u8 capability; | ||
414 | __u8 oob_data; | ||
415 | __u8 authentication; | ||
416 | } __packed; | ||
417 | |||
418 | #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 | ||
419 | struct hci_cp_io_capability_neg_reply { | ||
420 | bdaddr_t bdaddr; | ||
421 | __u8 reason; | ||
422 | } __packed; | ||
423 | |||
380 | #define HCI_OP_SNIFF_MODE 0x0803 | 424 | #define HCI_OP_SNIFF_MODE 0x0803 |
381 | struct hci_cp_sniff_mode { | 425 | struct hci_cp_sniff_mode { |
382 | __le16 handle; | 426 | __le16 handle; |
@@ -474,6 +518,12 @@ struct hci_cp_set_event_flt { | |||
474 | #define HCI_CONN_SETUP_AUTO_OFF 0x01 | 518 | #define HCI_CONN_SETUP_AUTO_OFF 0x01 |
475 | #define HCI_CONN_SETUP_AUTO_ON 0x02 | 519 | #define HCI_CONN_SETUP_AUTO_ON 0x02 |
476 | 520 | ||
521 | #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 | ||
522 | struct hci_cp_delete_stored_link_key { | ||
523 | bdaddr_t bdaddr; | ||
524 | __u8 delete_all; | ||
525 | } __packed; | ||
526 | |||
477 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 | 527 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 |
478 | struct hci_cp_write_local_name { | 528 | struct hci_cp_write_local_name { |
479 | __u8 name[248]; | 529 | __u8 name[248]; |
@@ -537,6 +587,8 @@ struct hci_cp_host_buffer_size { | |||
537 | __le16 sco_max_pkt; | 587 | __le16 sco_max_pkt; |
538 | } __packed; | 588 | } __packed; |
539 | 589 | ||
590 | #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 | ||
591 | |||
540 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 592 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
541 | struct hci_rp_read_ssp_mode { | 593 | struct hci_rp_read_ssp_mode { |
542 | __u8 status; | 594 | __u8 status; |
@@ -548,6 +600,8 @@ struct hci_cp_write_ssp_mode { | |||
548 | __u8 mode; | 600 | __u8 mode; |
549 | } __packed; | 601 | } __packed; |
550 | 602 | ||
603 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | ||
604 | |||
551 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 605 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
552 | struct hci_rp_read_local_version { | 606 | struct hci_rp_read_local_version { |
553 | __u8 status; | 607 | __u8 status; |
@@ -593,6 +647,47 @@ struct hci_rp_read_bd_addr { | |||
593 | bdaddr_t bdaddr; | 647 | bdaddr_t bdaddr; |
594 | } __packed; | 648 | } __packed; |
595 | 649 | ||
650 | #define HCI_OP_LE_SET_EVENT_MASK 0x2001 | ||
651 | struct hci_cp_le_set_event_mask { | ||
652 | __u8 mask[8]; | ||
653 | } __packed; | ||
654 | |||
655 | #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 | ||
656 | struct hci_rp_le_read_buffer_size { | ||
657 | __u8 status; | ||
658 | __le16 le_mtu; | ||
659 | __u8 le_max_pkt; | ||
660 | } __packed; | ||
661 | |||
662 | #define HCI_OP_LE_CREATE_CONN 0x200d | ||
663 | struct hci_cp_le_create_conn { | ||
664 | __le16 scan_interval; | ||
665 | __le16 scan_window; | ||
666 | __u8 filter_policy; | ||
667 | __u8 peer_addr_type; | ||
668 | bdaddr_t peer_addr; | ||
669 | __u8 own_address_type; | ||
670 | __le16 conn_interval_min; | ||
671 | __le16 conn_interval_max; | ||
672 | __le16 conn_latency; | ||
673 | __le16 supervision_timeout; | ||
674 | __le16 min_ce_len; | ||
675 | __le16 max_ce_len; | ||
676 | } __packed; | ||
677 | |||
678 | #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e | ||
679 | |||
680 | #define HCI_OP_LE_CONN_UPDATE 0x2013 | ||
681 | struct hci_cp_le_conn_update { | ||
682 | __le16 handle; | ||
683 | __le16 conn_interval_min; | ||
684 | __le16 conn_interval_max; | ||
685 | __le16 conn_latency; | ||
686 | __le16 supervision_timeout; | ||
687 | __le16 min_ce_len; | ||
688 | __le16 max_ce_len; | ||
689 | } __packed; | ||
690 | |||
596 | /* ---- HCI Events ---- */ | 691 | /* ---- HCI Events ---- */ |
597 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 692 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
598 | 693 | ||
@@ -833,6 +928,14 @@ struct hci_ev_io_capa_request { | |||
833 | bdaddr_t bdaddr; | 928 | bdaddr_t bdaddr; |
834 | } __packed; | 929 | } __packed; |
835 | 930 | ||
931 | #define HCI_EV_IO_CAPA_REPLY 0x32 | ||
932 | struct hci_ev_io_capa_reply { | ||
933 | bdaddr_t bdaddr; | ||
934 | __u8 capability; | ||
935 | __u8 oob_data; | ||
936 | __u8 authentication; | ||
937 | } __packed; | ||
938 | |||
836 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 | 939 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 |
837 | struct hci_ev_simple_pair_complete { | 940 | struct hci_ev_simple_pair_complete { |
838 | __u8 status; | 941 | __u8 status; |
@@ -845,6 +948,25 @@ struct hci_ev_remote_host_features { | |||
845 | __u8 features[8]; | 948 | __u8 features[8]; |
846 | } __packed; | 949 | } __packed; |
847 | 950 | ||
951 | #define HCI_EV_LE_META 0x3e | ||
952 | struct hci_ev_le_meta { | ||
953 | __u8 subevent; | ||
954 | } __packed; | ||
955 | |||
956 | /* Low energy meta events */ | ||
957 | #define HCI_EV_LE_CONN_COMPLETE 0x01 | ||
958 | struct hci_ev_le_conn_complete { | ||
959 | __u8 status; | ||
960 | __le16 handle; | ||
961 | __u8 role; | ||
962 | __u8 bdaddr_type; | ||
963 | bdaddr_t bdaddr; | ||
964 | __le16 interval; | ||
965 | __le16 latency; | ||
966 | __le16 supervision_timeout; | ||
967 | __u8 clk_accurancy; | ||
968 | } __packed; | ||
969 | |||
848 | /* Internal events generated by Bluetooth stack */ | 970 | /* Internal events generated by Bluetooth stack */ |
849 | #define HCI_EV_STACK_INTERNAL 0xfd | 971 | #define HCI_EV_STACK_INTERNAL 0xfd |
850 | struct hci_ev_stack_internal { | 972 | struct hci_ev_stack_internal { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d2cf88407690..d5d8454236bf 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -60,12 +60,28 @@ struct hci_conn_hash { | |||
60 | spinlock_t lock; | 60 | spinlock_t lock; |
61 | unsigned int acl_num; | 61 | unsigned int acl_num; |
62 | unsigned int sco_num; | 62 | unsigned int sco_num; |
63 | unsigned int le_num; | ||
63 | }; | 64 | }; |
64 | 65 | ||
65 | struct bdaddr_list { | 66 | struct bdaddr_list { |
66 | struct list_head list; | 67 | struct list_head list; |
67 | bdaddr_t bdaddr; | 68 | bdaddr_t bdaddr; |
68 | }; | 69 | }; |
70 | |||
71 | struct bt_uuid { | ||
72 | struct list_head list; | ||
73 | u8 uuid[16]; | ||
74 | u8 svc_hint; | ||
75 | }; | ||
76 | |||
77 | struct link_key { | ||
78 | struct list_head list; | ||
79 | bdaddr_t bdaddr; | ||
80 | u8 type; | ||
81 | u8 val[16]; | ||
82 | u8 pin_len; | ||
83 | }; | ||
84 | |||
69 | #define NUM_REASSEMBLY 4 | 85 | #define NUM_REASSEMBLY 4 |
70 | struct hci_dev { | 86 | struct hci_dev { |
71 | struct list_head list; | 87 | struct list_head list; |
@@ -80,13 +96,18 @@ struct hci_dev { | |||
80 | bdaddr_t bdaddr; | 96 | bdaddr_t bdaddr; |
81 | __u8 dev_name[248]; | 97 | __u8 dev_name[248]; |
82 | __u8 dev_class[3]; | 98 | __u8 dev_class[3]; |
99 | __u8 major_class; | ||
100 | __u8 minor_class; | ||
83 | __u8 features[8]; | 101 | __u8 features[8]; |
84 | __u8 commands[64]; | 102 | __u8 commands[64]; |
85 | __u8 ssp_mode; | 103 | __u8 ssp_mode; |
86 | __u8 hci_ver; | 104 | __u8 hci_ver; |
87 | __u16 hci_rev; | 105 | __u16 hci_rev; |
106 | __u8 lmp_ver; | ||
88 | __u16 manufacturer; | 107 | __u16 manufacturer; |
108 | __le16 lmp_subver; | ||
89 | __u16 voice_setting; | 109 | __u16 voice_setting; |
110 | __u8 io_capability; | ||
90 | 111 | ||
91 | __u16 pkt_type; | 112 | __u16 pkt_type; |
92 | __u16 esco_type; | 113 | __u16 esco_type; |
@@ -102,18 +123,26 @@ struct hci_dev { | |||
102 | atomic_t cmd_cnt; | 123 | atomic_t cmd_cnt; |
103 | unsigned int acl_cnt; | 124 | unsigned int acl_cnt; |
104 | unsigned int sco_cnt; | 125 | unsigned int sco_cnt; |
126 | unsigned int le_cnt; | ||
105 | 127 | ||
106 | unsigned int acl_mtu; | 128 | unsigned int acl_mtu; |
107 | unsigned int sco_mtu; | 129 | unsigned int sco_mtu; |
130 | unsigned int le_mtu; | ||
108 | unsigned int acl_pkts; | 131 | unsigned int acl_pkts; |
109 | unsigned int sco_pkts; | 132 | unsigned int sco_pkts; |
133 | unsigned int le_pkts; | ||
110 | 134 | ||
111 | unsigned long cmd_last_tx; | ||
112 | unsigned long acl_last_tx; | 135 | unsigned long acl_last_tx; |
113 | unsigned long sco_last_tx; | 136 | unsigned long sco_last_tx; |
137 | unsigned long le_last_tx; | ||
114 | 138 | ||
115 | struct workqueue_struct *workqueue; | 139 | struct workqueue_struct *workqueue; |
116 | 140 | ||
141 | struct work_struct power_on; | ||
142 | struct work_struct power_off; | ||
143 | struct timer_list off_timer; | ||
144 | |||
145 | struct timer_list cmd_timer; | ||
117 | struct tasklet_struct cmd_task; | 146 | struct tasklet_struct cmd_task; |
118 | struct tasklet_struct rx_task; | 147 | struct tasklet_struct rx_task; |
119 | struct tasklet_struct tx_task; | 148 | struct tasklet_struct tx_task; |
@@ -129,12 +158,17 @@ struct hci_dev { | |||
129 | wait_queue_head_t req_wait_q; | 158 | wait_queue_head_t req_wait_q; |
130 | __u32 req_status; | 159 | __u32 req_status; |
131 | __u32 req_result; | 160 | __u32 req_result; |
132 | __u16 req_last_cmd; | 161 | |
162 | __u16 init_last_cmd; | ||
133 | 163 | ||
134 | struct inquiry_cache inq_cache; | 164 | struct inquiry_cache inq_cache; |
135 | struct hci_conn_hash conn_hash; | 165 | struct hci_conn_hash conn_hash; |
136 | struct list_head blacklist; | 166 | struct list_head blacklist; |
137 | 167 | ||
168 | struct list_head uuids; | ||
169 | |||
170 | struct list_head link_keys; | ||
171 | |||
138 | struct hci_dev_stats stat; | 172 | struct hci_dev_stats stat; |
139 | 173 | ||
140 | struct sk_buff_head driver_init; | 174 | struct sk_buff_head driver_init; |
@@ -165,31 +199,37 @@ struct hci_dev { | |||
165 | struct hci_conn { | 199 | struct hci_conn { |
166 | struct list_head list; | 200 | struct list_head list; |
167 | 201 | ||
168 | atomic_t refcnt; | 202 | atomic_t refcnt; |
169 | spinlock_t lock; | 203 | spinlock_t lock; |
170 | 204 | ||
171 | bdaddr_t dst; | 205 | bdaddr_t dst; |
172 | __u16 handle; | 206 | __u16 handle; |
173 | __u16 state; | 207 | __u16 state; |
174 | __u8 mode; | 208 | __u8 mode; |
175 | __u8 type; | 209 | __u8 type; |
176 | __u8 out; | 210 | __u8 out; |
177 | __u8 attempt; | 211 | __u8 attempt; |
178 | __u8 dev_class[3]; | 212 | __u8 dev_class[3]; |
179 | __u8 features[8]; | 213 | __u8 features[8]; |
180 | __u8 ssp_mode; | 214 | __u8 ssp_mode; |
181 | __u16 interval; | 215 | __u16 interval; |
182 | __u16 pkt_type; | 216 | __u16 pkt_type; |
183 | __u16 link_policy; | 217 | __u16 link_policy; |
184 | __u32 link_mode; | 218 | __u32 link_mode; |
185 | __u8 auth_type; | 219 | __u8 auth_type; |
186 | __u8 sec_level; | 220 | __u8 sec_level; |
187 | __u8 pending_sec_level; | 221 | __u8 pending_sec_level; |
188 | __u8 power_save; | 222 | __u8 pin_length; |
189 | __u16 disc_timeout; | 223 | __u8 io_capability; |
190 | unsigned long pend; | 224 | __u8 power_save; |
191 | 225 | __u16 disc_timeout; | |
192 | unsigned int sent; | 226 | unsigned long pend; |
227 | |||
228 | __u8 remote_cap; | ||
229 | __u8 remote_oob; | ||
230 | __u8 remote_auth; | ||
231 | |||
232 | unsigned int sent; | ||
193 | 233 | ||
194 | struct sk_buff_head data_q; | 234 | struct sk_buff_head data_q; |
195 | 235 | ||
@@ -274,24 +314,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | |||
274 | { | 314 | { |
275 | struct hci_conn_hash *h = &hdev->conn_hash; | 315 | struct hci_conn_hash *h = &hdev->conn_hash; |
276 | list_add(&c->list, &h->list); | 316 | list_add(&c->list, &h->list); |
277 | if (c->type == ACL_LINK) | 317 | switch (c->type) { |
318 | case ACL_LINK: | ||
278 | h->acl_num++; | 319 | h->acl_num++; |
279 | else | 320 | break; |
321 | case LE_LINK: | ||
322 | h->le_num++; | ||
323 | break; | ||
324 | case SCO_LINK: | ||
325 | case ESCO_LINK: | ||
280 | h->sco_num++; | 326 | h->sco_num++; |
327 | break; | ||
328 | } | ||
281 | } | 329 | } |
282 | 330 | ||
283 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) | 331 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) |
284 | { | 332 | { |
285 | struct hci_conn_hash *h = &hdev->conn_hash; | 333 | struct hci_conn_hash *h = &hdev->conn_hash; |
286 | list_del(&c->list); | 334 | list_del(&c->list); |
287 | if (c->type == ACL_LINK) | 335 | switch (c->type) { |
336 | case ACL_LINK: | ||
288 | h->acl_num--; | 337 | h->acl_num--; |
289 | else | 338 | break; |
339 | case LE_LINK: | ||
340 | h->le_num--; | ||
341 | break; | ||
342 | case SCO_LINK: | ||
343 | case ESCO_LINK: | ||
290 | h->sco_num--; | 344 | h->sco_num--; |
345 | break; | ||
346 | } | ||
291 | } | 347 | } |
292 | 348 | ||
293 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | 349 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, |
294 | __u16 handle) | 350 | __u16 handle) |
295 | { | 351 | { |
296 | struct hci_conn_hash *h = &hdev->conn_hash; | 352 | struct hci_conn_hash *h = &hdev->conn_hash; |
297 | struct list_head *p; | 353 | struct list_head *p; |
@@ -306,7 +362,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | |||
306 | } | 362 | } |
307 | 363 | ||
308 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | 364 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, |
309 | __u8 type, bdaddr_t *ba) | 365 | __u8 type, bdaddr_t *ba) |
310 | { | 366 | { |
311 | struct hci_conn_hash *h = &hdev->conn_hash; | 367 | struct hci_conn_hash *h = &hdev->conn_hash; |
312 | struct list_head *p; | 368 | struct list_head *p; |
@@ -321,7 +377,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | |||
321 | } | 377 | } |
322 | 378 | ||
323 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | 379 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, |
324 | __u8 type, __u16 state) | 380 | __u8 type, __u16 state) |
325 | { | 381 | { |
326 | struct hci_conn_hash *h = &hdev->conn_hash; | 382 | struct hci_conn_hash *h = &hdev->conn_hash; |
327 | struct list_head *p; | 383 | struct list_head *p; |
@@ -437,6 +493,16 @@ int hci_inquiry(void __user *arg); | |||
437 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 493 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
438 | int hci_blacklist_clear(struct hci_dev *hdev); | 494 | int hci_blacklist_clear(struct hci_dev *hdev); |
439 | 495 | ||
496 | int hci_uuids_clear(struct hci_dev *hdev); | ||
497 | |||
498 | int hci_link_keys_clear(struct hci_dev *hdev); | ||
499 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
500 | int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | ||
501 | u8 *key, u8 type, u8 pin_len); | ||
502 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
503 | |||
504 | void hci_del_off_timer(struct hci_dev *hdev); | ||
505 | |||
440 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 506 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
441 | 507 | ||
442 | int hci_recv_frame(struct sk_buff *skb); | 508 | int hci_recv_frame(struct sk_buff *skb); |
@@ -458,6 +524,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
458 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | 524 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) |
459 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) | 525 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) |
460 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 526 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) |
527 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | ||
528 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | ||
461 | 529 | ||
462 | /* ----- HCI protocols ----- */ | 530 | /* ----- HCI protocols ----- */ |
463 | struct hci_proto { | 531 | struct hci_proto { |
@@ -660,12 +728,24 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | |||
660 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | 728 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); |
661 | 729 | ||
662 | /* ----- HCI Sockets ----- */ | 730 | /* ----- HCI Sockets ----- */ |
663 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); | 731 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, |
732 | struct sock *skip_sk); | ||
664 | 733 | ||
665 | /* Management interface */ | 734 | /* Management interface */ |
666 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 735 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
667 | int mgmt_index_added(u16 index); | 736 | int mgmt_index_added(u16 index); |
668 | int mgmt_index_removed(u16 index); | 737 | int mgmt_index_removed(u16 index); |
738 | int mgmt_powered(u16 index, u8 powered); | ||
739 | int mgmt_discoverable(u16 index, u8 discoverable); | ||
740 | int mgmt_connectable(u16 index, u8 connectable); | ||
741 | int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type); | ||
742 | int mgmt_connected(u16 index, bdaddr_t *bdaddr); | ||
743 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); | ||
744 | int mgmt_disconnect_failed(u16 index); | ||
745 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); | ||
746 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr); | ||
747 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
748 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
669 | 749 | ||
670 | /* HCI info for socket */ | 750 | /* HCI info for socket */ |
671 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 751 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
@@ -697,4 +777,6 @@ struct hci_sec_filter { | |||
697 | 777 | ||
698 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); | 778 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); |
699 | 779 | ||
780 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | ||
781 | u16 latency, u16 to_multiplier); | ||
700 | #endif /* __HCI_CORE_H */ | 782 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 7ad25ca60ec0..4f4bff1eaed6 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ | 38 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ |
39 | #define L2CAP_DEFAULT_ACK_TO 200 | 39 | #define L2CAP_DEFAULT_ACK_TO 200 |
40 | #define L2CAP_LOCAL_BUSY_TRIES 12 | 40 | #define L2CAP_LOCAL_BUSY_TRIES 12 |
41 | #define L2CAP_LE_DEFAULT_MTU 23 | ||
41 | 42 | ||
42 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 43 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
43 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 44 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ |
@@ -88,6 +89,8 @@ struct l2cap_conninfo { | |||
88 | #define L2CAP_ECHO_RSP 0x09 | 89 | #define L2CAP_ECHO_RSP 0x09 |
89 | #define L2CAP_INFO_REQ 0x0a | 90 | #define L2CAP_INFO_REQ 0x0a |
90 | #define L2CAP_INFO_RSP 0x0b | 91 | #define L2CAP_INFO_RSP 0x0b |
92 | #define L2CAP_CONN_PARAM_UPDATE_REQ 0x12 | ||
93 | #define L2CAP_CONN_PARAM_UPDATE_RSP 0x13 | ||
91 | 94 | ||
92 | /* L2CAP feature mask */ | 95 | /* L2CAP feature mask */ |
93 | #define L2CAP_FEAT_FLOWCTL 0x00000001 | 96 | #define L2CAP_FEAT_FLOWCTL 0x00000001 |
@@ -160,6 +163,9 @@ struct l2cap_conn_rsp { | |||
160 | /* channel indentifier */ | 163 | /* channel indentifier */ |
161 | #define L2CAP_CID_SIGNALING 0x0001 | 164 | #define L2CAP_CID_SIGNALING 0x0001 |
162 | #define L2CAP_CID_CONN_LESS 0x0002 | 165 | #define L2CAP_CID_CONN_LESS 0x0002 |
166 | #define L2CAP_CID_LE_DATA 0x0004 | ||
167 | #define L2CAP_CID_LE_SIGNALING 0x0005 | ||
168 | #define L2CAP_CID_SMP 0x0006 | ||
163 | #define L2CAP_CID_DYN_START 0x0040 | 169 | #define L2CAP_CID_DYN_START 0x0040 |
164 | #define L2CAP_CID_DYN_END 0xffff | 170 | #define L2CAP_CID_DYN_END 0xffff |
165 | 171 | ||
@@ -255,6 +261,21 @@ struct l2cap_info_rsp { | |||
255 | #define L2CAP_IR_SUCCESS 0x0000 | 261 | #define L2CAP_IR_SUCCESS 0x0000 |
256 | #define L2CAP_IR_NOTSUPP 0x0001 | 262 | #define L2CAP_IR_NOTSUPP 0x0001 |
257 | 263 | ||
264 | struct l2cap_conn_param_update_req { | ||
265 | __le16 min; | ||
266 | __le16 max; | ||
267 | __le16 latency; | ||
268 | __le16 to_multiplier; | ||
269 | } __packed; | ||
270 | |||
271 | struct l2cap_conn_param_update_rsp { | ||
272 | __le16 result; | ||
273 | } __packed; | ||
274 | |||
275 | /* Connection Parameters result */ | ||
276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 | ||
277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 | ||
278 | |||
258 | /* ----- L2CAP connections ----- */ | 279 | /* ----- L2CAP connections ----- */ |
259 | struct l2cap_chan_list { | 280 | struct l2cap_chan_list { |
260 | struct sock *head; | 281 | struct sock *head; |
@@ -327,6 +348,7 @@ struct l2cap_pinfo { | |||
327 | __u8 sec_level; | 348 | __u8 sec_level; |
328 | __u8 role_switch; | 349 | __u8 role_switch; |
329 | __u8 force_reliable; | 350 | __u8 force_reliable; |
351 | __u8 flushable; | ||
330 | 352 | ||
331 | __u8 conf_req[64]; | 353 | __u8 conf_req[64]; |
332 | __u8 conf_len; | 354 | __u8 conf_len; |
@@ -423,6 +445,35 @@ static inline int l2cap_tx_window_full(struct sock *sk) | |||
423 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) | 445 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) |
424 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) | 446 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) |
425 | 447 | ||
426 | void l2cap_load(void); | 448 | extern int disable_ertm; |
449 | extern const struct proto_ops l2cap_sock_ops; | ||
450 | extern struct bt_sock_list l2cap_sk_list; | ||
451 | |||
452 | int l2cap_init_sockets(void); | ||
453 | void l2cap_cleanup_sockets(void); | ||
454 | |||
455 | u8 l2cap_get_ident(struct l2cap_conn *conn); | ||
456 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); | ||
457 | int l2cap_build_conf_req(struct sock *sk, void *data); | ||
458 | int __l2cap_wait_ack(struct sock *sk); | ||
459 | |||
460 | struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); | ||
461 | struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); | ||
462 | struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); | ||
463 | int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, size_t len); | ||
464 | void l2cap_do_send(struct sock *sk, struct sk_buff *skb); | ||
465 | void l2cap_streaming_send(struct sock *sk); | ||
466 | int l2cap_ertm_send(struct sock *sk); | ||
467 | |||
468 | void l2cap_sock_set_timer(struct sock *sk, long timeout); | ||
469 | void l2cap_sock_clear_timer(struct sock *sk); | ||
470 | void __l2cap_sock_close(struct sock *sk, int reason); | ||
471 | void l2cap_sock_kill(struct sock *sk); | ||
472 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | ||
473 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | ||
474 | int proto, gfp_t prio); | ||
475 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err); | ||
476 | void l2cap_chan_del(struct sock *sk, int err); | ||
477 | int l2cap_do_connect(struct sock *sk); | ||
427 | 478 | ||
428 | #endif /* __L2CAP_H */ | 479 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index ca29c1367ffd..44ac55c85079 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -47,6 +47,7 @@ struct mgmt_rp_read_info { | |||
47 | __le16 index; | 47 | __le16 index; |
48 | __u8 type; | 48 | __u8 type; |
49 | __u8 powered; | 49 | __u8 powered; |
50 | __u8 connectable; | ||
50 | __u8 discoverable; | 51 | __u8 discoverable; |
51 | __u8 pairable; | 52 | __u8 pairable; |
52 | __u8 sec_mode; | 53 | __u8 sec_mode; |
@@ -58,6 +59,107 @@ struct mgmt_rp_read_info { | |||
58 | __u16 hci_rev; | 59 | __u16 hci_rev; |
59 | } __packed; | 60 | } __packed; |
60 | 61 | ||
62 | struct mgmt_mode { | ||
63 | __le16 index; | ||
64 | __u8 val; | ||
65 | } __packed; | ||
66 | |||
67 | #define MGMT_OP_SET_POWERED 0x0005 | ||
68 | |||
69 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 | ||
70 | |||
71 | #define MGMT_OP_SET_CONNECTABLE 0x0007 | ||
72 | |||
73 | #define MGMT_OP_SET_PAIRABLE 0x0008 | ||
74 | |||
75 | #define MGMT_OP_ADD_UUID 0x0009 | ||
76 | struct mgmt_cp_add_uuid { | ||
77 | __le16 index; | ||
78 | __u8 uuid[16]; | ||
79 | __u8 svc_hint; | ||
80 | } __packed; | ||
81 | |||
82 | #define MGMT_OP_REMOVE_UUID 0x000A | ||
83 | struct mgmt_cp_remove_uuid { | ||
84 | __le16 index; | ||
85 | __u8 uuid[16]; | ||
86 | } __packed; | ||
87 | |||
88 | #define MGMT_OP_SET_DEV_CLASS 0x000B | ||
89 | struct mgmt_cp_set_dev_class { | ||
90 | __le16 index; | ||
91 | __u8 major; | ||
92 | __u8 minor; | ||
93 | } __packed; | ||
94 | |||
95 | #define MGMT_OP_SET_SERVICE_CACHE 0x000C | ||
96 | struct mgmt_cp_set_service_cache { | ||
97 | __le16 index; | ||
98 | __u8 enable; | ||
99 | } __packed; | ||
100 | |||
101 | struct mgmt_key_info { | ||
102 | bdaddr_t bdaddr; | ||
103 | u8 type; | ||
104 | u8 val[16]; | ||
105 | u8 pin_len; | ||
106 | } __packed; | ||
107 | |||
108 | #define MGMT_OP_LOAD_KEYS 0x000D | ||
109 | struct mgmt_cp_load_keys { | ||
110 | __le16 index; | ||
111 | __u8 debug_keys; | ||
112 | __le16 key_count; | ||
113 | struct mgmt_key_info keys[0]; | ||
114 | } __packed; | ||
115 | |||
116 | #define MGMT_OP_REMOVE_KEY 0x000E | ||
117 | struct mgmt_cp_remove_key { | ||
118 | __le16 index; | ||
119 | bdaddr_t bdaddr; | ||
120 | __u8 disconnect; | ||
121 | } __packed; | ||
122 | |||
123 | #define MGMT_OP_DISCONNECT 0x000F | ||
124 | struct mgmt_cp_disconnect { | ||
125 | __le16 index; | ||
126 | bdaddr_t bdaddr; | ||
127 | } __packed; | ||
128 | struct mgmt_rp_disconnect { | ||
129 | __le16 index; | ||
130 | bdaddr_t bdaddr; | ||
131 | } __packed; | ||
132 | |||
133 | #define MGMT_OP_GET_CONNECTIONS 0x0010 | ||
134 | struct mgmt_cp_get_connections { | ||
135 | __le16 index; | ||
136 | } __packed; | ||
137 | struct mgmt_rp_get_connections { | ||
138 | __le16 index; | ||
139 | __le16 conn_count; | ||
140 | bdaddr_t conn[0]; | ||
141 | } __packed; | ||
142 | |||
143 | #define MGMT_OP_PIN_CODE_REPLY 0x0011 | ||
144 | struct mgmt_cp_pin_code_reply { | ||
145 | __le16 index; | ||
146 | bdaddr_t bdaddr; | ||
147 | __u8 pin_len; | ||
148 | __u8 pin_code[16]; | ||
149 | } __packed; | ||
150 | |||
151 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 | ||
152 | struct mgmt_cp_pin_code_neg_reply { | ||
153 | __le16 index; | ||
154 | bdaddr_t bdaddr; | ||
155 | } __packed; | ||
156 | |||
157 | #define MGMT_OP_SET_IO_CAPABILITY 0x0013 | ||
158 | struct mgmt_cp_set_io_capability { | ||
159 | __le16 index; | ||
160 | __u8 io_capability; | ||
161 | } __packed; | ||
162 | |||
61 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 163 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
62 | struct mgmt_ev_cmd_complete { | 164 | struct mgmt_ev_cmd_complete { |
63 | __le16 opcode; | 165 | __le16 opcode; |
@@ -85,3 +187,43 @@ struct mgmt_ev_index_added { | |||
85 | struct mgmt_ev_index_removed { | 187 | struct mgmt_ev_index_removed { |
86 | __le16 index; | 188 | __le16 index; |
87 | } __packed; | 189 | } __packed; |
190 | |||
191 | #define MGMT_EV_POWERED 0x0006 | ||
192 | |||
193 | #define MGMT_EV_DISCOVERABLE 0x0007 | ||
194 | |||
195 | #define MGMT_EV_CONNECTABLE 0x0008 | ||
196 | |||
197 | #define MGMT_EV_PAIRABLE 0x0009 | ||
198 | |||
199 | #define MGMT_EV_NEW_KEY 0x000A | ||
200 | struct mgmt_ev_new_key { | ||
201 | __le16 index; | ||
202 | struct mgmt_key_info key; | ||
203 | __u8 old_key_type; | ||
204 | } __packed; | ||
205 | |||
206 | #define MGMT_EV_CONNECTED 0x000B | ||
207 | struct mgmt_ev_connected { | ||
208 | __le16 index; | ||
209 | bdaddr_t bdaddr; | ||
210 | } __packed; | ||
211 | |||
212 | #define MGMT_EV_DISCONNECTED 0x000C | ||
213 | struct mgmt_ev_disconnected { | ||
214 | __le16 index; | ||
215 | bdaddr_t bdaddr; | ||
216 | } __packed; | ||
217 | |||
218 | #define MGMT_EV_CONNECT_FAILED 0x000D | ||
219 | struct mgmt_ev_connect_failed { | ||
220 | __le16 index; | ||
221 | bdaddr_t bdaddr; | ||
222 | __u8 status; | ||
223 | } __packed; | ||
224 | |||
225 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E | ||
226 | struct mgmt_ev_pin_code_request { | ||
227 | __le16 index; | ||
228 | bdaddr_t bdaddr; | ||
229 | } __packed; | ||
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h new file mode 100644 index 000000000000..8f2edbf979dc --- /dev/null +++ b/include/net/bluetooth/smp.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef __SMP_H | ||
2 | #define __SMP_H | ||
3 | |||
4 | struct smp_command_hdr { | ||
5 | __u8 code; | ||
6 | } __packed; | ||
7 | |||
8 | #define SMP_CMD_PAIRING_REQ 0x01 | ||
9 | #define SMP_CMD_PAIRING_RSP 0x02 | ||
10 | struct smp_cmd_pairing { | ||
11 | __u8 io_capability; | ||
12 | __u8 oob_flag; | ||
13 | __u8 auth_req; | ||
14 | __u8 max_key_size; | ||
15 | __u8 init_key_dist; | ||
16 | __u8 resp_key_dist; | ||
17 | } __packed; | ||
18 | |||
19 | #define SMP_CMD_PAIRING_CONFIRM 0x03 | ||
20 | struct smp_cmd_pairing_confirm { | ||
21 | __u8 confirm_val[16]; | ||
22 | } __packed; | ||
23 | |||
24 | #define SMP_CMD_PAIRING_RANDOM 0x04 | ||
25 | struct smp_cmd_pairing_random { | ||
26 | __u8 rand_val[16]; | ||
27 | } __packed; | ||
28 | |||
29 | #define SMP_CMD_PAIRING_FAIL 0x05 | ||
30 | struct smp_cmd_pairing_fail { | ||
31 | __u8 reason; | ||
32 | } __packed; | ||
33 | |||
34 | #define SMP_CMD_ENCRYPT_INFO 0x06 | ||
35 | struct smp_cmd_encrypt_info { | ||
36 | __u8 ltk[16]; | ||
37 | } __packed; | ||
38 | |||
39 | #define SMP_CMD_MASTER_IDENT 0x07 | ||
40 | struct smp_cmd_master_ident { | ||
41 | __u16 ediv; | ||
42 | __u8 rand[8]; | ||
43 | } __packed; | ||
44 | |||
45 | #define SMP_CMD_IDENT_INFO 0x08 | ||
46 | struct smp_cmd_ident_info { | ||
47 | __u8 irk[16]; | ||
48 | } __packed; | ||
49 | |||
50 | #define SMP_CMD_IDENT_ADDR_INFO 0x09 | ||
51 | struct smp_cmd_ident_addr_info { | ||
52 | __u8 addr_type; | ||
53 | bdaddr_t bdaddr; | ||
54 | } __packed; | ||
55 | |||
56 | #define SMP_CMD_SIGN_INFO 0x0a | ||
57 | struct smp_cmd_sign_info { | ||
58 | __u8 csrk[16]; | ||
59 | } __packed; | ||
60 | |||
61 | #define SMP_CMD_SECURITY_REQ 0x0b | ||
62 | struct smp_cmd_security_req { | ||
63 | __u8 auth_req; | ||
64 | } __packed; | ||
65 | |||
66 | #define SMP_PASSKEY_ENTRY_FAILED 0x01 | ||
67 | #define SMP_OOB_NOT_AVAIL 0x02 | ||
68 | #define SMP_AUTH_REQUIREMENTS 0x03 | ||
69 | #define SMP_CONFIRM_FAILED 0x04 | ||
70 | #define SMP_PAIRING_NOTSUPP 0x05 | ||
71 | #define SMP_ENC_KEY_SIZE 0x06 | ||
72 | #define SMP_CMD_NOTSUPP 0x07 | ||
73 | #define SMP_UNSPECIFIED 0x08 | ||
74 | #define SMP_REPEATED_ATTEMPTS 0x09 | ||
75 | |||
76 | #endif /* __SMP_H */ | ||