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 46c13854ceSMarcel Holtmann /* HCI bus 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 55943da25dSMarcel Holtmann /* HCI controller types */ 56943da25dSMarcel Holtmann #define HCI_BREDR 0x00 57*8f1e1742SDavid Vrabel #define HCI_AMP 0x01 58943da25dSMarcel Holtmann 591da177e4SLinus Torvalds /* HCI device quirks */ 601da177e4SLinus Torvalds enum { 617a9d4020SMarcel Holtmann HCI_QUIRK_NO_RESET, 62da1f5198SMarcel Holtmann HCI_QUIRK_RAW_DEVICE, 63da1f5198SMarcel Holtmann HCI_QUIRK_FIXUP_BUFFER_SIZE 641da177e4SLinus Torvalds }; 651da177e4SLinus Torvalds 661da177e4SLinus Torvalds /* HCI device flags */ 671da177e4SLinus Torvalds enum { 681da177e4SLinus Torvalds HCI_UP, 691da177e4SLinus Torvalds HCI_INIT, 701da177e4SLinus Torvalds HCI_RUNNING, 711da177e4SLinus Torvalds 721da177e4SLinus Torvalds HCI_PSCAN, 731da177e4SLinus Torvalds HCI_ISCAN, 741da177e4SLinus Torvalds HCI_AUTH, 751da177e4SLinus Torvalds HCI_ENCRYPT, 761da177e4SLinus Torvalds HCI_INQUIRY, 771da177e4SLinus Torvalds 781da177e4SLinus Torvalds HCI_RAW, 791da177e4SLinus Torvalds }; 801da177e4SLinus Torvalds 811da177e4SLinus Torvalds /* HCI ioctl defines */ 821da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 831da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 841da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 851da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 861da177e4SLinus Torvalds 871da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 881da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 891da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 901da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 9140be492fSMarcel Holtmann #define HCIGETAUTHINFO _IOR('H', 215, int) 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 941da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 951da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 961da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 971da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 981da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 991da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 1001da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 1011da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 1021da177e4SLinus Torvalds 103f0358568SJohan Hedberg #define HCIBLOCKADDR _IOW('H', 230, int) 104f0358568SJohan Hedberg #define HCIUNBLOCKADDR _IOW('H', 231, int) 105f0358568SJohan Hedberg 1061da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1071da177e4SLinus Torvalds 1081da177e4SLinus Torvalds /* HCI timeouts */ 10904837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 11004837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 111052b30b0SMarcel Holtmann #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 11204837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 11304837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 1141da177e4SLinus Torvalds 1155b7f9909SMarcel Holtmann /* HCI data types */ 1161da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1171da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1181da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1191da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1201da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1211da177e4SLinus Torvalds 1225b7f9909SMarcel Holtmann /* HCI packet types */ 1231da177e4SLinus Torvalds #define HCI_DM1 0x0008 1241da177e4SLinus Torvalds #define HCI_DM3 0x0400 1251da177e4SLinus Torvalds #define HCI_DM5 0x4000 1261da177e4SLinus Torvalds #define HCI_DH1 0x0010 1271da177e4SLinus Torvalds #define HCI_DH3 0x0800 1281da177e4SLinus Torvalds #define HCI_DH5 0x8000 1291da177e4SLinus Torvalds 1301da177e4SLinus Torvalds #define HCI_HV1 0x0020 1311da177e4SLinus Torvalds #define HCI_HV2 0x0040 1321da177e4SLinus Torvalds #define HCI_HV3 0x0080 1331da177e4SLinus Torvalds 1341da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1351da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1361da177e4SLinus Torvalds 1375b7f9909SMarcel Holtmann /* eSCO packet types */ 1385b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1395b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1405b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1415b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1425b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1435b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 144efc7688bSMarcel Holtmann #define ESCO_2EV3 0x0040 145efc7688bSMarcel Holtmann #define ESCO_3EV3 0x0080 146efc7688bSMarcel Holtmann #define ESCO_2EV5 0x0100 147efc7688bSMarcel Holtmann #define ESCO_3EV5 0x0200 1485b7f9909SMarcel Holtmann 149a8746417SMarcel Holtmann #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 150efc7688bSMarcel Holtmann #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 151a8746417SMarcel Holtmann 1521da177e4SLinus Torvalds /* ACL flags */ 1531da177e4SLinus Torvalds #define ACL_CONT 0x01 1541da177e4SLinus Torvalds #define ACL_START 0x02 1551da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 1561da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 1571da177e4SLinus Torvalds 1581da177e4SLinus Torvalds /* Baseband links */ 1591da177e4SLinus Torvalds #define SCO_LINK 0x00 1601da177e4SLinus Torvalds #define ACL_LINK 0x01 1615b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 1621da177e4SLinus Torvalds 1631da177e4SLinus Torvalds /* LMP features */ 1641da177e4SLinus Torvalds #define LMP_3SLOT 0x01 1651da177e4SLinus Torvalds #define LMP_5SLOT 0x02 1661da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 1671da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 1681da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 1691da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 1701da177e4SLinus Torvalds #define LMP_HOLD 0x40 17104837f64SMarcel Holtmann #define LMP_SNIFF 0x80 1721da177e4SLinus Torvalds 1731da177e4SLinus Torvalds #define LMP_PARK 0x01 1741da177e4SLinus Torvalds #define LMP_RSSI 0x02 1751da177e4SLinus Torvalds #define LMP_QUALITY 0x04 1761da177e4SLinus Torvalds #define LMP_SCO 0x08 1771da177e4SLinus Torvalds #define LMP_HV2 0x10 1781da177e4SLinus Torvalds #define LMP_HV3 0x20 1791da177e4SLinus Torvalds #define LMP_ULAW 0x40 1801da177e4SLinus Torvalds #define LMP_ALAW 0x80 1811da177e4SLinus Torvalds 1821da177e4SLinus Torvalds #define LMP_CVSD 0x01 1831da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 1841da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 1851da177e4SLinus Torvalds 1865b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 1875b7f9909SMarcel Holtmann 1885b7f9909SMarcel Holtmann #define LMP_EV4 0x01 1895b7f9909SMarcel Holtmann #define LMP_EV5 0x02 1905b7f9909SMarcel Holtmann 19104837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 192efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M 0x20 193efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M 0x40 194efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO 0x80 19504837f64SMarcel Holtmann 196769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR 0x08 197769be974SMarcel Holtmann 19804837f64SMarcel Holtmann /* Connection modes */ 19904837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 20004837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 20104837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 20204837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 20304837f64SMarcel Holtmann 2041da177e4SLinus Torvalds /* Link policies */ 2051da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 2061da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 2071da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 2081da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 2091da177e4SLinus Torvalds 21004837f64SMarcel Holtmann /* Link modes */ 2111da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 2121da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 2131da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 2141da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 2151da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 2161da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2171da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2181da177e4SLinus Torvalds 21940be492fSMarcel Holtmann /* Authentication types */ 22040be492fSMarcel Holtmann #define HCI_AT_NO_BONDING 0x00 22140be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM 0x01 22240be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING 0x02 22340be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM 0x03 22440be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING 0x04 22540be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM 0x05 22640be492fSMarcel Holtmann 2271da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 228a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 229a9de9248SMarcel Holtmann struct hci_cp_inquiry { 230a9de9248SMarcel Holtmann __u8 lap[3]; 231a9de9248SMarcel Holtmann __u8 length; 232a9de9248SMarcel Holtmann __u8 num_rsp; 23366c853ccSGustavo F. Padovan } __packed; 2341da177e4SLinus Torvalds 235a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 236a9de9248SMarcel Holtmann 237a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 238a9de9248SMarcel Holtmann 239a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 240a9de9248SMarcel Holtmann struct hci_cp_create_conn { 241a9de9248SMarcel Holtmann bdaddr_t bdaddr; 242a9de9248SMarcel Holtmann __le16 pkt_type; 243a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 244a9de9248SMarcel Holtmann __u8 pscan_mode; 245a9de9248SMarcel Holtmann __le16 clock_offset; 246a9de9248SMarcel Holtmann __u8 role_switch; 24766c853ccSGustavo F. Padovan } __packed; 2481da177e4SLinus Torvalds 249a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 250a9de9248SMarcel Holtmann struct hci_cp_disconnect { 251a9de9248SMarcel Holtmann __le16 handle; 252a9de9248SMarcel Holtmann __u8 reason; 25366c853ccSGustavo F. Padovan } __packed; 2541da177e4SLinus Torvalds 255a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 256a9de9248SMarcel Holtmann struct hci_cp_add_sco { 257a9de9248SMarcel Holtmann __le16 handle; 258a9de9248SMarcel Holtmann __le16 pkt_type; 25966c853ccSGustavo F. Padovan } __packed; 260a9de9248SMarcel Holtmann 261a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 262a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 2631da177e4SLinus Torvalds bdaddr_t bdaddr; 26466c853ccSGustavo F. Padovan } __packed; 2651da177e4SLinus Torvalds 266a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 267a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 268a9de9248SMarcel Holtmann bdaddr_t bdaddr; 269a9de9248SMarcel Holtmann __u8 role; 27066c853ccSGustavo F. Padovan } __packed; 2711da177e4SLinus Torvalds 272a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 273a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 274a9de9248SMarcel Holtmann bdaddr_t bdaddr; 275a9de9248SMarcel Holtmann __u8 reason; 27666c853ccSGustavo F. Padovan } __packed; 2771da177e4SLinus Torvalds 278a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 279a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 280a9de9248SMarcel Holtmann bdaddr_t bdaddr; 281a9de9248SMarcel Holtmann __u8 link_key[16]; 28266c853ccSGustavo F. Padovan } __packed; 2831da177e4SLinus Torvalds 284a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 285a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 286a9de9248SMarcel Holtmann bdaddr_t bdaddr; 28766c853ccSGustavo F. Padovan } __packed; 2881da177e4SLinus Torvalds 289a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 290a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 291a9de9248SMarcel Holtmann bdaddr_t bdaddr; 292a9de9248SMarcel Holtmann __u8 pin_len; 293a9de9248SMarcel Holtmann __u8 pin_code[16]; 29466c853ccSGustavo F. Padovan } __packed; 295a9de9248SMarcel Holtmann 296a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 297a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 298a9de9248SMarcel Holtmann bdaddr_t bdaddr; 29966c853ccSGustavo F. Padovan } __packed; 300a9de9248SMarcel Holtmann 301a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 302a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 303a9de9248SMarcel Holtmann __le16 handle; 304a9de9248SMarcel Holtmann __le16 pkt_type; 30566c853ccSGustavo F. Padovan } __packed; 306a9de9248SMarcel Holtmann 307a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 308a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 309a9de9248SMarcel Holtmann __le16 handle; 31066c853ccSGustavo F. Padovan } __packed; 311a9de9248SMarcel Holtmann 312a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 313a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 314a9de9248SMarcel Holtmann __le16 handle; 315a9de9248SMarcel Holtmann __u8 encrypt; 31666c853ccSGustavo F. Padovan } __packed; 317a9de9248SMarcel Holtmann 318a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 319a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 320a9de9248SMarcel Holtmann __le16 handle; 32166c853ccSGustavo F. Padovan } __packed; 322a9de9248SMarcel Holtmann 323a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 324a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 325a9de9248SMarcel Holtmann bdaddr_t bdaddr; 326a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 327a9de9248SMarcel Holtmann __u8 pscan_mode; 328a9de9248SMarcel Holtmann __le16 clock_offset; 32966c853ccSGustavo F. Padovan } __packed; 330a9de9248SMarcel Holtmann 331a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 332a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 333a9de9248SMarcel Holtmann bdaddr_t bdaddr; 33466c853ccSGustavo F. Padovan } __packed; 335a9de9248SMarcel Holtmann 336a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 337a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 338a9de9248SMarcel Holtmann __le16 handle; 33966c853ccSGustavo F. Padovan } __packed; 340a9de9248SMarcel Holtmann 341a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 342a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 343a9de9248SMarcel Holtmann __le16 handle; 344a9de9248SMarcel Holtmann __u8 page; 34566c853ccSGustavo F. Padovan } __packed; 346a9de9248SMarcel Holtmann 347a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 348a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 349a9de9248SMarcel Holtmann __le16 handle; 35066c853ccSGustavo F. Padovan } __packed; 351a9de9248SMarcel Holtmann 352a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 353a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 354a9de9248SMarcel Holtmann __le16 handle; 355a9de9248SMarcel Holtmann __le32 tx_bandwidth; 356a9de9248SMarcel Holtmann __le32 rx_bandwidth; 357a9de9248SMarcel Holtmann __le16 max_latency; 358a9de9248SMarcel Holtmann __le16 voice_setting; 359a9de9248SMarcel Holtmann __u8 retrans_effort; 360a9de9248SMarcel Holtmann __le16 pkt_type; 36166c853ccSGustavo F. Padovan } __packed; 362a9de9248SMarcel Holtmann 363a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 364a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 365a9de9248SMarcel Holtmann bdaddr_t bdaddr; 366a9de9248SMarcel Holtmann __le32 tx_bandwidth; 367a9de9248SMarcel Holtmann __le32 rx_bandwidth; 368a9de9248SMarcel Holtmann __le16 max_latency; 369a9de9248SMarcel Holtmann __le16 content_format; 370a9de9248SMarcel Holtmann __u8 retrans_effort; 371a9de9248SMarcel Holtmann __le16 pkt_type; 37266c853ccSGustavo F. Padovan } __packed; 373a9de9248SMarcel Holtmann 374a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 375a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 376a9de9248SMarcel Holtmann bdaddr_t bdaddr; 377a9de9248SMarcel Holtmann __u8 reason; 37866c853ccSGustavo F. Padovan } __packed; 379a9de9248SMarcel Holtmann 380a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 381a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 382a9de9248SMarcel Holtmann __le16 handle; 383a9de9248SMarcel Holtmann __le16 max_interval; 384a9de9248SMarcel Holtmann __le16 min_interval; 385a9de9248SMarcel Holtmann __le16 attempt; 386a9de9248SMarcel Holtmann __le16 timeout; 38766c853ccSGustavo F. Padovan } __packed; 388a9de9248SMarcel Holtmann 389a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 390a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 391a9de9248SMarcel Holtmann __le16 handle; 39266c853ccSGustavo F. Padovan } __packed; 393a9de9248SMarcel Holtmann 394a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 395a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 396a9de9248SMarcel Holtmann __le16 handle; 39766c853ccSGustavo F. Padovan } __packed; 398a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 399a9de9248SMarcel Holtmann __u8 status; 400a9de9248SMarcel Holtmann __le16 handle; 401a9de9248SMarcel Holtmann __u8 role; 40266c853ccSGustavo F. Padovan } __packed; 403a9de9248SMarcel Holtmann 404a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 405a9de9248SMarcel Holtmann struct hci_cp_switch_role { 406a9de9248SMarcel Holtmann bdaddr_t bdaddr; 407a9de9248SMarcel Holtmann __u8 role; 40866c853ccSGustavo F. Padovan } __packed; 409a9de9248SMarcel Holtmann 410a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 411a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 412a9de9248SMarcel Holtmann __le16 handle; 41366c853ccSGustavo F. Padovan } __packed; 414a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 415a9de9248SMarcel Holtmann __u8 status; 416a9de9248SMarcel Holtmann __le16 handle; 417a9de9248SMarcel Holtmann __le16 policy; 41866c853ccSGustavo F. Padovan } __packed; 419a9de9248SMarcel Holtmann 420a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 421a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 422a9de9248SMarcel Holtmann __le16 handle; 423a9de9248SMarcel Holtmann __le16 policy; 42466c853ccSGustavo F. Padovan } __packed; 425a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 426a9de9248SMarcel Holtmann __u8 status; 427a9de9248SMarcel Holtmann __le16 handle; 42866c853ccSGustavo F. Padovan } __packed; 429a9de9248SMarcel Holtmann 430e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 431e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy { 432e4e8e37cSMarcel Holtmann __u8 status; 433e4e8e37cSMarcel Holtmann __le16 policy; 43466c853ccSGustavo F. Padovan } __packed; 435e4e8e37cSMarcel Holtmann 436e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 437e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy { 438e4e8e37cSMarcel Holtmann __le16 policy; 43966c853ccSGustavo F. Padovan } __packed; 440e4e8e37cSMarcel Holtmann 441a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 442a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 443a9de9248SMarcel Holtmann __le16 handle; 444a9de9248SMarcel Holtmann __le16 max_latency; 445a9de9248SMarcel Holtmann __le16 min_remote_timeout; 446a9de9248SMarcel Holtmann __le16 min_local_timeout; 44766c853ccSGustavo F. Padovan } __packed; 448a9de9248SMarcel Holtmann 449a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 450a9de9248SMarcel Holtmann struct hci_cp_set_event_mask { 451a9de9248SMarcel Holtmann __u8 mask[8]; 45266c853ccSGustavo F. Padovan } __packed; 453a9de9248SMarcel Holtmann 454a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 455a9de9248SMarcel Holtmann 456a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 4571da177e4SLinus Torvalds struct hci_cp_set_event_flt { 4581da177e4SLinus Torvalds __u8 flt_type; 4591da177e4SLinus Torvalds __u8 cond_type; 4601da177e4SLinus Torvalds __u8 condition[0]; 46166c853ccSGustavo F. Padovan } __packed; 4621da177e4SLinus Torvalds 4631da177e4SLinus Torvalds /* Filter types */ 4641da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 4651da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 4661da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 4671da177e4SLinus Torvalds 4681da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 4691da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 4701da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 4711da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 4721da177e4SLinus Torvalds 4731da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 4741da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 4751da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 4761da177e4SLinus Torvalds 477a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 478a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 479a9de9248SMarcel Holtmann __u8 name[248]; 48066c853ccSGustavo F. Padovan } __packed; 481a9de9248SMarcel Holtmann 482a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 483a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 484a9de9248SMarcel Holtmann __u8 status; 485a9de9248SMarcel Holtmann __u8 name[248]; 48666c853ccSGustavo F. Padovan } __packed; 487a9de9248SMarcel Holtmann 488a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 489a9de9248SMarcel Holtmann 490a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 491a9de9248SMarcel Holtmann 492a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 493a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 494a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 495a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 496a9de9248SMarcel Holtmann 497a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 498a9de9248SMarcel Holtmann 499a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 500a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 501a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 502a9de9248SMarcel Holtmann 503a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 504a9de9248SMarcel Holtmann 505a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 506a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 507a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 508a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 509a9de9248SMarcel Holtmann 510a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 511a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 5121da177e4SLinus Torvalds __u8 status; 5131da177e4SLinus Torvalds __u8 dev_class[3]; 51466c853ccSGustavo F. Padovan } __packed; 5151da177e4SLinus Torvalds 516a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 517a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 5181da177e4SLinus Torvalds __u8 dev_class[3]; 51966c853ccSGustavo F. Padovan } __packed; 5201da177e4SLinus Torvalds 521a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 5221da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 5231da177e4SLinus Torvalds __u8 status; 5241ebb9252SMarcel Holtmann __le16 voice_setting; 52566c853ccSGustavo F. Padovan } __packed; 5261da177e4SLinus Torvalds 527a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 5281da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 5291ebb9252SMarcel Holtmann __le16 voice_setting; 53066c853ccSGustavo F. Padovan } __packed; 5311da177e4SLinus Torvalds 532a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 5331da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 5341ebb9252SMarcel Holtmann __le16 acl_mtu; 5351da177e4SLinus Torvalds __u8 sco_mtu; 5361ebb9252SMarcel Holtmann __le16 acl_max_pkt; 5371ebb9252SMarcel Holtmann __le16 sco_max_pkt; 53866c853ccSGustavo F. Padovan } __packed; 5391da177e4SLinus Torvalds 540333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE 0x0c55 541333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode { 542333140b5SMarcel Holtmann __u8 status; 543333140b5SMarcel Holtmann __u8 mode; 54466c853ccSGustavo F. Padovan } __packed; 545333140b5SMarcel Holtmann 546333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE 0x0c56 547333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode { 548333140b5SMarcel Holtmann __u8 mode; 54966c853ccSGustavo F. Padovan } __packed; 550333140b5SMarcel Holtmann 551a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 552a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 5531da177e4SLinus Torvalds __u8 status; 554a9de9248SMarcel Holtmann __u8 hci_ver; 555a9de9248SMarcel Holtmann __le16 hci_rev; 556a9de9248SMarcel Holtmann __u8 lmp_ver; 557a9de9248SMarcel Holtmann __le16 manufacturer; 558a9de9248SMarcel Holtmann __le16 lmp_subver; 55966c853ccSGustavo F. Padovan } __packed; 5601da177e4SLinus Torvalds 561a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 562a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 5631da177e4SLinus Torvalds __u8 status; 564a9de9248SMarcel Holtmann __u8 commands[64]; 56566c853ccSGustavo F. Padovan } __packed; 5661da177e4SLinus Torvalds 567a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 568a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 569a9de9248SMarcel Holtmann __u8 status; 570a9de9248SMarcel Holtmann __u8 features[8]; 57166c853ccSGustavo F. Padovan } __packed; 572a9de9248SMarcel Holtmann 573a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 574a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 575a9de9248SMarcel Holtmann __u8 status; 576a9de9248SMarcel Holtmann __u8 page; 577a9de9248SMarcel Holtmann __u8 max_page; 578a9de9248SMarcel Holtmann __u8 features[8]; 57966c853ccSGustavo F. Padovan } __packed; 580a9de9248SMarcel Holtmann 581a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 582a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 583a9de9248SMarcel Holtmann __u8 status; 584a9de9248SMarcel Holtmann __le16 acl_mtu; 585a9de9248SMarcel Holtmann __u8 sco_mtu; 586a9de9248SMarcel Holtmann __le16 acl_max_pkt; 587a9de9248SMarcel Holtmann __le16 sco_max_pkt; 58866c853ccSGustavo F. Padovan } __packed; 589a9de9248SMarcel Holtmann 590a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 591a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 592a9de9248SMarcel Holtmann __u8 status; 5931da177e4SLinus Torvalds bdaddr_t bdaddr; 59466c853ccSGustavo F. Padovan } __packed; 5951da177e4SLinus Torvalds 5961da177e4SLinus Torvalds /* ---- HCI Events ---- */ 5971da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 5981da177e4SLinus Torvalds 5991da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 6001da177e4SLinus Torvalds struct inquiry_info { 6011da177e4SLinus Torvalds bdaddr_t bdaddr; 6021da177e4SLinus Torvalds __u8 pscan_rep_mode; 6031da177e4SLinus Torvalds __u8 pscan_period_mode; 6041da177e4SLinus Torvalds __u8 pscan_mode; 6051da177e4SLinus Torvalds __u8 dev_class[3]; 6061ebb9252SMarcel Holtmann __le16 clock_offset; 60766c853ccSGustavo F. Padovan } __packed; 6081da177e4SLinus Torvalds 6091da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 6101da177e4SLinus Torvalds struct hci_ev_conn_complete { 6111da177e4SLinus Torvalds __u8 status; 6121ebb9252SMarcel Holtmann __le16 handle; 6131da177e4SLinus Torvalds bdaddr_t bdaddr; 6141da177e4SLinus Torvalds __u8 link_type; 6151da177e4SLinus Torvalds __u8 encr_mode; 61666c853ccSGustavo F. Padovan } __packed; 6171da177e4SLinus Torvalds 6181da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 6191da177e4SLinus Torvalds struct hci_ev_conn_request { 6201da177e4SLinus Torvalds bdaddr_t bdaddr; 6211da177e4SLinus Torvalds __u8 dev_class[3]; 6221da177e4SLinus Torvalds __u8 link_type; 62366c853ccSGustavo F. Padovan } __packed; 6241da177e4SLinus Torvalds 6251da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 6261da177e4SLinus Torvalds struct hci_ev_disconn_complete { 6271da177e4SLinus Torvalds __u8 status; 6281ebb9252SMarcel Holtmann __le16 handle; 6291da177e4SLinus Torvalds __u8 reason; 63066c853ccSGustavo F. Padovan } __packed; 6311da177e4SLinus Torvalds 6321da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 6331da177e4SLinus Torvalds struct hci_ev_auth_complete { 6341da177e4SLinus Torvalds __u8 status; 6351ebb9252SMarcel Holtmann __le16 handle; 63666c853ccSGustavo F. Padovan } __packed; 6371da177e4SLinus Torvalds 638a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 639a9de9248SMarcel Holtmann struct hci_ev_remote_name { 640a9de9248SMarcel Holtmann __u8 status; 641a9de9248SMarcel Holtmann bdaddr_t bdaddr; 642a9de9248SMarcel Holtmann __u8 name[248]; 64366c853ccSGustavo F. Padovan } __packed; 644a9de9248SMarcel Holtmann 6451da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 6461da177e4SLinus Torvalds struct hci_ev_encrypt_change { 6471da177e4SLinus Torvalds __u8 status; 6481ebb9252SMarcel Holtmann __le16 handle; 6491da177e4SLinus Torvalds __u8 encrypt; 65066c853ccSGustavo F. Padovan } __packed; 6511da177e4SLinus Torvalds 652a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 653a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 6541da177e4SLinus Torvalds __u8 status; 6551ebb9252SMarcel Holtmann __le16 handle; 65666c853ccSGustavo F. Padovan } __packed; 6571da177e4SLinus Torvalds 658a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 659a9de9248SMarcel Holtmann struct hci_ev_remote_features { 660a9de9248SMarcel Holtmann __u8 status; 661a9de9248SMarcel Holtmann __le16 handle; 662a9de9248SMarcel Holtmann __u8 features[8]; 66366c853ccSGustavo F. Padovan } __packed; 664a9de9248SMarcel Holtmann 665a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 666a9de9248SMarcel Holtmann struct hci_ev_remote_version { 667a9de9248SMarcel Holtmann __u8 status; 668a9de9248SMarcel Holtmann __le16 handle; 669a9de9248SMarcel Holtmann __u8 lmp_ver; 670a9de9248SMarcel Holtmann __le16 manufacturer; 671a9de9248SMarcel Holtmann __le16 lmp_subver; 67266c853ccSGustavo F. Padovan } __packed; 673a9de9248SMarcel Holtmann 674a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 6751da177e4SLinus Torvalds struct hci_qos { 6761da177e4SLinus Torvalds __u8 service_type; 6771da177e4SLinus Torvalds __u32 token_rate; 6781da177e4SLinus Torvalds __u32 peak_bandwidth; 6791da177e4SLinus Torvalds __u32 latency; 6801da177e4SLinus Torvalds __u32 delay_variation; 68166c853ccSGustavo F. Padovan } __packed; 6821da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 6831da177e4SLinus Torvalds __u8 status; 6841ebb9252SMarcel Holtmann __le16 handle; 6851da177e4SLinus Torvalds struct hci_qos qos; 68666c853ccSGustavo F. Padovan } __packed; 6871da177e4SLinus Torvalds 688a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 6891da177e4SLinus Torvalds struct hci_ev_cmd_complete { 6901da177e4SLinus Torvalds __u8 ncmd; 6911ebb9252SMarcel Holtmann __le16 opcode; 69266c853ccSGustavo F. Padovan } __packed; 6931da177e4SLinus Torvalds 694a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 6951da177e4SLinus Torvalds struct hci_ev_cmd_status { 6961da177e4SLinus Torvalds __u8 status; 6971da177e4SLinus Torvalds __u8 ncmd; 6981ebb9252SMarcel Holtmann __le16 opcode; 69966c853ccSGustavo F. Padovan } __packed; 7001da177e4SLinus Torvalds 7011da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 7021da177e4SLinus Torvalds struct hci_ev_role_change { 7031da177e4SLinus Torvalds __u8 status; 7041da177e4SLinus Torvalds bdaddr_t bdaddr; 7051da177e4SLinus Torvalds __u8 role; 70666c853ccSGustavo F. Padovan } __packed; 7071da177e4SLinus Torvalds 708a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 709a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 710a9de9248SMarcel Holtmann __u8 num_hndl; 711a9de9248SMarcel Holtmann /* variable length part */ 71266c853ccSGustavo F. Padovan } __packed; 713a9de9248SMarcel Holtmann 7141da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 7151da177e4SLinus Torvalds struct hci_ev_mode_change { 7161da177e4SLinus Torvalds __u8 status; 7171ebb9252SMarcel Holtmann __le16 handle; 7181da177e4SLinus Torvalds __u8 mode; 7191ebb9252SMarcel Holtmann __le16 interval; 72066c853ccSGustavo F. Padovan } __packed; 7211da177e4SLinus Torvalds 7221da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 7231da177e4SLinus Torvalds struct hci_ev_pin_code_req { 7241da177e4SLinus Torvalds bdaddr_t bdaddr; 72566c853ccSGustavo F. Padovan } __packed; 7261da177e4SLinus Torvalds 7271da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 7281da177e4SLinus Torvalds struct hci_ev_link_key_req { 7291da177e4SLinus Torvalds bdaddr_t bdaddr; 73066c853ccSGustavo F. Padovan } __packed; 7311da177e4SLinus Torvalds 7321da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 7331da177e4SLinus Torvalds struct hci_ev_link_key_notify { 7341da177e4SLinus Torvalds bdaddr_t bdaddr; 7351da177e4SLinus Torvalds __u8 link_key[16]; 7361da177e4SLinus Torvalds __u8 key_type; 73766c853ccSGustavo F. Padovan } __packed; 7381da177e4SLinus Torvalds 739a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 7401da177e4SLinus Torvalds struct hci_ev_clock_offset { 7411da177e4SLinus Torvalds __u8 status; 7421ebb9252SMarcel Holtmann __le16 handle; 7431ebb9252SMarcel Holtmann __le16 clock_offset; 74466c853ccSGustavo F. Padovan } __packed; 7451da177e4SLinus Torvalds 746a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE 0x1d 747a8746417SMarcel Holtmann struct hci_ev_pkt_type_change { 748a8746417SMarcel Holtmann __u8 status; 749a8746417SMarcel Holtmann __le16 handle; 750a8746417SMarcel Holtmann __le16 pkt_type; 75166c853ccSGustavo F. Padovan } __packed; 752a8746417SMarcel Holtmann 75385a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 75485a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 75585a1e930SMarcel Holtmann bdaddr_t bdaddr; 75685a1e930SMarcel Holtmann __u8 pscan_rep_mode; 75766c853ccSGustavo F. Padovan } __packed; 75885a1e930SMarcel Holtmann 759a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 760a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 761a9de9248SMarcel Holtmann bdaddr_t bdaddr; 762a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 763a9de9248SMarcel Holtmann __u8 pscan_period_mode; 764a9de9248SMarcel Holtmann __u8 dev_class[3]; 765a9de9248SMarcel Holtmann __le16 clock_offset; 766a9de9248SMarcel Holtmann __s8 rssi; 76766c853ccSGustavo F. Padovan } __packed; 768a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 769a9de9248SMarcel Holtmann bdaddr_t bdaddr; 770a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 771a9de9248SMarcel Holtmann __u8 pscan_period_mode; 772a9de9248SMarcel Holtmann __u8 pscan_mode; 773a9de9248SMarcel Holtmann __u8 dev_class[3]; 774a9de9248SMarcel Holtmann __le16 clock_offset; 775a9de9248SMarcel Holtmann __s8 rssi; 77666c853ccSGustavo F. Padovan } __packed; 777a9de9248SMarcel Holtmann 778a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 779a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 780a9de9248SMarcel Holtmann __u8 status; 781a9de9248SMarcel Holtmann __le16 handle; 782a9de9248SMarcel Holtmann __u8 page; 783a9de9248SMarcel Holtmann __u8 max_page; 784a9de9248SMarcel Holtmann __u8 features[8]; 78566c853ccSGustavo F. Padovan } __packed; 786a9de9248SMarcel Holtmann 787a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 788a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 789a9de9248SMarcel Holtmann __u8 status; 790a9de9248SMarcel Holtmann __le16 handle; 791a9de9248SMarcel Holtmann bdaddr_t bdaddr; 792a9de9248SMarcel Holtmann __u8 link_type; 793a9de9248SMarcel Holtmann __u8 tx_interval; 794a9de9248SMarcel Holtmann __u8 retrans_window; 795a9de9248SMarcel Holtmann __le16 rx_pkt_len; 796a9de9248SMarcel Holtmann __le16 tx_pkt_len; 797a9de9248SMarcel Holtmann __u8 air_mode; 79866c853ccSGustavo F. Padovan } __packed; 799a9de9248SMarcel Holtmann 800a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 801a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 802a9de9248SMarcel Holtmann __u8 status; 803a9de9248SMarcel Holtmann __le16 handle; 804a9de9248SMarcel Holtmann __u8 tx_interval; 805a9de9248SMarcel Holtmann __u8 retrans_window; 806a9de9248SMarcel Holtmann __le16 rx_pkt_len; 807a9de9248SMarcel Holtmann __le16 tx_pkt_len; 80866c853ccSGustavo F. Padovan } __packed; 809a9de9248SMarcel Holtmann 810a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 81104837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 81204837f64SMarcel Holtmann __u8 status; 81304837f64SMarcel Holtmann __le16 handle; 81404837f64SMarcel Holtmann __le16 max_tx_latency; 81504837f64SMarcel Holtmann __le16 max_rx_latency; 81604837f64SMarcel Holtmann __le16 max_remote_timeout; 81704837f64SMarcel Holtmann __le16 max_local_timeout; 81866c853ccSGustavo F. Padovan } __packed; 81904837f64SMarcel Holtmann 820a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 821a9de9248SMarcel Holtmann struct extended_inquiry_info { 822a9de9248SMarcel Holtmann bdaddr_t bdaddr; 823a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 824a9de9248SMarcel Holtmann __u8 pscan_period_mode; 825a9de9248SMarcel Holtmann __u8 dev_class[3]; 826a9de9248SMarcel Holtmann __le16 clock_offset; 827a9de9248SMarcel Holtmann __s8 rssi; 828a9de9248SMarcel Holtmann __u8 data[240]; 82966c853ccSGustavo F. Padovan } __packed; 830a9de9248SMarcel Holtmann 8310493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST 0x31 8320493684eSMarcel Holtmann struct hci_ev_io_capa_request { 8330493684eSMarcel Holtmann bdaddr_t bdaddr; 83466c853ccSGustavo F. Padovan } __packed; 8350493684eSMarcel Holtmann 8360493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 8370493684eSMarcel Holtmann struct hci_ev_simple_pair_complete { 8380493684eSMarcel Holtmann __u8 status; 8390493684eSMarcel Holtmann bdaddr_t bdaddr; 84066c853ccSGustavo F. Padovan } __packed; 8410493684eSMarcel Holtmann 84241a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 84341a96212SMarcel Holtmann struct hci_ev_remote_host_features { 84441a96212SMarcel Holtmann bdaddr_t bdaddr; 84541a96212SMarcel Holtmann __u8 features[8]; 84666c853ccSGustavo F. Padovan } __packed; 84741a96212SMarcel Holtmann 8481da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 849a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 8501da177e4SLinus Torvalds struct hci_ev_stack_internal { 8511da177e4SLinus Torvalds __u16 type; 8521da177e4SLinus Torvalds __u8 data[0]; 85366c853ccSGustavo F. Padovan } __packed; 8541da177e4SLinus Torvalds 8551da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 8561da177e4SLinus Torvalds struct hci_ev_si_device { 8571da177e4SLinus Torvalds __u16 event; 8581da177e4SLinus Torvalds __u16 dev_id; 85966c853ccSGustavo F. Padovan } __packed; 8601da177e4SLinus Torvalds 8611da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 8621da177e4SLinus Torvalds struct hci_ev_si_security { 8631da177e4SLinus Torvalds __u16 event; 8641da177e4SLinus Torvalds __u16 proto; 8651da177e4SLinus Torvalds __u16 subproto; 8661da177e4SLinus Torvalds __u8 incoming; 86766c853ccSGustavo F. Padovan } __packed; 8681da177e4SLinus Torvalds 8691da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 8701da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 8711da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 8721da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 8731da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 8741da177e4SLinus Torvalds 8751da177e4SLinus Torvalds struct hci_command_hdr { 8761ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 8771da177e4SLinus Torvalds __u8 plen; 87866c853ccSGustavo F. Padovan } __packed; 8791da177e4SLinus Torvalds 8801da177e4SLinus Torvalds struct hci_event_hdr { 8811da177e4SLinus Torvalds __u8 evt; 8821da177e4SLinus Torvalds __u8 plen; 88366c853ccSGustavo F. Padovan } __packed; 8841da177e4SLinus Torvalds 8851da177e4SLinus Torvalds struct hci_acl_hdr { 8861ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 8871ebb9252SMarcel Holtmann __le16 dlen; 88866c853ccSGustavo F. Padovan } __packed; 8891da177e4SLinus Torvalds 8901da177e4SLinus Torvalds struct hci_sco_hdr { 8911ebb9252SMarcel Holtmann __le16 handle; 8921da177e4SLinus Torvalds __u8 dlen; 89366c853ccSGustavo F. Padovan } __packed; 8941da177e4SLinus Torvalds 8952a123b86SArnaldo Carvalho de Melo #ifdef __KERNEL__ 8962a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h> 8972a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 8982a123b86SArnaldo Carvalho de Melo { 8992a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 9002a123b86SArnaldo Carvalho de Melo } 9012a123b86SArnaldo Carvalho de Melo 9022a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 9032a123b86SArnaldo Carvalho de Melo { 9042a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 9052a123b86SArnaldo Carvalho de Melo } 9062a123b86SArnaldo Carvalho de Melo 9072a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 9082a123b86SArnaldo Carvalho de Melo { 9092a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 9102a123b86SArnaldo Carvalho de Melo } 9112a123b86SArnaldo Carvalho de Melo #endif 9122a123b86SArnaldo Carvalho de Melo 9131da177e4SLinus Torvalds /* Command opcode pack/unpack */ 9141da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 9151da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 9161da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 9171da177e4SLinus Torvalds 9181da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 9191da177e4SLinus Torvalds #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) 9201da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 9211da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 9221da177e4SLinus Torvalds 9231da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 9241da177e4SLinus Torvalds 9251da177e4SLinus Torvalds /* Socket options */ 9261da177e4SLinus Torvalds #define HCI_DATA_DIR 1 9271da177e4SLinus Torvalds #define HCI_FILTER 2 9281da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 9291da177e4SLinus Torvalds 9301da177e4SLinus Torvalds /* CMSG flags */ 9311da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 9321da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 9331da177e4SLinus Torvalds 9341da177e4SLinus Torvalds struct sockaddr_hci { 9351da177e4SLinus Torvalds sa_family_t hci_family; 9361da177e4SLinus Torvalds unsigned short hci_dev; 9371da177e4SLinus Torvalds }; 9381da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 9391da177e4SLinus Torvalds 9401da177e4SLinus Torvalds struct hci_filter { 9411da177e4SLinus Torvalds unsigned long type_mask; 9421da177e4SLinus Torvalds unsigned long event_mask[2]; 943905f3ed6SAl Viro __le16 opcode; 9441da177e4SLinus Torvalds }; 9451da177e4SLinus Torvalds 9461da177e4SLinus Torvalds struct hci_ufilter { 9471da177e4SLinus Torvalds __u32 type_mask; 9481da177e4SLinus Torvalds __u32 event_mask[2]; 949905f3ed6SAl Viro __le16 opcode; 9501da177e4SLinus Torvalds }; 9511da177e4SLinus Torvalds 9521da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 9531da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 9541da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 9551da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 9561da177e4SLinus Torvalds 9571da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 9581da177e4SLinus Torvalds struct hci_dev_stats { 9591da177e4SLinus Torvalds __u32 err_rx; 9601da177e4SLinus Torvalds __u32 err_tx; 9611da177e4SLinus Torvalds __u32 cmd_tx; 9621da177e4SLinus Torvalds __u32 evt_rx; 9631da177e4SLinus Torvalds __u32 acl_tx; 9641da177e4SLinus Torvalds __u32 acl_rx; 9651da177e4SLinus Torvalds __u32 sco_tx; 9661da177e4SLinus Torvalds __u32 sco_rx; 9671da177e4SLinus Torvalds __u32 byte_rx; 9681da177e4SLinus Torvalds __u32 byte_tx; 9691da177e4SLinus Torvalds }; 9701da177e4SLinus Torvalds 9711da177e4SLinus Torvalds struct hci_dev_info { 9721da177e4SLinus Torvalds __u16 dev_id; 9731da177e4SLinus Torvalds char name[8]; 9741da177e4SLinus Torvalds 9751da177e4SLinus Torvalds bdaddr_t bdaddr; 9761da177e4SLinus Torvalds 9771da177e4SLinus Torvalds __u32 flags; 9781da177e4SLinus Torvalds __u8 type; 9791da177e4SLinus Torvalds 9801da177e4SLinus Torvalds __u8 features[8]; 9811da177e4SLinus Torvalds 9821da177e4SLinus Torvalds __u32 pkt_type; 9831da177e4SLinus Torvalds __u32 link_policy; 9841da177e4SLinus Torvalds __u32 link_mode; 9851da177e4SLinus Torvalds 9861da177e4SLinus Torvalds __u16 acl_mtu; 9871da177e4SLinus Torvalds __u16 acl_pkts; 9881da177e4SLinus Torvalds __u16 sco_mtu; 9891da177e4SLinus Torvalds __u16 sco_pkts; 9901da177e4SLinus Torvalds 9911da177e4SLinus Torvalds struct hci_dev_stats stat; 9921da177e4SLinus Torvalds }; 9931da177e4SLinus Torvalds 9941da177e4SLinus Torvalds struct hci_conn_info { 9951da177e4SLinus Torvalds __u16 handle; 9961da177e4SLinus Torvalds bdaddr_t bdaddr; 9971da177e4SLinus Torvalds __u8 type; 9981da177e4SLinus Torvalds __u8 out; 9991da177e4SLinus Torvalds __u16 state; 10001da177e4SLinus Torvalds __u32 link_mode; 10011da177e4SLinus Torvalds }; 10021da177e4SLinus Torvalds 10031da177e4SLinus Torvalds struct hci_dev_req { 10041da177e4SLinus Torvalds __u16 dev_id; 10051da177e4SLinus Torvalds __u32 dev_opt; 10061da177e4SLinus Torvalds }; 10071da177e4SLinus Torvalds 10081da177e4SLinus Torvalds struct hci_dev_list_req { 10091da177e4SLinus Torvalds __u16 dev_num; 10101da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 10111da177e4SLinus Torvalds }; 10121da177e4SLinus Torvalds 10131da177e4SLinus Torvalds struct hci_conn_list_req { 10141da177e4SLinus Torvalds __u16 dev_id; 10151da177e4SLinus Torvalds __u16 conn_num; 10161da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 10171da177e4SLinus Torvalds }; 10181da177e4SLinus Torvalds 10191da177e4SLinus Torvalds struct hci_conn_info_req { 10201da177e4SLinus Torvalds bdaddr_t bdaddr; 10211da177e4SLinus Torvalds __u8 type; 10221da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 10231da177e4SLinus Torvalds }; 10241da177e4SLinus Torvalds 102540be492fSMarcel Holtmann struct hci_auth_info_req { 102640be492fSMarcel Holtmann bdaddr_t bdaddr; 102740be492fSMarcel Holtmann __u8 type; 102840be492fSMarcel Holtmann }; 102940be492fSMarcel Holtmann 10301da177e4SLinus Torvalds struct hci_inquiry_req { 10311da177e4SLinus Torvalds __u16 dev_id; 10321da177e4SLinus Torvalds __u16 flags; 10331da177e4SLinus Torvalds __u8 lap[3]; 10341da177e4SLinus Torvalds __u8 length; 10351da177e4SLinus Torvalds __u8 num_rsp; 10361da177e4SLinus Torvalds }; 10371da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 10381da177e4SLinus Torvalds 10391da177e4SLinus Torvalds #endif /* __HCI_H */ 1040