11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds BlueZ - Bluetooth protocol stack for Linux 31da177e4SLinus Torvalds Copyright (C) 2000-2001 Qualcomm Incorporated 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 61da177e4SLinus Torvalds 71da177e4SLinus Torvalds This program is free software; you can redistribute it and/or modify 81da177e4SLinus Torvalds it under the terms of the GNU General Public License version 2 as 91da177e4SLinus Torvalds published by the Free Software Foundation; 101da177e4SLinus Torvalds 111da177e4SLinus Torvalds THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 121da177e4SLinus Torvalds OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 131da177e4SLinus Torvalds FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 141da177e4SLinus Torvalds IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 151da177e4SLinus Torvalds CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 161da177e4SLinus Torvalds WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 171da177e4SLinus Torvalds ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 181da177e4SLinus Torvalds OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 191da177e4SLinus Torvalds 201da177e4SLinus Torvalds ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 211da177e4SLinus Torvalds COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 221da177e4SLinus Torvalds SOFTWARE IS DISCLAIMED. 231da177e4SLinus Torvalds */ 241da177e4SLinus Torvalds 251da177e4SLinus Torvalds #ifndef __HCI_H 261da177e4SLinus Torvalds #define __HCI_H 271da177e4SLinus Torvalds 281da177e4SLinus Torvalds #define HCI_MAX_ACL_SIZE 1024 291da177e4SLinus Torvalds #define HCI_MAX_SCO_SIZE 255 301da177e4SLinus Torvalds #define HCI_MAX_EVENT_SIZE 260 311da177e4SLinus Torvalds #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 321da177e4SLinus Torvalds 331da177e4SLinus Torvalds /* HCI dev events */ 341da177e4SLinus Torvalds #define HCI_DEV_REG 1 351da177e4SLinus Torvalds #define HCI_DEV_UNREG 2 361da177e4SLinus Torvalds #define HCI_DEV_UP 3 371da177e4SLinus Torvalds #define HCI_DEV_DOWN 4 381da177e4SLinus Torvalds #define HCI_DEV_SUSPEND 5 391da177e4SLinus Torvalds #define HCI_DEV_RESUME 6 401da177e4SLinus Torvalds 411da177e4SLinus Torvalds /* HCI notify events */ 421da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD 1 431da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL 2 441da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING 3 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds /* HCI device types */ 470ac53939SMarcel Holtmann #define HCI_VIRTUAL 0 481da177e4SLinus Torvalds #define HCI_USB 1 491da177e4SLinus Torvalds #define HCI_PCCARD 2 501da177e4SLinus Torvalds #define HCI_UART 3 511da177e4SLinus Torvalds #define HCI_RS232 4 521da177e4SLinus Torvalds #define HCI_PCI 5 530ac53939SMarcel Holtmann #define HCI_SDIO 6 541da177e4SLinus Torvalds 551da177e4SLinus Torvalds /* HCI device quirks */ 561da177e4SLinus Torvalds enum { 571da177e4SLinus Torvalds HCI_QUIRK_RESET_ON_INIT, 58da1f5198SMarcel Holtmann HCI_QUIRK_RAW_DEVICE, 59da1f5198SMarcel Holtmann HCI_QUIRK_FIXUP_BUFFER_SIZE 601da177e4SLinus Torvalds }; 611da177e4SLinus Torvalds 621da177e4SLinus Torvalds /* HCI device flags */ 631da177e4SLinus Torvalds enum { 641da177e4SLinus Torvalds HCI_UP, 651da177e4SLinus Torvalds HCI_INIT, 661da177e4SLinus Torvalds HCI_RUNNING, 671da177e4SLinus Torvalds 681da177e4SLinus Torvalds HCI_PSCAN, 691da177e4SLinus Torvalds HCI_ISCAN, 701da177e4SLinus Torvalds HCI_AUTH, 711da177e4SLinus Torvalds HCI_ENCRYPT, 721da177e4SLinus Torvalds HCI_INQUIRY, 731da177e4SLinus Torvalds 741da177e4SLinus Torvalds HCI_RAW, 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds HCI_SECMGR 771da177e4SLinus Torvalds }; 781da177e4SLinus Torvalds 791da177e4SLinus Torvalds /* HCI ioctl defines */ 801da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 811da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 821da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 831da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 861da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 871da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 881da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 891da177e4SLinus Torvalds 901da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 911da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 921da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 931da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 941da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 951da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 961da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 971da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 981da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds #define HCISETSECMGR _IOW('H', 230, int) 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1031da177e4SLinus Torvalds 1041da177e4SLinus Torvalds /* HCI timeouts */ 10504837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 10604837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 10704837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 10804837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 1091da177e4SLinus Torvalds 1105b7f9909SMarcel Holtmann /* HCI data types */ 1111da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1121da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1131da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1141da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1151da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1161da177e4SLinus Torvalds 1175b7f9909SMarcel Holtmann /* HCI packet types */ 1181da177e4SLinus Torvalds #define HCI_DM1 0x0008 1191da177e4SLinus Torvalds #define HCI_DM3 0x0400 1201da177e4SLinus Torvalds #define HCI_DM5 0x4000 1211da177e4SLinus Torvalds #define HCI_DH1 0x0010 1221da177e4SLinus Torvalds #define HCI_DH3 0x0800 1231da177e4SLinus Torvalds #define HCI_DH5 0x8000 1241da177e4SLinus Torvalds 1251da177e4SLinus Torvalds #define HCI_HV1 0x0020 1261da177e4SLinus Torvalds #define HCI_HV2 0x0040 1271da177e4SLinus Torvalds #define HCI_HV3 0x0080 1281da177e4SLinus Torvalds 1291da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1301da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1311da177e4SLinus Torvalds 1325b7f9909SMarcel Holtmann /* eSCO packet types */ 1335b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1345b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1355b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1365b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1375b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1385b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 1395b7f9909SMarcel Holtmann 140a8746417SMarcel Holtmann #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 141a8746417SMarcel Holtmann 1421da177e4SLinus Torvalds /* ACL flags */ 1431da177e4SLinus Torvalds #define ACL_CONT 0x01 1441da177e4SLinus Torvalds #define ACL_START 0x02 1451da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 1461da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvalds /* Baseband links */ 1491da177e4SLinus Torvalds #define SCO_LINK 0x00 1501da177e4SLinus Torvalds #define ACL_LINK 0x01 1515b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 1521da177e4SLinus Torvalds 1531da177e4SLinus Torvalds /* LMP features */ 1541da177e4SLinus Torvalds #define LMP_3SLOT 0x01 1551da177e4SLinus Torvalds #define LMP_5SLOT 0x02 1561da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 1571da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 1581da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 1591da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 1601da177e4SLinus Torvalds #define LMP_HOLD 0x40 16104837f64SMarcel Holtmann #define LMP_SNIFF 0x80 1621da177e4SLinus Torvalds 1631da177e4SLinus Torvalds #define LMP_PARK 0x01 1641da177e4SLinus Torvalds #define LMP_RSSI 0x02 1651da177e4SLinus Torvalds #define LMP_QUALITY 0x04 1661da177e4SLinus Torvalds #define LMP_SCO 0x08 1671da177e4SLinus Torvalds #define LMP_HV2 0x10 1681da177e4SLinus Torvalds #define LMP_HV3 0x20 1691da177e4SLinus Torvalds #define LMP_ULAW 0x40 1701da177e4SLinus Torvalds #define LMP_ALAW 0x80 1711da177e4SLinus Torvalds 1721da177e4SLinus Torvalds #define LMP_CVSD 0x01 1731da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 1741da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 1751da177e4SLinus Torvalds 1765b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 1775b7f9909SMarcel Holtmann 1785b7f9909SMarcel Holtmann #define LMP_EV4 0x01 1795b7f9909SMarcel Holtmann #define LMP_EV5 0x02 1805b7f9909SMarcel Holtmann 18104837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 18204837f64SMarcel Holtmann 18304837f64SMarcel Holtmann /* Connection modes */ 18404837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 18504837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 18604837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 18704837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 18804837f64SMarcel Holtmann 1891da177e4SLinus Torvalds /* Link policies */ 1901da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 1911da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 1921da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 1931da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 1941da177e4SLinus Torvalds 19504837f64SMarcel Holtmann /* Link modes */ 1961da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 1971da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 1981da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 1991da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 2001da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 2011da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2021da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2031da177e4SLinus Torvalds 2041da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 205a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 206a9de9248SMarcel Holtmann struct hci_cp_inquiry { 207a9de9248SMarcel Holtmann __u8 lap[3]; 208a9de9248SMarcel Holtmann __u8 length; 209a9de9248SMarcel Holtmann __u8 num_rsp; 2101da177e4SLinus Torvalds } __attribute__ ((packed)); 2111da177e4SLinus Torvalds 212a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 213a9de9248SMarcel Holtmann 214a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 215a9de9248SMarcel Holtmann 216a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 217a9de9248SMarcel Holtmann struct hci_cp_create_conn { 218a9de9248SMarcel Holtmann bdaddr_t bdaddr; 219a9de9248SMarcel Holtmann __le16 pkt_type; 220a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 221a9de9248SMarcel Holtmann __u8 pscan_mode; 222a9de9248SMarcel Holtmann __le16 clock_offset; 223a9de9248SMarcel Holtmann __u8 role_switch; 2241da177e4SLinus Torvalds } __attribute__ ((packed)); 2251da177e4SLinus Torvalds 226a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 227a9de9248SMarcel Holtmann struct hci_cp_disconnect { 228a9de9248SMarcel Holtmann __le16 handle; 229a9de9248SMarcel Holtmann __u8 reason; 2301da177e4SLinus Torvalds } __attribute__ ((packed)); 2311da177e4SLinus Torvalds 232a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 233a9de9248SMarcel Holtmann struct hci_cp_add_sco { 234a9de9248SMarcel Holtmann __le16 handle; 235a9de9248SMarcel Holtmann __le16 pkt_type; 236a9de9248SMarcel Holtmann } __attribute__ ((packed)); 237a9de9248SMarcel Holtmann 238a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 239a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 2401da177e4SLinus Torvalds bdaddr_t bdaddr; 2411da177e4SLinus Torvalds } __attribute__ ((packed)); 2421da177e4SLinus Torvalds 243a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 244a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 245a9de9248SMarcel Holtmann bdaddr_t bdaddr; 246a9de9248SMarcel Holtmann __u8 role; 247a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2481da177e4SLinus Torvalds 249a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 250a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 251a9de9248SMarcel Holtmann bdaddr_t bdaddr; 252a9de9248SMarcel Holtmann __u8 reason; 253a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2541da177e4SLinus Torvalds 255a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 256a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 257a9de9248SMarcel Holtmann bdaddr_t bdaddr; 258a9de9248SMarcel Holtmann __u8 link_key[16]; 259a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2601da177e4SLinus Torvalds 261a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 262a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 263a9de9248SMarcel Holtmann bdaddr_t bdaddr; 264a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2651da177e4SLinus Torvalds 266a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 267a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 268a9de9248SMarcel Holtmann bdaddr_t bdaddr; 269a9de9248SMarcel Holtmann __u8 pin_len; 270a9de9248SMarcel Holtmann __u8 pin_code[16]; 271a9de9248SMarcel Holtmann } __attribute__ ((packed)); 272a9de9248SMarcel Holtmann 273a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 274a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 275a9de9248SMarcel Holtmann bdaddr_t bdaddr; 276a9de9248SMarcel Holtmann } __attribute__ ((packed)); 277a9de9248SMarcel Holtmann 278a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 279a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 280a9de9248SMarcel Holtmann __le16 handle; 281a9de9248SMarcel Holtmann __le16 pkt_type; 282a9de9248SMarcel Holtmann } __attribute__ ((packed)); 283a9de9248SMarcel Holtmann 284a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 285a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 286a9de9248SMarcel Holtmann __le16 handle; 287a9de9248SMarcel Holtmann } __attribute__ ((packed)); 288a9de9248SMarcel Holtmann 289a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 290a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 291a9de9248SMarcel Holtmann __le16 handle; 292a9de9248SMarcel Holtmann __u8 encrypt; 293a9de9248SMarcel Holtmann } __attribute__ ((packed)); 294a9de9248SMarcel Holtmann 295a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 296a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 297a9de9248SMarcel Holtmann __le16 handle; 298a9de9248SMarcel Holtmann } __attribute__ ((packed)); 299a9de9248SMarcel Holtmann 300a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 301a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 302a9de9248SMarcel Holtmann bdaddr_t bdaddr; 303a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 304a9de9248SMarcel Holtmann __u8 pscan_mode; 305a9de9248SMarcel Holtmann __le16 clock_offset; 306a9de9248SMarcel Holtmann } __attribute__ ((packed)); 307a9de9248SMarcel Holtmann 308a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 309a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 310a9de9248SMarcel Holtmann bdaddr_t bdaddr; 311a9de9248SMarcel Holtmann } __attribute__ ((packed)); 312a9de9248SMarcel Holtmann 313a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 314a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 315a9de9248SMarcel Holtmann __le16 handle; 316a9de9248SMarcel Holtmann } __attribute__ ((packed)); 317a9de9248SMarcel Holtmann 318a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 319a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 320a9de9248SMarcel Holtmann __le16 handle; 321a9de9248SMarcel Holtmann __u8 page; 322a9de9248SMarcel Holtmann } __attribute__ ((packed)); 323a9de9248SMarcel Holtmann 324a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 325a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 326a9de9248SMarcel Holtmann __le16 handle; 327a9de9248SMarcel Holtmann } __attribute__ ((packed)); 328a9de9248SMarcel Holtmann 329a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 330a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 331a9de9248SMarcel Holtmann __le16 handle; 332a9de9248SMarcel Holtmann __le32 tx_bandwidth; 333a9de9248SMarcel Holtmann __le32 rx_bandwidth; 334a9de9248SMarcel Holtmann __le16 max_latency; 335a9de9248SMarcel Holtmann __le16 voice_setting; 336a9de9248SMarcel Holtmann __u8 retrans_effort; 337a9de9248SMarcel Holtmann __le16 pkt_type; 338a9de9248SMarcel Holtmann } __attribute__ ((packed)); 339a9de9248SMarcel Holtmann 340a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 341a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 342a9de9248SMarcel Holtmann bdaddr_t bdaddr; 343a9de9248SMarcel Holtmann __le32 tx_bandwidth; 344a9de9248SMarcel Holtmann __le32 rx_bandwidth; 345a9de9248SMarcel Holtmann __le16 max_latency; 346a9de9248SMarcel Holtmann __le16 content_format; 347a9de9248SMarcel Holtmann __u8 retrans_effort; 348a9de9248SMarcel Holtmann __le16 pkt_type; 349a9de9248SMarcel Holtmann } __attribute__ ((packed)); 350a9de9248SMarcel Holtmann 351a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 352a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 353a9de9248SMarcel Holtmann bdaddr_t bdaddr; 354a9de9248SMarcel Holtmann __u8 reason; 355a9de9248SMarcel Holtmann } __attribute__ ((packed)); 356a9de9248SMarcel Holtmann 357a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 358a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 359a9de9248SMarcel Holtmann __le16 handle; 360a9de9248SMarcel Holtmann __le16 max_interval; 361a9de9248SMarcel Holtmann __le16 min_interval; 362a9de9248SMarcel Holtmann __le16 attempt; 363a9de9248SMarcel Holtmann __le16 timeout; 364a9de9248SMarcel Holtmann } __attribute__ ((packed)); 365a9de9248SMarcel Holtmann 366a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 367a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 368a9de9248SMarcel Holtmann __le16 handle; 369a9de9248SMarcel Holtmann } __attribute__ ((packed)); 370a9de9248SMarcel Holtmann 371a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 372a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 373a9de9248SMarcel Holtmann __le16 handle; 374a9de9248SMarcel Holtmann } __attribute__ ((packed)); 375a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 376a9de9248SMarcel Holtmann __u8 status; 377a9de9248SMarcel Holtmann __le16 handle; 378a9de9248SMarcel Holtmann __u8 role; 379a9de9248SMarcel Holtmann } __attribute__ ((packed)); 380a9de9248SMarcel Holtmann 381a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 382a9de9248SMarcel Holtmann struct hci_cp_switch_role { 383a9de9248SMarcel Holtmann bdaddr_t bdaddr; 384a9de9248SMarcel Holtmann __u8 role; 385a9de9248SMarcel Holtmann } __attribute__ ((packed)); 386a9de9248SMarcel Holtmann 387a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 388a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 389a9de9248SMarcel Holtmann __le16 handle; 390a9de9248SMarcel Holtmann } __attribute__ ((packed)); 391a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 392a9de9248SMarcel Holtmann __u8 status; 393a9de9248SMarcel Holtmann __le16 handle; 394a9de9248SMarcel Holtmann __le16 policy; 395a9de9248SMarcel Holtmann } __attribute__ ((packed)); 396a9de9248SMarcel Holtmann 397a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 398a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 399a9de9248SMarcel Holtmann __le16 handle; 400a9de9248SMarcel Holtmann __le16 policy; 401a9de9248SMarcel Holtmann } __attribute__ ((packed)); 402a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 403a9de9248SMarcel Holtmann __u8 status; 404a9de9248SMarcel Holtmann __le16 handle; 405a9de9248SMarcel Holtmann } __attribute__ ((packed)); 406a9de9248SMarcel Holtmann 407*e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 408*e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy { 409*e4e8e37cSMarcel Holtmann __u8 status; 410*e4e8e37cSMarcel Holtmann __le16 policy; 411*e4e8e37cSMarcel Holtmann } __attribute__ ((packed)); 412*e4e8e37cSMarcel Holtmann 413*e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 414*e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy { 415*e4e8e37cSMarcel Holtmann __le16 policy; 416*e4e8e37cSMarcel Holtmann } __attribute__ ((packed)); 417*e4e8e37cSMarcel Holtmann 418a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 419a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 420a9de9248SMarcel Holtmann __le16 handle; 421a9de9248SMarcel Holtmann __le16 max_latency; 422a9de9248SMarcel Holtmann __le16 min_remote_timeout; 423a9de9248SMarcel Holtmann __le16 min_local_timeout; 424a9de9248SMarcel Holtmann } __attribute__ ((packed)); 425a9de9248SMarcel Holtmann 426a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 427a9de9248SMarcel Holtmann struct hci_cp_set_event_mask { 428a9de9248SMarcel Holtmann __u8 mask[8]; 429a9de9248SMarcel Holtmann } __attribute__ ((packed)); 430a9de9248SMarcel Holtmann 431a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 432a9de9248SMarcel Holtmann 433a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 4341da177e4SLinus Torvalds struct hci_cp_set_event_flt { 4351da177e4SLinus Torvalds __u8 flt_type; 4361da177e4SLinus Torvalds __u8 cond_type; 4371da177e4SLinus Torvalds __u8 condition[0]; 4381da177e4SLinus Torvalds } __attribute__ ((packed)); 4391da177e4SLinus Torvalds 4401da177e4SLinus Torvalds /* Filter types */ 4411da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 4421da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 4431da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 4441da177e4SLinus Torvalds 4451da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 4461da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 4471da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 4481da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 4491da177e4SLinus Torvalds 4501da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 4511da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 4521da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 4531da177e4SLinus Torvalds 454a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 455a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 456a9de9248SMarcel Holtmann __u8 name[248]; 457a9de9248SMarcel Holtmann } __attribute__ ((packed)); 458a9de9248SMarcel Holtmann 459a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 460a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 461a9de9248SMarcel Holtmann __u8 status; 462a9de9248SMarcel Holtmann __u8 name[248]; 463a9de9248SMarcel Holtmann } __attribute__ ((packed)); 464a9de9248SMarcel Holtmann 465a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 466a9de9248SMarcel Holtmann 467a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 468a9de9248SMarcel Holtmann 469a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 470a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 471a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 472a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 473a9de9248SMarcel Holtmann 474a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 475a9de9248SMarcel Holtmann 476a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 477a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 478a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 479a9de9248SMarcel Holtmann 480a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 481a9de9248SMarcel Holtmann 482a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 483a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 484a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 485a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 486a9de9248SMarcel Holtmann 487a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 488a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 4891da177e4SLinus Torvalds __u8 status; 4901da177e4SLinus Torvalds __u8 dev_class[3]; 4911da177e4SLinus Torvalds } __attribute__ ((packed)); 4921da177e4SLinus Torvalds 493a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 494a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 4951da177e4SLinus Torvalds __u8 dev_class[3]; 4961da177e4SLinus Torvalds } __attribute__ ((packed)); 4971da177e4SLinus Torvalds 498a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 4991da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 5001da177e4SLinus Torvalds __u8 status; 5011ebb9252SMarcel Holtmann __le16 voice_setting; 5021da177e4SLinus Torvalds } __attribute__ ((packed)); 5031da177e4SLinus Torvalds 504a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 5051da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 5061ebb9252SMarcel Holtmann __le16 voice_setting; 5071da177e4SLinus Torvalds } __attribute__ ((packed)); 5081da177e4SLinus Torvalds 509a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 5101da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 5111ebb9252SMarcel Holtmann __le16 acl_mtu; 5121da177e4SLinus Torvalds __u8 sco_mtu; 5131ebb9252SMarcel Holtmann __le16 acl_max_pkt; 5141ebb9252SMarcel Holtmann __le16 sco_max_pkt; 5151da177e4SLinus Torvalds } __attribute__ ((packed)); 5161da177e4SLinus Torvalds 517a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 518a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 5191da177e4SLinus Torvalds __u8 status; 520a9de9248SMarcel Holtmann __u8 hci_ver; 521a9de9248SMarcel Holtmann __le16 hci_rev; 522a9de9248SMarcel Holtmann __u8 lmp_ver; 523a9de9248SMarcel Holtmann __le16 manufacturer; 524a9de9248SMarcel Holtmann __le16 lmp_subver; 5251da177e4SLinus Torvalds } __attribute__ ((packed)); 5261da177e4SLinus Torvalds 527a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 528a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 5291da177e4SLinus Torvalds __u8 status; 530a9de9248SMarcel Holtmann __u8 commands[64]; 5311da177e4SLinus Torvalds } __attribute__ ((packed)); 5321da177e4SLinus Torvalds 533a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 534a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 535a9de9248SMarcel Holtmann __u8 status; 536a9de9248SMarcel Holtmann __u8 features[8]; 537a9de9248SMarcel Holtmann } __attribute__ ((packed)); 538a9de9248SMarcel Holtmann 539a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 540a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 541a9de9248SMarcel Holtmann __u8 status; 542a9de9248SMarcel Holtmann __u8 page; 543a9de9248SMarcel Holtmann __u8 max_page; 544a9de9248SMarcel Holtmann __u8 features[8]; 545a9de9248SMarcel Holtmann } __attribute__ ((packed)); 546a9de9248SMarcel Holtmann 547a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 548a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 549a9de9248SMarcel Holtmann __u8 status; 550a9de9248SMarcel Holtmann __le16 acl_mtu; 551a9de9248SMarcel Holtmann __u8 sco_mtu; 552a9de9248SMarcel Holtmann __le16 acl_max_pkt; 553a9de9248SMarcel Holtmann __le16 sco_max_pkt; 554a9de9248SMarcel Holtmann } __attribute__ ((packed)); 555a9de9248SMarcel Holtmann 556a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 557a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 558a9de9248SMarcel Holtmann __u8 status; 5591da177e4SLinus Torvalds bdaddr_t bdaddr; 5601da177e4SLinus Torvalds } __attribute__ ((packed)); 5611da177e4SLinus Torvalds 5621da177e4SLinus Torvalds /* ---- HCI Events ---- */ 5631da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 5641da177e4SLinus Torvalds 5651da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 5661da177e4SLinus Torvalds struct inquiry_info { 5671da177e4SLinus Torvalds bdaddr_t bdaddr; 5681da177e4SLinus Torvalds __u8 pscan_rep_mode; 5691da177e4SLinus Torvalds __u8 pscan_period_mode; 5701da177e4SLinus Torvalds __u8 pscan_mode; 5711da177e4SLinus Torvalds __u8 dev_class[3]; 5721ebb9252SMarcel Holtmann __le16 clock_offset; 5731da177e4SLinus Torvalds } __attribute__ ((packed)); 5741da177e4SLinus Torvalds 5751da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 5761da177e4SLinus Torvalds struct hci_ev_conn_complete { 5771da177e4SLinus Torvalds __u8 status; 5781ebb9252SMarcel Holtmann __le16 handle; 5791da177e4SLinus Torvalds bdaddr_t bdaddr; 5801da177e4SLinus Torvalds __u8 link_type; 5811da177e4SLinus Torvalds __u8 encr_mode; 5821da177e4SLinus Torvalds } __attribute__ ((packed)); 5831da177e4SLinus Torvalds 5841da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 5851da177e4SLinus Torvalds struct hci_ev_conn_request { 5861da177e4SLinus Torvalds bdaddr_t bdaddr; 5871da177e4SLinus Torvalds __u8 dev_class[3]; 5881da177e4SLinus Torvalds __u8 link_type; 5891da177e4SLinus Torvalds } __attribute__ ((packed)); 5901da177e4SLinus Torvalds 5911da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 5921da177e4SLinus Torvalds struct hci_ev_disconn_complete { 5931da177e4SLinus Torvalds __u8 status; 5941ebb9252SMarcel Holtmann __le16 handle; 5951da177e4SLinus Torvalds __u8 reason; 5961da177e4SLinus Torvalds } __attribute__ ((packed)); 5971da177e4SLinus Torvalds 5981da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 5991da177e4SLinus Torvalds struct hci_ev_auth_complete { 6001da177e4SLinus Torvalds __u8 status; 6011ebb9252SMarcel Holtmann __le16 handle; 6021da177e4SLinus Torvalds } __attribute__ ((packed)); 6031da177e4SLinus Torvalds 604a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 605a9de9248SMarcel Holtmann struct hci_ev_remote_name { 606a9de9248SMarcel Holtmann __u8 status; 607a9de9248SMarcel Holtmann bdaddr_t bdaddr; 608a9de9248SMarcel Holtmann __u8 name[248]; 609a9de9248SMarcel Holtmann } __attribute__ ((packed)); 610a9de9248SMarcel Holtmann 6111da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 6121da177e4SLinus Torvalds struct hci_ev_encrypt_change { 6131da177e4SLinus Torvalds __u8 status; 6141ebb9252SMarcel Holtmann __le16 handle; 6151da177e4SLinus Torvalds __u8 encrypt; 6161da177e4SLinus Torvalds } __attribute__ ((packed)); 6171da177e4SLinus Torvalds 618a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 619a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 6201da177e4SLinus Torvalds __u8 status; 6211ebb9252SMarcel Holtmann __le16 handle; 6221da177e4SLinus Torvalds } __attribute__ ((packed)); 6231da177e4SLinus Torvalds 624a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 625a9de9248SMarcel Holtmann struct hci_ev_remote_features { 626a9de9248SMarcel Holtmann __u8 status; 627a9de9248SMarcel Holtmann __le16 handle; 628a9de9248SMarcel Holtmann __u8 features[8]; 629a9de9248SMarcel Holtmann } __attribute__ ((packed)); 630a9de9248SMarcel Holtmann 631a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 632a9de9248SMarcel Holtmann struct hci_ev_remote_version { 633a9de9248SMarcel Holtmann __u8 status; 634a9de9248SMarcel Holtmann __le16 handle; 635a9de9248SMarcel Holtmann __u8 lmp_ver; 636a9de9248SMarcel Holtmann __le16 manufacturer; 637a9de9248SMarcel Holtmann __le16 lmp_subver; 638a9de9248SMarcel Holtmann } __attribute__ ((packed)); 639a9de9248SMarcel Holtmann 640a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 6411da177e4SLinus Torvalds struct hci_qos { 6421da177e4SLinus Torvalds __u8 service_type; 6431da177e4SLinus Torvalds __u32 token_rate; 6441da177e4SLinus Torvalds __u32 peak_bandwidth; 6451da177e4SLinus Torvalds __u32 latency; 6461da177e4SLinus Torvalds __u32 delay_variation; 6471da177e4SLinus Torvalds } __attribute__ ((packed)); 6481da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 6491da177e4SLinus Torvalds __u8 status; 6501ebb9252SMarcel Holtmann __le16 handle; 6511da177e4SLinus Torvalds struct hci_qos qos; 6521da177e4SLinus Torvalds } __attribute__ ((packed)); 6531da177e4SLinus Torvalds 654a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 6551da177e4SLinus Torvalds struct hci_ev_cmd_complete { 6561da177e4SLinus Torvalds __u8 ncmd; 6571ebb9252SMarcel Holtmann __le16 opcode; 6581da177e4SLinus Torvalds } __attribute__ ((packed)); 6591da177e4SLinus Torvalds 660a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 6611da177e4SLinus Torvalds struct hci_ev_cmd_status { 6621da177e4SLinus Torvalds __u8 status; 6631da177e4SLinus Torvalds __u8 ncmd; 6641ebb9252SMarcel Holtmann __le16 opcode; 6651da177e4SLinus Torvalds } __attribute__ ((packed)); 6661da177e4SLinus Torvalds 6671da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 6681da177e4SLinus Torvalds struct hci_ev_role_change { 6691da177e4SLinus Torvalds __u8 status; 6701da177e4SLinus Torvalds bdaddr_t bdaddr; 6711da177e4SLinus Torvalds __u8 role; 6721da177e4SLinus Torvalds } __attribute__ ((packed)); 6731da177e4SLinus Torvalds 674a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 675a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 676a9de9248SMarcel Holtmann __u8 num_hndl; 677a9de9248SMarcel Holtmann /* variable length part */ 678a9de9248SMarcel Holtmann } __attribute__ ((packed)); 679a9de9248SMarcel Holtmann 6801da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 6811da177e4SLinus Torvalds struct hci_ev_mode_change { 6821da177e4SLinus Torvalds __u8 status; 6831ebb9252SMarcel Holtmann __le16 handle; 6841da177e4SLinus Torvalds __u8 mode; 6851ebb9252SMarcel Holtmann __le16 interval; 6861da177e4SLinus Torvalds } __attribute__ ((packed)); 6871da177e4SLinus Torvalds 6881da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 6891da177e4SLinus Torvalds struct hci_ev_pin_code_req { 6901da177e4SLinus Torvalds bdaddr_t bdaddr; 6911da177e4SLinus Torvalds } __attribute__ ((packed)); 6921da177e4SLinus Torvalds 6931da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 6941da177e4SLinus Torvalds struct hci_ev_link_key_req { 6951da177e4SLinus Torvalds bdaddr_t bdaddr; 6961da177e4SLinus Torvalds } __attribute__ ((packed)); 6971da177e4SLinus Torvalds 6981da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 6991da177e4SLinus Torvalds struct hci_ev_link_key_notify { 7001da177e4SLinus Torvalds bdaddr_t bdaddr; 7011da177e4SLinus Torvalds __u8 link_key[16]; 7021da177e4SLinus Torvalds __u8 key_type; 7031da177e4SLinus Torvalds } __attribute__ ((packed)); 7041da177e4SLinus Torvalds 705a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 7061da177e4SLinus Torvalds struct hci_ev_clock_offset { 7071da177e4SLinus Torvalds __u8 status; 7081ebb9252SMarcel Holtmann __le16 handle; 7091ebb9252SMarcel Holtmann __le16 clock_offset; 7101da177e4SLinus Torvalds } __attribute__ ((packed)); 7111da177e4SLinus Torvalds 712a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE 0x1d 713a8746417SMarcel Holtmann struct hci_ev_pkt_type_change { 714a8746417SMarcel Holtmann __u8 status; 715a8746417SMarcel Holtmann __le16 handle; 716a8746417SMarcel Holtmann __le16 pkt_type; 717a8746417SMarcel Holtmann } __attribute__ ((packed)); 718a8746417SMarcel Holtmann 71985a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 72085a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 72185a1e930SMarcel Holtmann bdaddr_t bdaddr; 72285a1e930SMarcel Holtmann __u8 pscan_rep_mode; 72385a1e930SMarcel Holtmann } __attribute__ ((packed)); 72485a1e930SMarcel Holtmann 725a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 726a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 727a9de9248SMarcel Holtmann bdaddr_t bdaddr; 728a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 729a9de9248SMarcel Holtmann __u8 pscan_period_mode; 730a9de9248SMarcel Holtmann __u8 dev_class[3]; 731a9de9248SMarcel Holtmann __le16 clock_offset; 732a9de9248SMarcel Holtmann __s8 rssi; 733a9de9248SMarcel Holtmann } __attribute__ ((packed)); 734a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 735a9de9248SMarcel Holtmann bdaddr_t bdaddr; 736a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 737a9de9248SMarcel Holtmann __u8 pscan_period_mode; 738a9de9248SMarcel Holtmann __u8 pscan_mode; 739a9de9248SMarcel Holtmann __u8 dev_class[3]; 740a9de9248SMarcel Holtmann __le16 clock_offset; 741a9de9248SMarcel Holtmann __s8 rssi; 742a9de9248SMarcel Holtmann } __attribute__ ((packed)); 743a9de9248SMarcel Holtmann 744a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 745a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 746a9de9248SMarcel Holtmann __u8 status; 747a9de9248SMarcel Holtmann __le16 handle; 748a9de9248SMarcel Holtmann __u8 page; 749a9de9248SMarcel Holtmann __u8 max_page; 750a9de9248SMarcel Holtmann __u8 features[8]; 751a9de9248SMarcel Holtmann } __attribute__ ((packed)); 752a9de9248SMarcel Holtmann 753a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 754a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 755a9de9248SMarcel Holtmann __u8 status; 756a9de9248SMarcel Holtmann __le16 handle; 757a9de9248SMarcel Holtmann bdaddr_t bdaddr; 758a9de9248SMarcel Holtmann __u8 link_type; 759a9de9248SMarcel Holtmann __u8 tx_interval; 760a9de9248SMarcel Holtmann __u8 retrans_window; 761a9de9248SMarcel Holtmann __le16 rx_pkt_len; 762a9de9248SMarcel Holtmann __le16 tx_pkt_len; 763a9de9248SMarcel Holtmann __u8 air_mode; 764a9de9248SMarcel Holtmann } __attribute__ ((packed)); 765a9de9248SMarcel Holtmann 766a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 767a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 768a9de9248SMarcel Holtmann __u8 status; 769a9de9248SMarcel Holtmann __le16 handle; 770a9de9248SMarcel Holtmann __u8 tx_interval; 771a9de9248SMarcel Holtmann __u8 retrans_window; 772a9de9248SMarcel Holtmann __le16 rx_pkt_len; 773a9de9248SMarcel Holtmann __le16 tx_pkt_len; 774a9de9248SMarcel Holtmann } __attribute__ ((packed)); 775a9de9248SMarcel Holtmann 776a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 77704837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 77804837f64SMarcel Holtmann __u8 status; 77904837f64SMarcel Holtmann __le16 handle; 78004837f64SMarcel Holtmann __le16 max_tx_latency; 78104837f64SMarcel Holtmann __le16 max_rx_latency; 78204837f64SMarcel Holtmann __le16 max_remote_timeout; 78304837f64SMarcel Holtmann __le16 max_local_timeout; 78404837f64SMarcel Holtmann } __attribute__ ((packed)); 78504837f64SMarcel Holtmann 786a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 787a9de9248SMarcel Holtmann struct extended_inquiry_info { 788a9de9248SMarcel Holtmann bdaddr_t bdaddr; 789a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 790a9de9248SMarcel Holtmann __u8 pscan_period_mode; 791a9de9248SMarcel Holtmann __u8 dev_class[3]; 792a9de9248SMarcel Holtmann __le16 clock_offset; 793a9de9248SMarcel Holtmann __s8 rssi; 794a9de9248SMarcel Holtmann __u8 data[240]; 795a9de9248SMarcel Holtmann } __attribute__ ((packed)); 796a9de9248SMarcel Holtmann 7971da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 798a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 7991da177e4SLinus Torvalds struct hci_ev_stack_internal { 8001da177e4SLinus Torvalds __u16 type; 8011da177e4SLinus Torvalds __u8 data[0]; 8021da177e4SLinus Torvalds } __attribute__ ((packed)); 8031da177e4SLinus Torvalds 8041da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 8051da177e4SLinus Torvalds struct hci_ev_si_device { 8061da177e4SLinus Torvalds __u16 event; 8071da177e4SLinus Torvalds __u16 dev_id; 8081da177e4SLinus Torvalds } __attribute__ ((packed)); 8091da177e4SLinus Torvalds 8101da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 8111da177e4SLinus Torvalds struct hci_ev_si_security { 8121da177e4SLinus Torvalds __u16 event; 8131da177e4SLinus Torvalds __u16 proto; 8141da177e4SLinus Torvalds __u16 subproto; 8151da177e4SLinus Torvalds __u8 incoming; 8161da177e4SLinus Torvalds } __attribute__ ((packed)); 8171da177e4SLinus Torvalds 8181da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 8191da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 8201da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 8211da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 8221da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 8231da177e4SLinus Torvalds 8241da177e4SLinus Torvalds struct hci_command_hdr { 8251ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 8261da177e4SLinus Torvalds __u8 plen; 8271da177e4SLinus Torvalds } __attribute__ ((packed)); 8281da177e4SLinus Torvalds 8291da177e4SLinus Torvalds struct hci_event_hdr { 8301da177e4SLinus Torvalds __u8 evt; 8311da177e4SLinus Torvalds __u8 plen; 8321da177e4SLinus Torvalds } __attribute__ ((packed)); 8331da177e4SLinus Torvalds 8341da177e4SLinus Torvalds struct hci_acl_hdr { 8351ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 8361ebb9252SMarcel Holtmann __le16 dlen; 8371da177e4SLinus Torvalds } __attribute__ ((packed)); 8381da177e4SLinus Torvalds 8391da177e4SLinus Torvalds struct hci_sco_hdr { 8401ebb9252SMarcel Holtmann __le16 handle; 8411da177e4SLinus Torvalds __u8 dlen; 8421da177e4SLinus Torvalds } __attribute__ ((packed)); 8431da177e4SLinus Torvalds 8442a123b86SArnaldo Carvalho de Melo #ifdef __KERNEL__ 8452a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h> 8462a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 8472a123b86SArnaldo Carvalho de Melo { 8482a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 8492a123b86SArnaldo Carvalho de Melo } 8502a123b86SArnaldo Carvalho de Melo 8512a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 8522a123b86SArnaldo Carvalho de Melo { 8532a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 8542a123b86SArnaldo Carvalho de Melo } 8552a123b86SArnaldo Carvalho de Melo 8562a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 8572a123b86SArnaldo Carvalho de Melo { 8582a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 8592a123b86SArnaldo Carvalho de Melo } 8602a123b86SArnaldo Carvalho de Melo #endif 8612a123b86SArnaldo Carvalho de Melo 8621da177e4SLinus Torvalds /* Command opcode pack/unpack */ 8631da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 8641da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 8651da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 8661da177e4SLinus Torvalds 8671da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 8681da177e4SLinus Torvalds #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) 8691da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 8701da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 8711da177e4SLinus Torvalds 8721da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 8731da177e4SLinus Torvalds 8741da177e4SLinus Torvalds /* Socket options */ 8751da177e4SLinus Torvalds #define HCI_DATA_DIR 1 8761da177e4SLinus Torvalds #define HCI_FILTER 2 8771da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 8781da177e4SLinus Torvalds 8791da177e4SLinus Torvalds /* CMSG flags */ 8801da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 8811da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 8821da177e4SLinus Torvalds 8831da177e4SLinus Torvalds struct sockaddr_hci { 8841da177e4SLinus Torvalds sa_family_t hci_family; 8851da177e4SLinus Torvalds unsigned short hci_dev; 8861da177e4SLinus Torvalds }; 8871da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 8881da177e4SLinus Torvalds 8891da177e4SLinus Torvalds struct hci_filter { 8901da177e4SLinus Torvalds unsigned long type_mask; 8911da177e4SLinus Torvalds unsigned long event_mask[2]; 892905f3ed6SAl Viro __le16 opcode; 8931da177e4SLinus Torvalds }; 8941da177e4SLinus Torvalds 8951da177e4SLinus Torvalds struct hci_ufilter { 8961da177e4SLinus Torvalds __u32 type_mask; 8971da177e4SLinus Torvalds __u32 event_mask[2]; 898905f3ed6SAl Viro __le16 opcode; 8991da177e4SLinus Torvalds }; 9001da177e4SLinus Torvalds 9011da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 9021da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 9031da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 9041da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 9051da177e4SLinus Torvalds 9061da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 9071da177e4SLinus Torvalds struct hci_dev_stats { 9081da177e4SLinus Torvalds __u32 err_rx; 9091da177e4SLinus Torvalds __u32 err_tx; 9101da177e4SLinus Torvalds __u32 cmd_tx; 9111da177e4SLinus Torvalds __u32 evt_rx; 9121da177e4SLinus Torvalds __u32 acl_tx; 9131da177e4SLinus Torvalds __u32 acl_rx; 9141da177e4SLinus Torvalds __u32 sco_tx; 9151da177e4SLinus Torvalds __u32 sco_rx; 9161da177e4SLinus Torvalds __u32 byte_rx; 9171da177e4SLinus Torvalds __u32 byte_tx; 9181da177e4SLinus Torvalds }; 9191da177e4SLinus Torvalds 9201da177e4SLinus Torvalds struct hci_dev_info { 9211da177e4SLinus Torvalds __u16 dev_id; 9221da177e4SLinus Torvalds char name[8]; 9231da177e4SLinus Torvalds 9241da177e4SLinus Torvalds bdaddr_t bdaddr; 9251da177e4SLinus Torvalds 9261da177e4SLinus Torvalds __u32 flags; 9271da177e4SLinus Torvalds __u8 type; 9281da177e4SLinus Torvalds 9291da177e4SLinus Torvalds __u8 features[8]; 9301da177e4SLinus Torvalds 9311da177e4SLinus Torvalds __u32 pkt_type; 9321da177e4SLinus Torvalds __u32 link_policy; 9331da177e4SLinus Torvalds __u32 link_mode; 9341da177e4SLinus Torvalds 9351da177e4SLinus Torvalds __u16 acl_mtu; 9361da177e4SLinus Torvalds __u16 acl_pkts; 9371da177e4SLinus Torvalds __u16 sco_mtu; 9381da177e4SLinus Torvalds __u16 sco_pkts; 9391da177e4SLinus Torvalds 9401da177e4SLinus Torvalds struct hci_dev_stats stat; 9411da177e4SLinus Torvalds }; 9421da177e4SLinus Torvalds 9431da177e4SLinus Torvalds struct hci_conn_info { 9441da177e4SLinus Torvalds __u16 handle; 9451da177e4SLinus Torvalds bdaddr_t bdaddr; 9461da177e4SLinus Torvalds __u8 type; 9471da177e4SLinus Torvalds __u8 out; 9481da177e4SLinus Torvalds __u16 state; 9491da177e4SLinus Torvalds __u32 link_mode; 9501da177e4SLinus Torvalds }; 9511da177e4SLinus Torvalds 9521da177e4SLinus Torvalds struct hci_dev_req { 9531da177e4SLinus Torvalds __u16 dev_id; 9541da177e4SLinus Torvalds __u32 dev_opt; 9551da177e4SLinus Torvalds }; 9561da177e4SLinus Torvalds 9571da177e4SLinus Torvalds struct hci_dev_list_req { 9581da177e4SLinus Torvalds __u16 dev_num; 9591da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 9601da177e4SLinus Torvalds }; 9611da177e4SLinus Torvalds 9621da177e4SLinus Torvalds struct hci_conn_list_req { 9631da177e4SLinus Torvalds __u16 dev_id; 9641da177e4SLinus Torvalds __u16 conn_num; 9651da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 9661da177e4SLinus Torvalds }; 9671da177e4SLinus Torvalds 9681da177e4SLinus Torvalds struct hci_conn_info_req { 9691da177e4SLinus Torvalds bdaddr_t bdaddr; 9701da177e4SLinus Torvalds __u8 type; 9711da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 9721da177e4SLinus Torvalds }; 9731da177e4SLinus Torvalds 9741da177e4SLinus Torvalds struct hci_inquiry_req { 9751da177e4SLinus Torvalds __u16 dev_id; 9761da177e4SLinus Torvalds __u16 flags; 9771da177e4SLinus Torvalds __u8 lap[3]; 9781da177e4SLinus Torvalds __u8 length; 9791da177e4SLinus Torvalds __u8 num_rsp; 9801da177e4SLinus Torvalds }; 9811da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 9821da177e4SLinus Torvalds 9831da177e4SLinus Torvalds #endif /* __HCI_H */ 984