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 578f1e1742SDavid 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, 79ab81cbf9SJohan Hedberg 80ab81cbf9SJohan Hedberg HCI_SETUP, 81ab81cbf9SJohan Hedberg HCI_AUTO_OFF, 82ebc99febSJohan Hedberg HCI_MGMT, 83c542a06cSJohan Hedberg HCI_PAIRABLE, 841aff6f09SJohan Hedberg HCI_SERVICE_CACHE, 8555ed8ca1SJohan Hedberg HCI_LINK_KEYS, 8655ed8ca1SJohan Hedberg HCI_DEBUG_KEYS, 8710572132SGustavo F. Padovan 8810572132SGustavo F. Padovan HCI_RESET, 891da177e4SLinus Torvalds }; 901da177e4SLinus Torvalds 911da177e4SLinus Torvalds /* HCI ioctl defines */ 921da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 931da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 941da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 951da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 981da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 991da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 1001da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 10140be492fSMarcel Holtmann #define HCIGETAUTHINFO _IOR('H', 215, int) 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 1041da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 1051da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 1061da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 1071da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 1081da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 1091da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 1101da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 1111da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 1121da177e4SLinus Torvalds 113f0358568SJohan Hedberg #define HCIBLOCKADDR _IOW('H', 230, int) 114f0358568SJohan Hedberg #define HCIUNBLOCKADDR _IOW('H', 231, int) 115f0358568SJohan Hedberg 1161da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1171da177e4SLinus Torvalds 1181da177e4SLinus Torvalds /* HCI timeouts */ 11904837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 12004837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 121052b30b0SMarcel Holtmann #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 12204837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 12304837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 1246bd32326SVille Tervo #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 1251da177e4SLinus Torvalds 1265b7f9909SMarcel Holtmann /* HCI data types */ 1271da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1281da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1291da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1301da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1311da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1321da177e4SLinus Torvalds 1335b7f9909SMarcel Holtmann /* HCI packet types */ 1341da177e4SLinus Torvalds #define HCI_DM1 0x0008 1351da177e4SLinus Torvalds #define HCI_DM3 0x0400 1361da177e4SLinus Torvalds #define HCI_DM5 0x4000 1371da177e4SLinus Torvalds #define HCI_DH1 0x0010 1381da177e4SLinus Torvalds #define HCI_DH3 0x0800 1391da177e4SLinus Torvalds #define HCI_DH5 0x8000 1401da177e4SLinus Torvalds 1411da177e4SLinus Torvalds #define HCI_HV1 0x0020 1421da177e4SLinus Torvalds #define HCI_HV2 0x0040 1431da177e4SLinus Torvalds #define HCI_HV3 0x0080 1441da177e4SLinus Torvalds 1451da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1461da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1471da177e4SLinus Torvalds 1485b7f9909SMarcel Holtmann /* eSCO packet types */ 1495b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1505b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1515b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1525b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1535b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1545b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 155efc7688bSMarcel Holtmann #define ESCO_2EV3 0x0040 156efc7688bSMarcel Holtmann #define ESCO_3EV3 0x0080 157efc7688bSMarcel Holtmann #define ESCO_2EV5 0x0100 158efc7688bSMarcel Holtmann #define ESCO_3EV5 0x0200 1595b7f9909SMarcel Holtmann 160a8746417SMarcel Holtmann #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 161efc7688bSMarcel Holtmann #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 162a8746417SMarcel Holtmann 1631da177e4SLinus Torvalds /* ACL flags */ 164e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH 0x00 1651da177e4SLinus Torvalds #define ACL_CONT 0x01 1661da177e4SLinus Torvalds #define ACL_START 0x02 1671da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 1681da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 1691da177e4SLinus Torvalds 1701da177e4SLinus Torvalds /* Baseband links */ 1711da177e4SLinus Torvalds #define SCO_LINK 0x00 1721da177e4SLinus Torvalds #define ACL_LINK 0x01 1735b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 174fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */ 175fcd89c09SVille Tervo #define LE_LINK 0x80 1761da177e4SLinus Torvalds 1771da177e4SLinus Torvalds /* LMP features */ 1781da177e4SLinus Torvalds #define LMP_3SLOT 0x01 1791da177e4SLinus Torvalds #define LMP_5SLOT 0x02 1801da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 1811da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 1821da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 1831da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 1841da177e4SLinus Torvalds #define LMP_HOLD 0x40 18504837f64SMarcel Holtmann #define LMP_SNIFF 0x80 1861da177e4SLinus Torvalds 1871da177e4SLinus Torvalds #define LMP_PARK 0x01 1881da177e4SLinus Torvalds #define LMP_RSSI 0x02 1891da177e4SLinus Torvalds #define LMP_QUALITY 0x04 1901da177e4SLinus Torvalds #define LMP_SCO 0x08 1911da177e4SLinus Torvalds #define LMP_HV2 0x10 1921da177e4SLinus Torvalds #define LMP_HV3 0x20 1931da177e4SLinus Torvalds #define LMP_ULAW 0x40 1941da177e4SLinus Torvalds #define LMP_ALAW 0x80 1951da177e4SLinus Torvalds 1961da177e4SLinus Torvalds #define LMP_CVSD 0x01 1971da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 1981da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 1991da177e4SLinus Torvalds 200d5859e22SJohan Hedberg #define LMP_RSSI_INQ 0x40 2015b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 2025b7f9909SMarcel Holtmann 2035b7f9909SMarcel Holtmann #define LMP_EV4 0x01 2045b7f9909SMarcel Holtmann #define LMP_EV5 0x02 205d5859e22SJohan Hedberg #define LMP_LE 0x40 2065b7f9909SMarcel Holtmann 20704837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 208d5859e22SJohan Hedberg #define LMP_PAUSE_ENC 0x04 209efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M 0x20 210efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M 0x40 211efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO 0x80 21204837f64SMarcel Holtmann 213d5859e22SJohan Hedberg #define LMP_EXT_INQ 0x01 214e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR 0x02 215769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR 0x08 216e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH 0x40 217769be974SMarcel Holtmann 218d5859e22SJohan Hedberg #define LMP_LSTO 0x01 219d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR 0x02 220971e3a4bSAndre Guedes #define LMP_EXTFEATURES 0x80 221d5859e22SJohan Hedberg 222eead27daSAndre Guedes /* Extended LMP features */ 223eead27daSAndre Guedes #define LMP_HOST_LE 0x02 224eead27daSAndre Guedes 22504837f64SMarcel Holtmann /* Connection modes */ 22604837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 22704837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 22804837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 22904837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 23004837f64SMarcel Holtmann 2311da177e4SLinus Torvalds /* Link policies */ 2321da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 2331da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 2341da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 2351da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 2361da177e4SLinus Torvalds 23704837f64SMarcel Holtmann /* Link modes */ 2381da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 2391da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 2401da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 2411da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 2421da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 2431da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2441da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2451da177e4SLinus Torvalds 24640be492fSMarcel Holtmann /* Authentication types */ 24740be492fSMarcel Holtmann #define HCI_AT_NO_BONDING 0x00 24840be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM 0x01 24940be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING 0x02 25040be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM 0x03 25140be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING 0x04 25240be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM 0x05 25340be492fSMarcel Holtmann 254b6020ba0SWaldemar Rymarkiewicz /* Link Key types */ 255b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION 0x00 256b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT 0x01 257b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT 0x02 258b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION 0x03 259b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION 0x04 260b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION 0x05 261b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION 0x06 26234918cd7SVinicius Costa Gomes /* The spec doesn't define types for SMP keys */ 26334918cd7SVinicius Costa Gomes #define HCI_LK_SMP_LTK 0x81 26434918cd7SVinicius Costa Gomes #define HCI_LK_SMP_IRK 0x82 26534918cd7SVinicius Costa Gomes #define HCI_LK_SMP_CSRK 0x83 266b6020ba0SWaldemar Rymarkiewicz 2679f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */ 2689f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE 0x05 2699f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR 0x0f 2709f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM 0x13 2719f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM 0x16 2729f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 2739f5a0d7bSAndrei Emeltchenko 2741da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 2756bd32326SVille Tervo #define HCI_OP_NOP 0x0000 2766bd32326SVille Tervo 277a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 278a9de9248SMarcel Holtmann struct hci_cp_inquiry { 279a9de9248SMarcel Holtmann __u8 lap[3]; 280a9de9248SMarcel Holtmann __u8 length; 281a9de9248SMarcel Holtmann __u8 num_rsp; 28266c853ccSGustavo F. Padovan } __packed; 2831da177e4SLinus Torvalds 284a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 285a9de9248SMarcel Holtmann 286a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 287a9de9248SMarcel Holtmann 288a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 289a9de9248SMarcel Holtmann struct hci_cp_create_conn { 290a9de9248SMarcel Holtmann bdaddr_t bdaddr; 291a9de9248SMarcel Holtmann __le16 pkt_type; 292a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 293a9de9248SMarcel Holtmann __u8 pscan_mode; 294a9de9248SMarcel Holtmann __le16 clock_offset; 295a9de9248SMarcel Holtmann __u8 role_switch; 29666c853ccSGustavo F. Padovan } __packed; 2971da177e4SLinus Torvalds 298a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 299a9de9248SMarcel Holtmann struct hci_cp_disconnect { 300a9de9248SMarcel Holtmann __le16 handle; 301a9de9248SMarcel Holtmann __u8 reason; 30266c853ccSGustavo F. Padovan } __packed; 3031da177e4SLinus Torvalds 304a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 305a9de9248SMarcel Holtmann struct hci_cp_add_sco { 306a9de9248SMarcel Holtmann __le16 handle; 307a9de9248SMarcel Holtmann __le16 pkt_type; 30866c853ccSGustavo F. Padovan } __packed; 309a9de9248SMarcel Holtmann 310a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 311a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 3121da177e4SLinus Torvalds bdaddr_t bdaddr; 31366c853ccSGustavo F. Padovan } __packed; 3141da177e4SLinus Torvalds 315a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 316a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 317a9de9248SMarcel Holtmann bdaddr_t bdaddr; 318a9de9248SMarcel Holtmann __u8 role; 31966c853ccSGustavo F. Padovan } __packed; 3201da177e4SLinus Torvalds 321a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 322a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 323a9de9248SMarcel Holtmann bdaddr_t bdaddr; 324a9de9248SMarcel Holtmann __u8 reason; 32566c853ccSGustavo F. Padovan } __packed; 3261da177e4SLinus Torvalds 327a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 328a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 329a9de9248SMarcel Holtmann bdaddr_t bdaddr; 330a9de9248SMarcel Holtmann __u8 link_key[16]; 33166c853ccSGustavo F. Padovan } __packed; 3321da177e4SLinus Torvalds 333a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 334a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 335a9de9248SMarcel Holtmann bdaddr_t bdaddr; 33666c853ccSGustavo F. Padovan } __packed; 3371da177e4SLinus Torvalds 338a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 339a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 340a9de9248SMarcel Holtmann bdaddr_t bdaddr; 341a9de9248SMarcel Holtmann __u8 pin_len; 342a9de9248SMarcel Holtmann __u8 pin_code[16]; 34366c853ccSGustavo F. Padovan } __packed; 344980e1a53SJohan Hedberg struct hci_rp_pin_code_reply { 345980e1a53SJohan Hedberg __u8 status; 346980e1a53SJohan Hedberg bdaddr_t bdaddr; 347980e1a53SJohan Hedberg } __packed; 348a9de9248SMarcel Holtmann 349a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 350a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 351a9de9248SMarcel Holtmann bdaddr_t bdaddr; 35266c853ccSGustavo F. Padovan } __packed; 353980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply { 354980e1a53SJohan Hedberg __u8 status; 355980e1a53SJohan Hedberg bdaddr_t bdaddr; 356980e1a53SJohan Hedberg } __packed; 357a9de9248SMarcel Holtmann 358a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 359a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 360a9de9248SMarcel Holtmann __le16 handle; 361a9de9248SMarcel Holtmann __le16 pkt_type; 36266c853ccSGustavo F. Padovan } __packed; 363a9de9248SMarcel Holtmann 364a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 365a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 366a9de9248SMarcel Holtmann __le16 handle; 36766c853ccSGustavo F. Padovan } __packed; 368a9de9248SMarcel Holtmann 369a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 370a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 371a9de9248SMarcel Holtmann __le16 handle; 372a9de9248SMarcel Holtmann __u8 encrypt; 37366c853ccSGustavo F. Padovan } __packed; 374a9de9248SMarcel Holtmann 375a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 376a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 377a9de9248SMarcel Holtmann __le16 handle; 37866c853ccSGustavo F. Padovan } __packed; 379a9de9248SMarcel Holtmann 380a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 381a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 382a9de9248SMarcel Holtmann bdaddr_t bdaddr; 383a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 384a9de9248SMarcel Holtmann __u8 pscan_mode; 385a9de9248SMarcel Holtmann __le16 clock_offset; 38666c853ccSGustavo F. Padovan } __packed; 387a9de9248SMarcel Holtmann 388a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 389a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 390a9de9248SMarcel Holtmann bdaddr_t bdaddr; 39166c853ccSGustavo F. Padovan } __packed; 392a9de9248SMarcel Holtmann 393a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 394a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 395a9de9248SMarcel Holtmann __le16 handle; 39666c853ccSGustavo F. Padovan } __packed; 397a9de9248SMarcel Holtmann 398a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 399a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 400a9de9248SMarcel Holtmann __le16 handle; 401a9de9248SMarcel Holtmann __u8 page; 40266c853ccSGustavo F. Padovan } __packed; 403a9de9248SMarcel Holtmann 404a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 405a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 406a9de9248SMarcel Holtmann __le16 handle; 40766c853ccSGustavo F. Padovan } __packed; 408a9de9248SMarcel Holtmann 409a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 410a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 411a9de9248SMarcel Holtmann __le16 handle; 412a9de9248SMarcel Holtmann __le32 tx_bandwidth; 413a9de9248SMarcel Holtmann __le32 rx_bandwidth; 414a9de9248SMarcel Holtmann __le16 max_latency; 415a9de9248SMarcel Holtmann __le16 voice_setting; 416a9de9248SMarcel Holtmann __u8 retrans_effort; 417a9de9248SMarcel Holtmann __le16 pkt_type; 41866c853ccSGustavo F. Padovan } __packed; 419a9de9248SMarcel Holtmann 420a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 421a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 422a9de9248SMarcel Holtmann bdaddr_t bdaddr; 423a9de9248SMarcel Holtmann __le32 tx_bandwidth; 424a9de9248SMarcel Holtmann __le32 rx_bandwidth; 425a9de9248SMarcel Holtmann __le16 max_latency; 426a9de9248SMarcel Holtmann __le16 content_format; 427a9de9248SMarcel Holtmann __u8 retrans_effort; 428a9de9248SMarcel Holtmann __le16 pkt_type; 42966c853ccSGustavo F. Padovan } __packed; 430a9de9248SMarcel Holtmann 431a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 432a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 433a9de9248SMarcel Holtmann bdaddr_t bdaddr; 434a9de9248SMarcel Holtmann __u8 reason; 43566c853ccSGustavo F. Padovan } __packed; 436a9de9248SMarcel Holtmann 43717fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY 0x042b 43817fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply { 43917fa4b9dSJohan Hedberg bdaddr_t bdaddr; 44017fa4b9dSJohan Hedberg __u8 capability; 44117fa4b9dSJohan Hedberg __u8 oob_data; 44217fa4b9dSJohan Hedberg __u8 authentication; 44317fa4b9dSJohan Hedberg } __packed; 44417fa4b9dSJohan Hedberg 445a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY 0x042c 446a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply { 447a5c29683SJohan Hedberg bdaddr_t bdaddr; 448a5c29683SJohan Hedberg } __packed; 449a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply { 450a5c29683SJohan Hedberg __u8 status; 451a5c29683SJohan Hedberg bdaddr_t bdaddr; 452a5c29683SJohan Hedberg } __packed; 453a5c29683SJohan Hedberg 454a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 455a5c29683SJohan Hedberg 4569ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY 0x042e 4579ad4019aSBrian Gix struct hci_cp_user_passkey_reply { 4589ad4019aSBrian Gix bdaddr_t bdaddr; 4599ad4019aSBrian Gix __le32 passkey; 4609ad4019aSBrian Gix } __packed; 4619ad4019aSBrian Gix 4629ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f 4639ad4019aSBrian Gix 4642763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 4652763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply { 4662763eda6SSzymon Janc bdaddr_t bdaddr; 4672763eda6SSzymon Janc __u8 hash[16]; 4682763eda6SSzymon Janc __u8 randomizer[16]; 4692763eda6SSzymon Janc } __packed; 4702763eda6SSzymon Janc 4712763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 4722763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply { 4732763eda6SSzymon Janc bdaddr_t bdaddr; 4742763eda6SSzymon Janc } __packed; 4752763eda6SSzymon Janc 47603b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 47703b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply { 47803b555e1SJohan Hedberg bdaddr_t bdaddr; 47903b555e1SJohan Hedberg __u8 reason; 48003b555e1SJohan Hedberg } __packed; 48103b555e1SJohan Hedberg 482a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 483a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 484a9de9248SMarcel Holtmann __le16 handle; 485a9de9248SMarcel Holtmann __le16 max_interval; 486a9de9248SMarcel Holtmann __le16 min_interval; 487a9de9248SMarcel Holtmann __le16 attempt; 488a9de9248SMarcel Holtmann __le16 timeout; 48966c853ccSGustavo F. Padovan } __packed; 490a9de9248SMarcel Holtmann 491a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 492a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 493a9de9248SMarcel Holtmann __le16 handle; 49466c853ccSGustavo F. Padovan } __packed; 495a9de9248SMarcel Holtmann 496a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 497a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 498a9de9248SMarcel Holtmann __le16 handle; 49966c853ccSGustavo F. Padovan } __packed; 500a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 501a9de9248SMarcel Holtmann __u8 status; 502a9de9248SMarcel Holtmann __le16 handle; 503a9de9248SMarcel Holtmann __u8 role; 50466c853ccSGustavo F. Padovan } __packed; 505a9de9248SMarcel Holtmann 506a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 507a9de9248SMarcel Holtmann struct hci_cp_switch_role { 508a9de9248SMarcel Holtmann bdaddr_t bdaddr; 509a9de9248SMarcel Holtmann __u8 role; 51066c853ccSGustavo F. Padovan } __packed; 511a9de9248SMarcel Holtmann 512a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 513a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 514a9de9248SMarcel Holtmann __le16 handle; 51566c853ccSGustavo F. Padovan } __packed; 516a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 517a9de9248SMarcel Holtmann __u8 status; 518a9de9248SMarcel Holtmann __le16 handle; 519a9de9248SMarcel Holtmann __le16 policy; 52066c853ccSGustavo F. Padovan } __packed; 521a9de9248SMarcel Holtmann 522a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 523a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 524a9de9248SMarcel Holtmann __le16 handle; 525a9de9248SMarcel Holtmann __le16 policy; 52666c853ccSGustavo F. Padovan } __packed; 527a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 528a9de9248SMarcel Holtmann __u8 status; 529a9de9248SMarcel Holtmann __le16 handle; 53066c853ccSGustavo F. Padovan } __packed; 531a9de9248SMarcel Holtmann 532e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 533e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy { 534e4e8e37cSMarcel Holtmann __u8 status; 535e4e8e37cSMarcel Holtmann __le16 policy; 53666c853ccSGustavo F. Padovan } __packed; 537e4e8e37cSMarcel Holtmann 538e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 539e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy { 540e4e8e37cSMarcel Holtmann __le16 policy; 54166c853ccSGustavo F. Padovan } __packed; 542e4e8e37cSMarcel Holtmann 543a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 544a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 545a9de9248SMarcel Holtmann __le16 handle; 546a9de9248SMarcel Holtmann __le16 max_latency; 547a9de9248SMarcel Holtmann __le16 min_remote_timeout; 548a9de9248SMarcel Holtmann __le16 min_local_timeout; 54966c853ccSGustavo F. Padovan } __packed; 550a9de9248SMarcel Holtmann 551a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 552a9de9248SMarcel Holtmann struct hci_cp_set_event_mask { 553a9de9248SMarcel Holtmann __u8 mask[8]; 55466c853ccSGustavo F. Padovan } __packed; 555a9de9248SMarcel Holtmann 556a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 557a9de9248SMarcel Holtmann 558a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 5591da177e4SLinus Torvalds struct hci_cp_set_event_flt { 5601da177e4SLinus Torvalds __u8 flt_type; 5611da177e4SLinus Torvalds __u8 cond_type; 5621da177e4SLinus Torvalds __u8 condition[0]; 56366c853ccSGustavo F. Padovan } __packed; 5641da177e4SLinus Torvalds 5651da177e4SLinus Torvalds /* Filter types */ 5661da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 5671da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 5681da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 5691da177e4SLinus Torvalds 5701da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 5711da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 5721da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 5731da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 5741da177e4SLinus Torvalds 5751da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 5761da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 5771da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 5781da177e4SLinus Torvalds 579b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 580b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key { 581b0916ea0SJohan Hedberg bdaddr_t bdaddr; 582b0916ea0SJohan Hedberg __u8 delete_all; 583b0916ea0SJohan Hedberg } __packed; 584b0916ea0SJohan Hedberg 5851f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH 248 5861f6c6378SJohan Hedberg 587a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 588a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 5891f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 59066c853ccSGustavo F. Padovan } __packed; 591a9de9248SMarcel Holtmann 592a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 593a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 594a9de9248SMarcel Holtmann __u8 status; 5951f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 59666c853ccSGustavo F. Padovan } __packed; 597a9de9248SMarcel Holtmann 598a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 599a9de9248SMarcel Holtmann 600a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 601a9de9248SMarcel Holtmann 602a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 603a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 604a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 605a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 606a9de9248SMarcel Holtmann 607a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 608a9de9248SMarcel Holtmann 609a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 610a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 611a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 612a9de9248SMarcel Holtmann 613a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 614a9de9248SMarcel Holtmann 615a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 616a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 617a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 618a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 619a9de9248SMarcel Holtmann 620a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 621a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 6221da177e4SLinus Torvalds __u8 status; 6231da177e4SLinus Torvalds __u8 dev_class[3]; 62466c853ccSGustavo F. Padovan } __packed; 6251da177e4SLinus Torvalds 626a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 627a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 6281da177e4SLinus Torvalds __u8 dev_class[3]; 62966c853ccSGustavo F. Padovan } __packed; 6301da177e4SLinus Torvalds 631a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 6321da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 6331da177e4SLinus Torvalds __u8 status; 6341ebb9252SMarcel Holtmann __le16 voice_setting; 63566c853ccSGustavo F. Padovan } __packed; 6361da177e4SLinus Torvalds 637a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 6381da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 6391ebb9252SMarcel Holtmann __le16 voice_setting; 64066c853ccSGustavo F. Padovan } __packed; 6411da177e4SLinus Torvalds 642a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 6431da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 6441ebb9252SMarcel Holtmann __le16 acl_mtu; 6451da177e4SLinus Torvalds __u8 sco_mtu; 6461ebb9252SMarcel Holtmann __le16 acl_max_pkt; 6471ebb9252SMarcel Holtmann __le16 sco_max_pkt; 64866c853ccSGustavo F. Padovan } __packed; 6491da177e4SLinus Torvalds 650d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 651d5859e22SJohan Hedberg 65280a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH 240 65380a1e1dbSJohan Hedberg 65480a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR 0x0c52 65580a1e1dbSJohan Hedberg struct hci_cp_write_eir { 65680a1e1dbSJohan Hedberg uint8_t fec; 65780a1e1dbSJohan Hedberg uint8_t data[HCI_MAX_EIR_LENGTH]; 65880a1e1dbSJohan Hedberg } __packed; 65980a1e1dbSJohan Hedberg 660333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE 0x0c55 661333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode { 662333140b5SMarcel Holtmann __u8 status; 663333140b5SMarcel Holtmann __u8 mode; 66466c853ccSGustavo F. Padovan } __packed; 665333140b5SMarcel Holtmann 666333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE 0x0c56 667333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode { 668333140b5SMarcel Holtmann __u8 mode; 66966c853ccSGustavo F. Padovan } __packed; 670333140b5SMarcel Holtmann 671c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 672c35938b2SSzymon Janc struct hci_rp_read_local_oob_data { 673c35938b2SSzymon Janc __u8 status; 674c35938b2SSzymon Janc __u8 hash[16]; 675c35938b2SSzymon Janc __u8 randomizer[16]; 676c35938b2SSzymon Janc } __packed; 677c35938b2SSzymon Janc 678d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 679d5859e22SJohan Hedberg 680f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 681f9b49306SAndre Guedes struct hci_cp_write_le_host_supported { 682f9b49306SAndre Guedes __u8 le; 683f9b49306SAndre Guedes __u8 simul; 684f9b49306SAndre Guedes } __packed; 685f9b49306SAndre Guedes 686a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 687a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 6881da177e4SLinus Torvalds __u8 status; 689a9de9248SMarcel Holtmann __u8 hci_ver; 690a9de9248SMarcel Holtmann __le16 hci_rev; 691a9de9248SMarcel Holtmann __u8 lmp_ver; 692a9de9248SMarcel Holtmann __le16 manufacturer; 693a9de9248SMarcel Holtmann __le16 lmp_subver; 69466c853ccSGustavo F. Padovan } __packed; 6951da177e4SLinus Torvalds 696a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 697a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 6981da177e4SLinus Torvalds __u8 status; 699a9de9248SMarcel Holtmann __u8 commands[64]; 70066c853ccSGustavo F. Padovan } __packed; 7011da177e4SLinus Torvalds 702a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 703a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 704a9de9248SMarcel Holtmann __u8 status; 705a9de9248SMarcel Holtmann __u8 features[8]; 70666c853ccSGustavo F. Padovan } __packed; 707a9de9248SMarcel Holtmann 708a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 709971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features { 710971e3a4bSAndre Guedes __u8 page; 711971e3a4bSAndre Guedes } __packed; 712a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 713a9de9248SMarcel Holtmann __u8 status; 714a9de9248SMarcel Holtmann __u8 page; 715a9de9248SMarcel Holtmann __u8 max_page; 716a9de9248SMarcel Holtmann __u8 features[8]; 71766c853ccSGustavo F. Padovan } __packed; 718a9de9248SMarcel Holtmann 719a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 720a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 721a9de9248SMarcel Holtmann __u8 status; 722a9de9248SMarcel Holtmann __le16 acl_mtu; 723a9de9248SMarcel Holtmann __u8 sco_mtu; 724a9de9248SMarcel Holtmann __le16 acl_max_pkt; 725a9de9248SMarcel Holtmann __le16 sco_max_pkt; 72666c853ccSGustavo F. Padovan } __packed; 727a9de9248SMarcel Holtmann 728a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 729a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 730a9de9248SMarcel Holtmann __u8 status; 7311da177e4SLinus Torvalds bdaddr_t bdaddr; 73266c853ccSGustavo F. Padovan } __packed; 7331da177e4SLinus Torvalds 734f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 735f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity { 736f6422ec6SAntti Julku __le16 interval; 737f6422ec6SAntti Julku __le16 window; 738f6422ec6SAntti Julku } __packed; 739f6422ec6SAntti Julku 740f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 741f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_STANDARD 0x00 742f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_INTERLACED 0x01 743f6422ec6SAntti Julku 744928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 745928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info { 746928abaa7SAndrei Emeltchenko __u8 status; 747928abaa7SAndrei Emeltchenko __u8 amp_status; 748928abaa7SAndrei Emeltchenko __le32 total_bw; 749928abaa7SAndrei Emeltchenko __le32 max_bw; 750928abaa7SAndrei Emeltchenko __le32 min_latency; 751928abaa7SAndrei Emeltchenko __le32 max_pdu; 752928abaa7SAndrei Emeltchenko __u8 amp_type; 753928abaa7SAndrei Emeltchenko __le16 pal_cap; 754928abaa7SAndrei Emeltchenko __le16 max_assoc_size; 755928abaa7SAndrei Emeltchenko __le32 max_flush_to; 756928abaa7SAndrei Emeltchenko __le32 be_flush_to; 757928abaa7SAndrei Emeltchenko } __packed; 758928abaa7SAndrei Emeltchenko 75963185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK 0x2001 76063185f64SVille Tervo struct hci_cp_le_set_event_mask { 76163185f64SVille Tervo __u8 mask[8]; 76263185f64SVille Tervo } __packed; 76363185f64SVille Tervo 76463185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 76563185f64SVille Tervo struct hci_rp_le_read_buffer_size { 76663185f64SVille Tervo __u8 status; 76763185f64SVille Tervo __le16 le_mtu; 76863185f64SVille Tervo __u8 le_max_pkt; 76963185f64SVille Tervo } __packed; 77063185f64SVille Tervo 771eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 772eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable { 773eb9d91f5SAndre Guedes __u8 enable; 774eb9d91f5SAndre Guedes __u8 filter_dup; 775eb9d91f5SAndre Guedes } __packed; 776eb9d91f5SAndre Guedes 77763185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN 0x200d 77863185f64SVille Tervo struct hci_cp_le_create_conn { 77963185f64SVille Tervo __le16 scan_interval; 78063185f64SVille Tervo __le16 scan_window; 78163185f64SVille Tervo __u8 filter_policy; 78263185f64SVille Tervo __u8 peer_addr_type; 78363185f64SVille Tervo bdaddr_t peer_addr; 78463185f64SVille Tervo __u8 own_address_type; 78563185f64SVille Tervo __le16 conn_interval_min; 78663185f64SVille Tervo __le16 conn_interval_max; 78763185f64SVille Tervo __le16 conn_latency; 78863185f64SVille Tervo __le16 supervision_timeout; 78963185f64SVille Tervo __le16 min_ce_len; 79063185f64SVille Tervo __le16 max_ce_len; 79163185f64SVille Tervo } __packed; 79263185f64SVille Tervo 79363185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 79463185f64SVille Tervo 7952ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE 0x2013 7962ce603ebSClaudio Takahasi struct hci_cp_le_conn_update { 7972ce603ebSClaudio Takahasi __le16 handle; 7982ce603ebSClaudio Takahasi __le16 conn_interval_min; 7992ce603ebSClaudio Takahasi __le16 conn_interval_max; 8002ce603ebSClaudio Takahasi __le16 conn_latency; 8012ce603ebSClaudio Takahasi __le16 supervision_timeout; 8022ce603ebSClaudio Takahasi __le16 min_ce_len; 8032ce603ebSClaudio Takahasi __le16 max_ce_len; 8042ce603ebSClaudio Takahasi } __packed; 8052ce603ebSClaudio Takahasi 806a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC 0x2019 807a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc { 808a7a595f6SVinicius Costa Gomes __le16 handle; 809a7a595f6SVinicius Costa Gomes __u8 rand[8]; 810a7a595f6SVinicius Costa Gomes __le16 ediv; 811a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 812a7a595f6SVinicius Costa Gomes } __packed; 813a7a595f6SVinicius Costa Gomes 814a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY 0x201a 815a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply { 816a7a595f6SVinicius Costa Gomes __le16 handle; 817a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 818a7a595f6SVinicius Costa Gomes } __packed; 819a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply { 820a7a595f6SVinicius Costa Gomes __u8 status; 821a7a595f6SVinicius Costa Gomes __le16 handle; 822a7a595f6SVinicius Costa Gomes } __packed; 823a7a595f6SVinicius Costa Gomes 824a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY 0x201b 825a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply { 826a7a595f6SVinicius Costa Gomes __le16 handle; 827a7a595f6SVinicius Costa Gomes } __packed; 828a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply { 829a7a595f6SVinicius Costa Gomes __u8 status; 830a7a595f6SVinicius Costa Gomes __le16 handle; 831a7a595f6SVinicius Costa Gomes } __packed; 832a7a595f6SVinicius Costa Gomes 8331da177e4SLinus Torvalds /* ---- HCI Events ---- */ 8341da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 8351da177e4SLinus Torvalds 8361da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 8371da177e4SLinus Torvalds struct inquiry_info { 8381da177e4SLinus Torvalds bdaddr_t bdaddr; 8391da177e4SLinus Torvalds __u8 pscan_rep_mode; 8401da177e4SLinus Torvalds __u8 pscan_period_mode; 8411da177e4SLinus Torvalds __u8 pscan_mode; 8421da177e4SLinus Torvalds __u8 dev_class[3]; 8431ebb9252SMarcel Holtmann __le16 clock_offset; 84466c853ccSGustavo F. Padovan } __packed; 8451da177e4SLinus Torvalds 8461da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 8471da177e4SLinus Torvalds struct hci_ev_conn_complete { 8481da177e4SLinus Torvalds __u8 status; 8491ebb9252SMarcel Holtmann __le16 handle; 8501da177e4SLinus Torvalds bdaddr_t bdaddr; 8511da177e4SLinus Torvalds __u8 link_type; 8521da177e4SLinus Torvalds __u8 encr_mode; 85366c853ccSGustavo F. Padovan } __packed; 8541da177e4SLinus Torvalds 8551da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 8561da177e4SLinus Torvalds struct hci_ev_conn_request { 8571da177e4SLinus Torvalds bdaddr_t bdaddr; 8581da177e4SLinus Torvalds __u8 dev_class[3]; 8591da177e4SLinus Torvalds __u8 link_type; 86066c853ccSGustavo F. Padovan } __packed; 8611da177e4SLinus Torvalds 8621da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 8631da177e4SLinus Torvalds struct hci_ev_disconn_complete { 8641da177e4SLinus Torvalds __u8 status; 8651ebb9252SMarcel Holtmann __le16 handle; 8661da177e4SLinus Torvalds __u8 reason; 86766c853ccSGustavo F. Padovan } __packed; 8681da177e4SLinus Torvalds 8691da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 8701da177e4SLinus Torvalds struct hci_ev_auth_complete { 8711da177e4SLinus Torvalds __u8 status; 8721ebb9252SMarcel Holtmann __le16 handle; 87366c853ccSGustavo F. Padovan } __packed; 8741da177e4SLinus Torvalds 875a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 876a9de9248SMarcel Holtmann struct hci_ev_remote_name { 877a9de9248SMarcel Holtmann __u8 status; 878a9de9248SMarcel Holtmann bdaddr_t bdaddr; 8791f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 88066c853ccSGustavo F. Padovan } __packed; 881a9de9248SMarcel Holtmann 8821da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 8831da177e4SLinus Torvalds struct hci_ev_encrypt_change { 8841da177e4SLinus Torvalds __u8 status; 8851ebb9252SMarcel Holtmann __le16 handle; 8861da177e4SLinus Torvalds __u8 encrypt; 88766c853ccSGustavo F. Padovan } __packed; 8881da177e4SLinus Torvalds 889a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 890a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 8911da177e4SLinus Torvalds __u8 status; 8921ebb9252SMarcel Holtmann __le16 handle; 89366c853ccSGustavo F. Padovan } __packed; 8941da177e4SLinus Torvalds 895a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 896a9de9248SMarcel Holtmann struct hci_ev_remote_features { 897a9de9248SMarcel Holtmann __u8 status; 898a9de9248SMarcel Holtmann __le16 handle; 899a9de9248SMarcel Holtmann __u8 features[8]; 90066c853ccSGustavo F. Padovan } __packed; 901a9de9248SMarcel Holtmann 902a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 903a9de9248SMarcel Holtmann struct hci_ev_remote_version { 904a9de9248SMarcel Holtmann __u8 status; 905a9de9248SMarcel Holtmann __le16 handle; 906a9de9248SMarcel Holtmann __u8 lmp_ver; 907a9de9248SMarcel Holtmann __le16 manufacturer; 908a9de9248SMarcel Holtmann __le16 lmp_subver; 90966c853ccSGustavo F. Padovan } __packed; 910a9de9248SMarcel Holtmann 911a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 9121da177e4SLinus Torvalds struct hci_qos { 9131da177e4SLinus Torvalds __u8 service_type; 9141da177e4SLinus Torvalds __u32 token_rate; 9151da177e4SLinus Torvalds __u32 peak_bandwidth; 9161da177e4SLinus Torvalds __u32 latency; 9171da177e4SLinus Torvalds __u32 delay_variation; 91866c853ccSGustavo F. Padovan } __packed; 9191da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 9201da177e4SLinus Torvalds __u8 status; 9211ebb9252SMarcel Holtmann __le16 handle; 9221da177e4SLinus Torvalds struct hci_qos qos; 92366c853ccSGustavo F. Padovan } __packed; 9241da177e4SLinus Torvalds 925a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 9261da177e4SLinus Torvalds struct hci_ev_cmd_complete { 9271da177e4SLinus Torvalds __u8 ncmd; 9281ebb9252SMarcel Holtmann __le16 opcode; 92966c853ccSGustavo F. Padovan } __packed; 9301da177e4SLinus Torvalds 931a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 9321da177e4SLinus Torvalds struct hci_ev_cmd_status { 9331da177e4SLinus Torvalds __u8 status; 9341da177e4SLinus Torvalds __u8 ncmd; 9351ebb9252SMarcel Holtmann __le16 opcode; 93666c853ccSGustavo F. Padovan } __packed; 9371da177e4SLinus Torvalds 9381da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 9391da177e4SLinus Torvalds struct hci_ev_role_change { 9401da177e4SLinus Torvalds __u8 status; 9411da177e4SLinus Torvalds bdaddr_t bdaddr; 9421da177e4SLinus Torvalds __u8 role; 94366c853ccSGustavo F. Padovan } __packed; 9441da177e4SLinus Torvalds 945a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 946a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 947a9de9248SMarcel Holtmann __u8 num_hndl; 948a9de9248SMarcel Holtmann /* variable length part */ 94966c853ccSGustavo F. Padovan } __packed; 950a9de9248SMarcel Holtmann 9511da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 9521da177e4SLinus Torvalds struct hci_ev_mode_change { 9531da177e4SLinus Torvalds __u8 status; 9541ebb9252SMarcel Holtmann __le16 handle; 9551da177e4SLinus Torvalds __u8 mode; 9561ebb9252SMarcel Holtmann __le16 interval; 95766c853ccSGustavo F. Padovan } __packed; 9581da177e4SLinus Torvalds 9591da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 9601da177e4SLinus Torvalds struct hci_ev_pin_code_req { 9611da177e4SLinus Torvalds bdaddr_t bdaddr; 96266c853ccSGustavo F. Padovan } __packed; 9631da177e4SLinus Torvalds 9641da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 9651da177e4SLinus Torvalds struct hci_ev_link_key_req { 9661da177e4SLinus Torvalds bdaddr_t bdaddr; 96766c853ccSGustavo F. Padovan } __packed; 9681da177e4SLinus Torvalds 9691da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 9701da177e4SLinus Torvalds struct hci_ev_link_key_notify { 9711da177e4SLinus Torvalds bdaddr_t bdaddr; 9721da177e4SLinus Torvalds __u8 link_key[16]; 9731da177e4SLinus Torvalds __u8 key_type; 97466c853ccSGustavo F. Padovan } __packed; 9751da177e4SLinus Torvalds 976a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 9771da177e4SLinus Torvalds struct hci_ev_clock_offset { 9781da177e4SLinus Torvalds __u8 status; 9791ebb9252SMarcel Holtmann __le16 handle; 9801ebb9252SMarcel Holtmann __le16 clock_offset; 98166c853ccSGustavo F. Padovan } __packed; 9821da177e4SLinus Torvalds 983a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE 0x1d 984a8746417SMarcel Holtmann struct hci_ev_pkt_type_change { 985a8746417SMarcel Holtmann __u8 status; 986a8746417SMarcel Holtmann __le16 handle; 987a8746417SMarcel Holtmann __le16 pkt_type; 98866c853ccSGustavo F. Padovan } __packed; 989a8746417SMarcel Holtmann 99085a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 99185a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 99285a1e930SMarcel Holtmann bdaddr_t bdaddr; 99385a1e930SMarcel Holtmann __u8 pscan_rep_mode; 99466c853ccSGustavo F. Padovan } __packed; 99585a1e930SMarcel Holtmann 996a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 997a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 998a9de9248SMarcel Holtmann bdaddr_t bdaddr; 999a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1000a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1001a9de9248SMarcel Holtmann __u8 dev_class[3]; 1002a9de9248SMarcel Holtmann __le16 clock_offset; 1003a9de9248SMarcel Holtmann __s8 rssi; 100466c853ccSGustavo F. Padovan } __packed; 1005a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 1006a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1007a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1008a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1009a9de9248SMarcel Holtmann __u8 pscan_mode; 1010a9de9248SMarcel Holtmann __u8 dev_class[3]; 1011a9de9248SMarcel Holtmann __le16 clock_offset; 1012a9de9248SMarcel Holtmann __s8 rssi; 101366c853ccSGustavo F. Padovan } __packed; 1014a9de9248SMarcel Holtmann 1015a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 1016a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 1017a9de9248SMarcel Holtmann __u8 status; 1018a9de9248SMarcel Holtmann __le16 handle; 1019a9de9248SMarcel Holtmann __u8 page; 1020a9de9248SMarcel Holtmann __u8 max_page; 1021a9de9248SMarcel Holtmann __u8 features[8]; 102266c853ccSGustavo F. Padovan } __packed; 1023a9de9248SMarcel Holtmann 1024a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 1025a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 1026a9de9248SMarcel Holtmann __u8 status; 1027a9de9248SMarcel Holtmann __le16 handle; 1028a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1029a9de9248SMarcel Holtmann __u8 link_type; 1030a9de9248SMarcel Holtmann __u8 tx_interval; 1031a9de9248SMarcel Holtmann __u8 retrans_window; 1032a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1033a9de9248SMarcel Holtmann __le16 tx_pkt_len; 1034a9de9248SMarcel Holtmann __u8 air_mode; 103566c853ccSGustavo F. Padovan } __packed; 1036a9de9248SMarcel Holtmann 1037a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 1038a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 1039a9de9248SMarcel Holtmann __u8 status; 1040a9de9248SMarcel Holtmann __le16 handle; 1041a9de9248SMarcel Holtmann __u8 tx_interval; 1042a9de9248SMarcel Holtmann __u8 retrans_window; 1043a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1044a9de9248SMarcel Holtmann __le16 tx_pkt_len; 104566c853ccSGustavo F. Padovan } __packed; 1046a9de9248SMarcel Holtmann 1047a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 104804837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 104904837f64SMarcel Holtmann __u8 status; 105004837f64SMarcel Holtmann __le16 handle; 105104837f64SMarcel Holtmann __le16 max_tx_latency; 105204837f64SMarcel Holtmann __le16 max_rx_latency; 105304837f64SMarcel Holtmann __le16 max_remote_timeout; 105404837f64SMarcel Holtmann __le16 max_local_timeout; 105566c853ccSGustavo F. Padovan } __packed; 105604837f64SMarcel Holtmann 1057a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 1058a9de9248SMarcel Holtmann struct extended_inquiry_info { 1059a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1060a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1061a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1062a9de9248SMarcel Holtmann __u8 dev_class[3]; 1063a9de9248SMarcel Holtmann __le16 clock_offset; 1064a9de9248SMarcel Holtmann __s8 rssi; 1065a9de9248SMarcel Holtmann __u8 data[240]; 106666c853ccSGustavo F. Padovan } __packed; 1067a9de9248SMarcel Holtmann 10680493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST 0x31 10690493684eSMarcel Holtmann struct hci_ev_io_capa_request { 10700493684eSMarcel Holtmann bdaddr_t bdaddr; 107166c853ccSGustavo F. Padovan } __packed; 10720493684eSMarcel Holtmann 107303b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY 0x32 107403b555e1SJohan Hedberg struct hci_ev_io_capa_reply { 107503b555e1SJohan Hedberg bdaddr_t bdaddr; 107603b555e1SJohan Hedberg __u8 capability; 107703b555e1SJohan Hedberg __u8 oob_data; 107803b555e1SJohan Hedberg __u8 authentication; 107903b555e1SJohan Hedberg } __packed; 108003b555e1SJohan Hedberg 1081a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST 0x33 1082a5c29683SJohan Hedberg struct hci_ev_user_confirm_req { 1083a5c29683SJohan Hedberg bdaddr_t bdaddr; 1084a5c29683SJohan Hedberg __le32 passkey; 1085a5c29683SJohan Hedberg } __packed; 1086a5c29683SJohan Hedberg 10879ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST 0x34 10889ad4019aSBrian Gix struct hci_ev_user_passkey_req { 10899ad4019aSBrian Gix bdaddr_t bdaddr; 10909ad4019aSBrian Gix } __packed; 10919ad4019aSBrian Gix 10922763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 10932763eda6SSzymon Janc struct hci_ev_remote_oob_data_request { 10942763eda6SSzymon Janc bdaddr_t bdaddr; 10952763eda6SSzymon Janc } __packed; 10962763eda6SSzymon Janc 10970493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 10980493684eSMarcel Holtmann struct hci_ev_simple_pair_complete { 10990493684eSMarcel Holtmann __u8 status; 11000493684eSMarcel Holtmann bdaddr_t bdaddr; 110166c853ccSGustavo F. Padovan } __packed; 11020493684eSMarcel Holtmann 110341a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 110441a96212SMarcel Holtmann struct hci_ev_remote_host_features { 110541a96212SMarcel Holtmann bdaddr_t bdaddr; 110641a96212SMarcel Holtmann __u8 features[8]; 110766c853ccSGustavo F. Padovan } __packed; 110841a96212SMarcel Holtmann 110963185f64SVille Tervo #define HCI_EV_LE_META 0x3e 111063185f64SVille Tervo struct hci_ev_le_meta { 111163185f64SVille Tervo __u8 subevent; 111263185f64SVille Tervo } __packed; 111363185f64SVille Tervo 111463185f64SVille Tervo /* Low energy meta events */ 111563185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE 0x01 111663185f64SVille Tervo struct hci_ev_le_conn_complete { 111763185f64SVille Tervo __u8 status; 111863185f64SVille Tervo __le16 handle; 111963185f64SVille Tervo __u8 role; 112063185f64SVille Tervo __u8 bdaddr_type; 112163185f64SVille Tervo bdaddr_t bdaddr; 112263185f64SVille Tervo __le16 interval; 112363185f64SVille Tervo __le16 latency; 112463185f64SVille Tervo __le16 supervision_timeout; 112563185f64SVille Tervo __u8 clk_accurancy; 112663185f64SVille Tervo } __packed; 112763185f64SVille Tervo 1128a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ 0x05 1129a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req { 1130a7a595f6SVinicius Costa Gomes __le16 handle; 1131a7a595f6SVinicius Costa Gomes __u8 random[8]; 1132a7a595f6SVinicius Costa Gomes __le16 ediv; 1133a7a595f6SVinicius Costa Gomes } __packed; 1134a7a595f6SVinicius Costa Gomes 113557a56fd4SAnderson Briglia /* Advertising report event types */ 113657a56fd4SAnderson Briglia #define ADV_IND 0x00 113757a56fd4SAnderson Briglia #define ADV_DIRECT_IND 0x01 113857a56fd4SAnderson Briglia #define ADV_SCAN_IND 0x02 113957a56fd4SAnderson Briglia #define ADV_NONCONN_IND 0x03 114057a56fd4SAnderson Briglia #define ADV_SCAN_RSP 0x04 114157a56fd4SAnderson Briglia 114257a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC 0x00 114357a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM 0x01 114457a56fd4SAnderson Briglia 114557a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT 0x02 114657a56fd4SAnderson Briglia struct hci_ev_le_advertising_info { 114757a56fd4SAnderson Briglia __u8 evt_type; 114857a56fd4SAnderson Briglia __u8 bdaddr_type; 114957a56fd4SAnderson Briglia bdaddr_t bdaddr; 115057a56fd4SAnderson Briglia __u8 length; 115157a56fd4SAnderson Briglia __u8 data[0]; 115257a56fd4SAnderson Briglia } __packed; 115357a56fd4SAnderson Briglia 11541da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 1155a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 11561da177e4SLinus Torvalds struct hci_ev_stack_internal { 11571da177e4SLinus Torvalds __u16 type; 11581da177e4SLinus Torvalds __u8 data[0]; 115966c853ccSGustavo F. Padovan } __packed; 11601da177e4SLinus Torvalds 11611da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 11621da177e4SLinus Torvalds struct hci_ev_si_device { 11631da177e4SLinus Torvalds __u16 event; 11641da177e4SLinus Torvalds __u16 dev_id; 116566c853ccSGustavo F. Padovan } __packed; 11661da177e4SLinus Torvalds 11671da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 11681da177e4SLinus Torvalds struct hci_ev_si_security { 11691da177e4SLinus Torvalds __u16 event; 11701da177e4SLinus Torvalds __u16 proto; 11711da177e4SLinus Torvalds __u16 subproto; 11721da177e4SLinus Torvalds __u8 incoming; 117366c853ccSGustavo F. Padovan } __packed; 11741da177e4SLinus Torvalds 11751da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 11761da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 11771da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 11781da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 11791da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 11801da177e4SLinus Torvalds 11811da177e4SLinus Torvalds struct hci_command_hdr { 11821ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 11831da177e4SLinus Torvalds __u8 plen; 118466c853ccSGustavo F. Padovan } __packed; 11851da177e4SLinus Torvalds 11861da177e4SLinus Torvalds struct hci_event_hdr { 11871da177e4SLinus Torvalds __u8 evt; 11881da177e4SLinus Torvalds __u8 plen; 118966c853ccSGustavo F. Padovan } __packed; 11901da177e4SLinus Torvalds 11911da177e4SLinus Torvalds struct hci_acl_hdr { 11921ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 11931ebb9252SMarcel Holtmann __le16 dlen; 119466c853ccSGustavo F. Padovan } __packed; 11951da177e4SLinus Torvalds 11961da177e4SLinus Torvalds struct hci_sco_hdr { 11971ebb9252SMarcel Holtmann __le16 handle; 11981da177e4SLinus Torvalds __u8 dlen; 119966c853ccSGustavo F. Padovan } __packed; 12001da177e4SLinus Torvalds 12012a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h> 12022a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 12032a123b86SArnaldo Carvalho de Melo { 12042a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 12052a123b86SArnaldo Carvalho de Melo } 12062a123b86SArnaldo Carvalho de Melo 12072a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 12082a123b86SArnaldo Carvalho de Melo { 12092a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 12102a123b86SArnaldo Carvalho de Melo } 12112a123b86SArnaldo Carvalho de Melo 12122a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 12132a123b86SArnaldo Carvalho de Melo { 12142a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 12152a123b86SArnaldo Carvalho de Melo } 12162a123b86SArnaldo Carvalho de Melo 12171da177e4SLinus Torvalds /* Command opcode pack/unpack */ 12181da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 12191da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 12201da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 12211da177e4SLinus Torvalds 12221da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 12231da177e4SLinus Torvalds #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) 12241da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 12251da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 12261da177e4SLinus Torvalds 12271da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 12281da177e4SLinus Torvalds 12291da177e4SLinus Torvalds /* Socket options */ 12301da177e4SLinus Torvalds #define HCI_DATA_DIR 1 12311da177e4SLinus Torvalds #define HCI_FILTER 2 12321da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 12331da177e4SLinus Torvalds 12341da177e4SLinus Torvalds /* CMSG flags */ 12351da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 12361da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 12371da177e4SLinus Torvalds 12381da177e4SLinus Torvalds struct sockaddr_hci { 12391da177e4SLinus Torvalds sa_family_t hci_family; 12401da177e4SLinus Torvalds unsigned short hci_dev; 1241c02178d2SJohan Hedberg unsigned short hci_channel; 12421da177e4SLinus Torvalds }; 12431da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 12441da177e4SLinus Torvalds 1245c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW 0 1246c02178d2SJohan Hedberg #define HCI_CHANNEL_CONTROL 1 1247c02178d2SJohan Hedberg 12481da177e4SLinus Torvalds struct hci_filter { 12491da177e4SLinus Torvalds unsigned long type_mask; 12501da177e4SLinus Torvalds unsigned long event_mask[2]; 1251905f3ed6SAl Viro __le16 opcode; 12521da177e4SLinus Torvalds }; 12531da177e4SLinus Torvalds 12541da177e4SLinus Torvalds struct hci_ufilter { 12551da177e4SLinus Torvalds __u32 type_mask; 12561da177e4SLinus Torvalds __u32 event_mask[2]; 1257905f3ed6SAl Viro __le16 opcode; 12581da177e4SLinus Torvalds }; 12591da177e4SLinus Torvalds 12601da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 12611da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 12621da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 12631da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 12641da177e4SLinus Torvalds 12651da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 12661da177e4SLinus Torvalds struct hci_dev_stats { 12671da177e4SLinus Torvalds __u32 err_rx; 12681da177e4SLinus Torvalds __u32 err_tx; 12691da177e4SLinus Torvalds __u32 cmd_tx; 12701da177e4SLinus Torvalds __u32 evt_rx; 12711da177e4SLinus Torvalds __u32 acl_tx; 12721da177e4SLinus Torvalds __u32 acl_rx; 12731da177e4SLinus Torvalds __u32 sco_tx; 12741da177e4SLinus Torvalds __u32 sco_rx; 12751da177e4SLinus Torvalds __u32 byte_rx; 12761da177e4SLinus Torvalds __u32 byte_tx; 12771da177e4SLinus Torvalds }; 12781da177e4SLinus Torvalds 12791da177e4SLinus Torvalds struct hci_dev_info { 12801da177e4SLinus Torvalds __u16 dev_id; 12811da177e4SLinus Torvalds char name[8]; 12821da177e4SLinus Torvalds 12831da177e4SLinus Torvalds bdaddr_t bdaddr; 12841da177e4SLinus Torvalds 12851da177e4SLinus Torvalds __u32 flags; 12861da177e4SLinus Torvalds __u8 type; 12871da177e4SLinus Torvalds 12881da177e4SLinus Torvalds __u8 features[8]; 12891da177e4SLinus Torvalds 12901da177e4SLinus Torvalds __u32 pkt_type; 12911da177e4SLinus Torvalds __u32 link_policy; 12921da177e4SLinus Torvalds __u32 link_mode; 12931da177e4SLinus Torvalds 12941da177e4SLinus Torvalds __u16 acl_mtu; 12951da177e4SLinus Torvalds __u16 acl_pkts; 12961da177e4SLinus Torvalds __u16 sco_mtu; 12971da177e4SLinus Torvalds __u16 sco_pkts; 12981da177e4SLinus Torvalds 12991da177e4SLinus Torvalds struct hci_dev_stats stat; 13001da177e4SLinus Torvalds }; 13011da177e4SLinus Torvalds 13021da177e4SLinus Torvalds struct hci_conn_info { 13031da177e4SLinus Torvalds __u16 handle; 13041da177e4SLinus Torvalds bdaddr_t bdaddr; 13051da177e4SLinus Torvalds __u8 type; 13061da177e4SLinus Torvalds __u8 out; 13071da177e4SLinus Torvalds __u16 state; 13081da177e4SLinus Torvalds __u32 link_mode; 13091da177e4SLinus Torvalds }; 13101da177e4SLinus Torvalds 13111da177e4SLinus Torvalds struct hci_dev_req { 13121da177e4SLinus Torvalds __u16 dev_id; 13131da177e4SLinus Torvalds __u32 dev_opt; 13141da177e4SLinus Torvalds }; 13151da177e4SLinus Torvalds 13161da177e4SLinus Torvalds struct hci_dev_list_req { 13171da177e4SLinus Torvalds __u16 dev_num; 13181da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 13191da177e4SLinus Torvalds }; 13201da177e4SLinus Torvalds 13211da177e4SLinus Torvalds struct hci_conn_list_req { 13221da177e4SLinus Torvalds __u16 dev_id; 13231da177e4SLinus Torvalds __u16 conn_num; 13241da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 13251da177e4SLinus Torvalds }; 13261da177e4SLinus Torvalds 13271da177e4SLinus Torvalds struct hci_conn_info_req { 13281da177e4SLinus Torvalds bdaddr_t bdaddr; 13291da177e4SLinus Torvalds __u8 type; 13301da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 13311da177e4SLinus Torvalds }; 13321da177e4SLinus Torvalds 133340be492fSMarcel Holtmann struct hci_auth_info_req { 133440be492fSMarcel Holtmann bdaddr_t bdaddr; 133540be492fSMarcel Holtmann __u8 type; 133640be492fSMarcel Holtmann }; 133740be492fSMarcel Holtmann 13381da177e4SLinus Torvalds struct hci_inquiry_req { 13391da177e4SLinus Torvalds __u16 dev_id; 13401da177e4SLinus Torvalds __u16 flags; 13411da177e4SLinus Torvalds __u8 lap[3]; 13421da177e4SLinus Torvalds __u8 length; 13431da177e4SLinus Torvalds __u8 num_rsp; 13441da177e4SLinus Torvalds }; 13451da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 13461da177e4SLinus Torvalds 1347*8830f514SAndrei Emeltchenko extern int enable_hs; 1348*8830f514SAndrei Emeltchenko 13491da177e4SLinus Torvalds #endif /* __HCI_H */ 1350