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 91d23264a8SAndre Guedes /* 92d23264a8SAndre Guedes * BR/EDR and/or LE controller flags: the flags defined here should represent 93d23264a8SAndre Guedes * states from the controller. 94d23264a8SAndre Guedes */ 95d23264a8SAndre Guedes enum { 96d23264a8SAndre Guedes HCI_LE_SCAN, 97d23264a8SAndre Guedes }; 98d23264a8SAndre Guedes 991da177e4SLinus Torvalds /* HCI ioctl defines */ 1001da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 1011da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 1021da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 1031da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 1041da177e4SLinus Torvalds 1051da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 1061da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 1071da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 1081da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 10940be492fSMarcel Holtmann #define HCIGETAUTHINFO _IOR('H', 215, int) 1101da177e4SLinus Torvalds 1111da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 1121da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 1131da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 1141da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 1151da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 1161da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 1171da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 1181da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 1191da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 1201da177e4SLinus Torvalds 121f0358568SJohan Hedberg #define HCIBLOCKADDR _IOW('H', 230, int) 122f0358568SJohan Hedberg #define HCIUNBLOCKADDR _IOW('H', 231, int) 123f0358568SJohan Hedberg 1241da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1251da177e4SLinus Torvalds 1261da177e4SLinus Torvalds /* HCI timeouts */ 12704837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 12804837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 129052b30b0SMarcel Holtmann #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 13004837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 13104837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 1326bd32326SVille Tervo #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 1331da177e4SLinus Torvalds 1345b7f9909SMarcel Holtmann /* HCI data types */ 1351da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1361da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1371da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1381da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1391da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1401da177e4SLinus Torvalds 1415b7f9909SMarcel Holtmann /* HCI packet types */ 1421da177e4SLinus Torvalds #define HCI_DM1 0x0008 1431da177e4SLinus Torvalds #define HCI_DM3 0x0400 1441da177e4SLinus Torvalds #define HCI_DM5 0x4000 1451da177e4SLinus Torvalds #define HCI_DH1 0x0010 1461da177e4SLinus Torvalds #define HCI_DH3 0x0800 1471da177e4SLinus Torvalds #define HCI_DH5 0x8000 1481da177e4SLinus Torvalds 1491da177e4SLinus Torvalds #define HCI_HV1 0x0020 1501da177e4SLinus Torvalds #define HCI_HV2 0x0040 1511da177e4SLinus Torvalds #define HCI_HV3 0x0080 1521da177e4SLinus Torvalds 1531da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1541da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1551da177e4SLinus Torvalds 1565b7f9909SMarcel Holtmann /* eSCO packet types */ 1575b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1585b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1595b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1605b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1615b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1625b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 163efc7688bSMarcel Holtmann #define ESCO_2EV3 0x0040 164efc7688bSMarcel Holtmann #define ESCO_3EV3 0x0080 165efc7688bSMarcel Holtmann #define ESCO_2EV5 0x0100 166efc7688bSMarcel Holtmann #define ESCO_3EV5 0x0200 1675b7f9909SMarcel Holtmann 168a8746417SMarcel Holtmann #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 169efc7688bSMarcel Holtmann #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 170a8746417SMarcel Holtmann 1711da177e4SLinus Torvalds /* ACL flags */ 172e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH 0x00 1731da177e4SLinus Torvalds #define ACL_CONT 0x01 1741da177e4SLinus Torvalds #define ACL_START 0x02 1751da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 1761da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 1771da177e4SLinus Torvalds 1781da177e4SLinus Torvalds /* Baseband links */ 1791da177e4SLinus Torvalds #define SCO_LINK 0x00 1801da177e4SLinus Torvalds #define ACL_LINK 0x01 1815b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 182fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */ 183fcd89c09SVille Tervo #define LE_LINK 0x80 1841da177e4SLinus Torvalds 1851da177e4SLinus Torvalds /* LMP features */ 1861da177e4SLinus Torvalds #define LMP_3SLOT 0x01 1871da177e4SLinus Torvalds #define LMP_5SLOT 0x02 1881da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 1891da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 1901da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 1911da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 1921da177e4SLinus Torvalds #define LMP_HOLD 0x40 19304837f64SMarcel Holtmann #define LMP_SNIFF 0x80 1941da177e4SLinus Torvalds 1951da177e4SLinus Torvalds #define LMP_PARK 0x01 1961da177e4SLinus Torvalds #define LMP_RSSI 0x02 1971da177e4SLinus Torvalds #define LMP_QUALITY 0x04 1981da177e4SLinus Torvalds #define LMP_SCO 0x08 1991da177e4SLinus Torvalds #define LMP_HV2 0x10 2001da177e4SLinus Torvalds #define LMP_HV3 0x20 2011da177e4SLinus Torvalds #define LMP_ULAW 0x40 2021da177e4SLinus Torvalds #define LMP_ALAW 0x80 2031da177e4SLinus Torvalds 2041da177e4SLinus Torvalds #define LMP_CVSD 0x01 2051da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 2061da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 2071da177e4SLinus Torvalds 208d5859e22SJohan Hedberg #define LMP_RSSI_INQ 0x40 2095b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 2105b7f9909SMarcel Holtmann 2115b7f9909SMarcel Holtmann #define LMP_EV4 0x01 2125b7f9909SMarcel Holtmann #define LMP_EV5 0x02 213*69ab39eaSJohan Hedberg #define LMP_NO_BREDR 0x20 214d5859e22SJohan Hedberg #define LMP_LE 0x40 2155b7f9909SMarcel Holtmann 21604837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 217d5859e22SJohan Hedberg #define LMP_PAUSE_ENC 0x04 218efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M 0x20 219efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M 0x40 220efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO 0x80 22104837f64SMarcel Holtmann 222d5859e22SJohan Hedberg #define LMP_EXT_INQ 0x01 223e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR 0x02 224769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR 0x08 225e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH 0x40 226769be974SMarcel Holtmann 227d5859e22SJohan Hedberg #define LMP_LSTO 0x01 228d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR 0x02 229971e3a4bSAndre Guedes #define LMP_EXTFEATURES 0x80 230d5859e22SJohan Hedberg 231eead27daSAndre Guedes /* Extended LMP features */ 232eead27daSAndre Guedes #define LMP_HOST_LE 0x02 233eead27daSAndre Guedes 23404837f64SMarcel Holtmann /* Connection modes */ 23504837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 23604837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 23704837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 23804837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 23904837f64SMarcel Holtmann 2401da177e4SLinus Torvalds /* Link policies */ 2411da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 2421da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 2431da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 2441da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 2451da177e4SLinus Torvalds 24604837f64SMarcel Holtmann /* Link modes */ 2471da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 2481da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 2491da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 2501da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 2511da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 2521da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2531da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2541da177e4SLinus Torvalds 25540be492fSMarcel Holtmann /* Authentication types */ 25640be492fSMarcel Holtmann #define HCI_AT_NO_BONDING 0x00 25740be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM 0x01 25840be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING 0x02 25940be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM 0x03 26040be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING 0x04 26140be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM 0x05 26240be492fSMarcel Holtmann 263b6020ba0SWaldemar Rymarkiewicz /* Link Key types */ 264b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION 0x00 265b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT 0x01 266b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT 0x02 267b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION 0x03 268b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION 0x04 269b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION 0x05 270b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION 0x06 27134918cd7SVinicius Costa Gomes /* The spec doesn't define types for SMP keys */ 27234918cd7SVinicius Costa Gomes #define HCI_LK_SMP_LTK 0x81 27334918cd7SVinicius Costa Gomes #define HCI_LK_SMP_IRK 0x82 27434918cd7SVinicius Costa Gomes #define HCI_LK_SMP_CSRK 0x83 275b6020ba0SWaldemar Rymarkiewicz 2769f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */ 2779f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE 0x05 2789f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR 0x0f 2799f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM 0x13 2809f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM 0x16 2819f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 2829f5a0d7bSAndrei Emeltchenko 2831da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 2846bd32326SVille Tervo #define HCI_OP_NOP 0x0000 2856bd32326SVille Tervo 286a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 287a9de9248SMarcel Holtmann struct hci_cp_inquiry { 288a9de9248SMarcel Holtmann __u8 lap[3]; 289a9de9248SMarcel Holtmann __u8 length; 290a9de9248SMarcel Holtmann __u8 num_rsp; 29166c853ccSGustavo F. Padovan } __packed; 2921da177e4SLinus Torvalds 293a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 294a9de9248SMarcel Holtmann 295a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 296a9de9248SMarcel Holtmann 297a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 298a9de9248SMarcel Holtmann struct hci_cp_create_conn { 299a9de9248SMarcel Holtmann bdaddr_t bdaddr; 300a9de9248SMarcel Holtmann __le16 pkt_type; 301a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 302a9de9248SMarcel Holtmann __u8 pscan_mode; 303a9de9248SMarcel Holtmann __le16 clock_offset; 304a9de9248SMarcel Holtmann __u8 role_switch; 30566c853ccSGustavo F. Padovan } __packed; 3061da177e4SLinus Torvalds 307a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 308a9de9248SMarcel Holtmann struct hci_cp_disconnect { 309a9de9248SMarcel Holtmann __le16 handle; 310a9de9248SMarcel Holtmann __u8 reason; 31166c853ccSGustavo F. Padovan } __packed; 3121da177e4SLinus Torvalds 313a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 314a9de9248SMarcel Holtmann struct hci_cp_add_sco { 315a9de9248SMarcel Holtmann __le16 handle; 316a9de9248SMarcel Holtmann __le16 pkt_type; 31766c853ccSGustavo F. Padovan } __packed; 318a9de9248SMarcel Holtmann 319a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 320a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 3211da177e4SLinus Torvalds bdaddr_t bdaddr; 32266c853ccSGustavo F. Padovan } __packed; 3231da177e4SLinus Torvalds 324a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 325a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 326a9de9248SMarcel Holtmann bdaddr_t bdaddr; 327a9de9248SMarcel Holtmann __u8 role; 32866c853ccSGustavo F. Padovan } __packed; 3291da177e4SLinus Torvalds 330a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 331a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 332a9de9248SMarcel Holtmann bdaddr_t bdaddr; 333a9de9248SMarcel Holtmann __u8 reason; 33466c853ccSGustavo F. Padovan } __packed; 3351da177e4SLinus Torvalds 336a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 337a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 338a9de9248SMarcel Holtmann bdaddr_t bdaddr; 339a9de9248SMarcel Holtmann __u8 link_key[16]; 34066c853ccSGustavo F. Padovan } __packed; 3411da177e4SLinus Torvalds 342a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 343a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 344a9de9248SMarcel Holtmann bdaddr_t bdaddr; 34566c853ccSGustavo F. Padovan } __packed; 3461da177e4SLinus Torvalds 347a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 348a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 349a9de9248SMarcel Holtmann bdaddr_t bdaddr; 350a9de9248SMarcel Holtmann __u8 pin_len; 351a9de9248SMarcel Holtmann __u8 pin_code[16]; 35266c853ccSGustavo F. Padovan } __packed; 353980e1a53SJohan Hedberg struct hci_rp_pin_code_reply { 354980e1a53SJohan Hedberg __u8 status; 355980e1a53SJohan Hedberg bdaddr_t bdaddr; 356980e1a53SJohan Hedberg } __packed; 357a9de9248SMarcel Holtmann 358a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 359a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 360a9de9248SMarcel Holtmann bdaddr_t bdaddr; 36166c853ccSGustavo F. Padovan } __packed; 362980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply { 363980e1a53SJohan Hedberg __u8 status; 364980e1a53SJohan Hedberg bdaddr_t bdaddr; 365980e1a53SJohan Hedberg } __packed; 366a9de9248SMarcel Holtmann 367a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 368a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 369a9de9248SMarcel Holtmann __le16 handle; 370a9de9248SMarcel Holtmann __le16 pkt_type; 37166c853ccSGustavo F. Padovan } __packed; 372a9de9248SMarcel Holtmann 373a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 374a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 375a9de9248SMarcel Holtmann __le16 handle; 37666c853ccSGustavo F. Padovan } __packed; 377a9de9248SMarcel Holtmann 378a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 379a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 380a9de9248SMarcel Holtmann __le16 handle; 381a9de9248SMarcel Holtmann __u8 encrypt; 38266c853ccSGustavo F. Padovan } __packed; 383a9de9248SMarcel Holtmann 384a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 385a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 386a9de9248SMarcel Holtmann __le16 handle; 38766c853ccSGustavo F. Padovan } __packed; 388a9de9248SMarcel Holtmann 389a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 390a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 391a9de9248SMarcel Holtmann bdaddr_t bdaddr; 392a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 393a9de9248SMarcel Holtmann __u8 pscan_mode; 394a9de9248SMarcel Holtmann __le16 clock_offset; 39566c853ccSGustavo F. Padovan } __packed; 396a9de9248SMarcel Holtmann 397a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 398a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 399a9de9248SMarcel Holtmann bdaddr_t bdaddr; 40066c853ccSGustavo F. Padovan } __packed; 401a9de9248SMarcel Holtmann 402a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 403a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 404a9de9248SMarcel Holtmann __le16 handle; 40566c853ccSGustavo F. Padovan } __packed; 406a9de9248SMarcel Holtmann 407a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 408a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 409a9de9248SMarcel Holtmann __le16 handle; 410a9de9248SMarcel Holtmann __u8 page; 41166c853ccSGustavo F. Padovan } __packed; 412a9de9248SMarcel Holtmann 413a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 414a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 415a9de9248SMarcel Holtmann __le16 handle; 41666c853ccSGustavo F. Padovan } __packed; 417a9de9248SMarcel Holtmann 418a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 419a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 420a9de9248SMarcel Holtmann __le16 handle; 421a9de9248SMarcel Holtmann __le32 tx_bandwidth; 422a9de9248SMarcel Holtmann __le32 rx_bandwidth; 423a9de9248SMarcel Holtmann __le16 max_latency; 424a9de9248SMarcel Holtmann __le16 voice_setting; 425a9de9248SMarcel Holtmann __u8 retrans_effort; 426a9de9248SMarcel Holtmann __le16 pkt_type; 42766c853ccSGustavo F. Padovan } __packed; 428a9de9248SMarcel Holtmann 429a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 430a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 431a9de9248SMarcel Holtmann bdaddr_t bdaddr; 432a9de9248SMarcel Holtmann __le32 tx_bandwidth; 433a9de9248SMarcel Holtmann __le32 rx_bandwidth; 434a9de9248SMarcel Holtmann __le16 max_latency; 435a9de9248SMarcel Holtmann __le16 content_format; 436a9de9248SMarcel Holtmann __u8 retrans_effort; 437a9de9248SMarcel Holtmann __le16 pkt_type; 43866c853ccSGustavo F. Padovan } __packed; 439a9de9248SMarcel Holtmann 440a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 441a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 442a9de9248SMarcel Holtmann bdaddr_t bdaddr; 443a9de9248SMarcel Holtmann __u8 reason; 44466c853ccSGustavo F. Padovan } __packed; 445a9de9248SMarcel Holtmann 44617fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY 0x042b 44717fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply { 44817fa4b9dSJohan Hedberg bdaddr_t bdaddr; 44917fa4b9dSJohan Hedberg __u8 capability; 45017fa4b9dSJohan Hedberg __u8 oob_data; 45117fa4b9dSJohan Hedberg __u8 authentication; 45217fa4b9dSJohan Hedberg } __packed; 45317fa4b9dSJohan Hedberg 454a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY 0x042c 455a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply { 456a5c29683SJohan Hedberg bdaddr_t bdaddr; 457a5c29683SJohan Hedberg } __packed; 458a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply { 459a5c29683SJohan Hedberg __u8 status; 460a5c29683SJohan Hedberg bdaddr_t bdaddr; 461a5c29683SJohan Hedberg } __packed; 462a5c29683SJohan Hedberg 463a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 464a5c29683SJohan Hedberg 4659ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY 0x042e 4669ad4019aSBrian Gix struct hci_cp_user_passkey_reply { 4679ad4019aSBrian Gix bdaddr_t bdaddr; 4689ad4019aSBrian Gix __le32 passkey; 4699ad4019aSBrian Gix } __packed; 4709ad4019aSBrian Gix 4719ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f 4729ad4019aSBrian Gix 4732763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 4742763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply { 4752763eda6SSzymon Janc bdaddr_t bdaddr; 4762763eda6SSzymon Janc __u8 hash[16]; 4772763eda6SSzymon Janc __u8 randomizer[16]; 4782763eda6SSzymon Janc } __packed; 4792763eda6SSzymon Janc 4802763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 4812763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply { 4822763eda6SSzymon Janc bdaddr_t bdaddr; 4832763eda6SSzymon Janc } __packed; 4842763eda6SSzymon Janc 48503b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 48603b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply { 48703b555e1SJohan Hedberg bdaddr_t bdaddr; 48803b555e1SJohan Hedberg __u8 reason; 48903b555e1SJohan Hedberg } __packed; 49003b555e1SJohan Hedberg 491a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 492a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 493a9de9248SMarcel Holtmann __le16 handle; 494a9de9248SMarcel Holtmann __le16 max_interval; 495a9de9248SMarcel Holtmann __le16 min_interval; 496a9de9248SMarcel Holtmann __le16 attempt; 497a9de9248SMarcel Holtmann __le16 timeout; 49866c853ccSGustavo F. Padovan } __packed; 499a9de9248SMarcel Holtmann 500a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 501a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 502a9de9248SMarcel Holtmann __le16 handle; 50366c853ccSGustavo F. Padovan } __packed; 504a9de9248SMarcel Holtmann 505a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 506a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 507a9de9248SMarcel Holtmann __le16 handle; 50866c853ccSGustavo F. Padovan } __packed; 509a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 510a9de9248SMarcel Holtmann __u8 status; 511a9de9248SMarcel Holtmann __le16 handle; 512a9de9248SMarcel Holtmann __u8 role; 51366c853ccSGustavo F. Padovan } __packed; 514a9de9248SMarcel Holtmann 515a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 516a9de9248SMarcel Holtmann struct hci_cp_switch_role { 517a9de9248SMarcel Holtmann bdaddr_t bdaddr; 518a9de9248SMarcel Holtmann __u8 role; 51966c853ccSGustavo F. Padovan } __packed; 520a9de9248SMarcel Holtmann 521a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 522a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 523a9de9248SMarcel Holtmann __le16 handle; 52466c853ccSGustavo F. Padovan } __packed; 525a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 526a9de9248SMarcel Holtmann __u8 status; 527a9de9248SMarcel Holtmann __le16 handle; 528a9de9248SMarcel Holtmann __le16 policy; 52966c853ccSGustavo F. Padovan } __packed; 530a9de9248SMarcel Holtmann 531a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 532a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 533a9de9248SMarcel Holtmann __le16 handle; 534a9de9248SMarcel Holtmann __le16 policy; 53566c853ccSGustavo F. Padovan } __packed; 536a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 537a9de9248SMarcel Holtmann __u8 status; 538a9de9248SMarcel Holtmann __le16 handle; 53966c853ccSGustavo F. Padovan } __packed; 540a9de9248SMarcel Holtmann 541e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 542e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy { 543e4e8e37cSMarcel Holtmann __u8 status; 544e4e8e37cSMarcel Holtmann __le16 policy; 54566c853ccSGustavo F. Padovan } __packed; 546e4e8e37cSMarcel Holtmann 547e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 548e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy { 549e4e8e37cSMarcel Holtmann __le16 policy; 55066c853ccSGustavo F. Padovan } __packed; 551e4e8e37cSMarcel Holtmann 552a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 553a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 554a9de9248SMarcel Holtmann __le16 handle; 555a9de9248SMarcel Holtmann __le16 max_latency; 556a9de9248SMarcel Holtmann __le16 min_remote_timeout; 557a9de9248SMarcel Holtmann __le16 min_local_timeout; 55866c853ccSGustavo F. Padovan } __packed; 559a9de9248SMarcel Holtmann 560a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 561a9de9248SMarcel Holtmann struct hci_cp_set_event_mask { 562a9de9248SMarcel Holtmann __u8 mask[8]; 56366c853ccSGustavo F. Padovan } __packed; 564a9de9248SMarcel Holtmann 565a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 566a9de9248SMarcel Holtmann 567a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 5681da177e4SLinus Torvalds struct hci_cp_set_event_flt { 5691da177e4SLinus Torvalds __u8 flt_type; 5701da177e4SLinus Torvalds __u8 cond_type; 5711da177e4SLinus Torvalds __u8 condition[0]; 57266c853ccSGustavo F. Padovan } __packed; 5731da177e4SLinus Torvalds 5741da177e4SLinus Torvalds /* Filter types */ 5751da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 5761da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 5771da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 5781da177e4SLinus Torvalds 5791da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 5801da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 5811da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 5821da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 5831da177e4SLinus Torvalds 5841da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 5851da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 5861da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 5871da177e4SLinus Torvalds 588b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 589b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key { 590b0916ea0SJohan Hedberg bdaddr_t bdaddr; 591b0916ea0SJohan Hedberg __u8 delete_all; 592b0916ea0SJohan Hedberg } __packed; 593b0916ea0SJohan Hedberg 5941f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH 248 5951f6c6378SJohan Hedberg 596a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 597a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 5981f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 59966c853ccSGustavo F. Padovan } __packed; 600a9de9248SMarcel Holtmann 601a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 602a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 603a9de9248SMarcel Holtmann __u8 status; 6041f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 60566c853ccSGustavo F. Padovan } __packed; 606a9de9248SMarcel Holtmann 607a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 608a9de9248SMarcel Holtmann 609a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 610a9de9248SMarcel Holtmann 611a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 612a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 613a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 614a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 615a9de9248SMarcel Holtmann 616a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 617a9de9248SMarcel Holtmann 618a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 619a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 620a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 621a9de9248SMarcel Holtmann 622a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 623a9de9248SMarcel Holtmann 624a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 625a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 626a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 627a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 628a9de9248SMarcel Holtmann 629a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 630a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 6311da177e4SLinus Torvalds __u8 status; 6321da177e4SLinus Torvalds __u8 dev_class[3]; 63366c853ccSGustavo F. Padovan } __packed; 6341da177e4SLinus Torvalds 635a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 636a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 6371da177e4SLinus Torvalds __u8 dev_class[3]; 63866c853ccSGustavo F. Padovan } __packed; 6391da177e4SLinus Torvalds 640a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 6411da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 6421da177e4SLinus Torvalds __u8 status; 6431ebb9252SMarcel Holtmann __le16 voice_setting; 64466c853ccSGustavo F. Padovan } __packed; 6451da177e4SLinus Torvalds 646a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 6471da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 6481ebb9252SMarcel Holtmann __le16 voice_setting; 64966c853ccSGustavo F. Padovan } __packed; 6501da177e4SLinus Torvalds 651a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 6521da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 6531ebb9252SMarcel Holtmann __le16 acl_mtu; 6541da177e4SLinus Torvalds __u8 sco_mtu; 6551ebb9252SMarcel Holtmann __le16 acl_max_pkt; 6561ebb9252SMarcel Holtmann __le16 sco_max_pkt; 65766c853ccSGustavo F. Padovan } __packed; 6581da177e4SLinus Torvalds 659d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 660d5859e22SJohan Hedberg 66180a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH 240 66280a1e1dbSJohan Hedberg 66380a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR 0x0c52 66480a1e1dbSJohan Hedberg struct hci_cp_write_eir { 66580a1e1dbSJohan Hedberg uint8_t fec; 66680a1e1dbSJohan Hedberg uint8_t data[HCI_MAX_EIR_LENGTH]; 66780a1e1dbSJohan Hedberg } __packed; 66880a1e1dbSJohan Hedberg 669333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE 0x0c55 670333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode { 671333140b5SMarcel Holtmann __u8 status; 672333140b5SMarcel Holtmann __u8 mode; 67366c853ccSGustavo F. Padovan } __packed; 674333140b5SMarcel Holtmann 675333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE 0x0c56 676333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode { 677333140b5SMarcel Holtmann __u8 mode; 67866c853ccSGustavo F. Padovan } __packed; 679333140b5SMarcel Holtmann 680c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 681c35938b2SSzymon Janc struct hci_rp_read_local_oob_data { 682c35938b2SSzymon Janc __u8 status; 683c35938b2SSzymon Janc __u8 hash[16]; 684c35938b2SSzymon Janc __u8 randomizer[16]; 685c35938b2SSzymon Janc } __packed; 686c35938b2SSzymon Janc 687d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 688d5859e22SJohan Hedberg 6891e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 6901e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode { 6911e89cffbSAndrei Emeltchenko __u8 status; 6921e89cffbSAndrei Emeltchenko __u8 mode; 6931e89cffbSAndrei Emeltchenko } __packed; 6941e89cffbSAndrei Emeltchenko 695f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 696f9b49306SAndre Guedes struct hci_cp_write_le_host_supported { 697f9b49306SAndre Guedes __u8 le; 698f9b49306SAndre Guedes __u8 simul; 699f9b49306SAndre Guedes } __packed; 700f9b49306SAndre Guedes 701a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 702a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 7031da177e4SLinus Torvalds __u8 status; 704a9de9248SMarcel Holtmann __u8 hci_ver; 705a9de9248SMarcel Holtmann __le16 hci_rev; 706a9de9248SMarcel Holtmann __u8 lmp_ver; 707a9de9248SMarcel Holtmann __le16 manufacturer; 708a9de9248SMarcel Holtmann __le16 lmp_subver; 70966c853ccSGustavo F. Padovan } __packed; 7101da177e4SLinus Torvalds 711a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 712a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 7131da177e4SLinus Torvalds __u8 status; 714a9de9248SMarcel Holtmann __u8 commands[64]; 71566c853ccSGustavo F. Padovan } __packed; 7161da177e4SLinus Torvalds 717a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 718a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 719a9de9248SMarcel Holtmann __u8 status; 720a9de9248SMarcel Holtmann __u8 features[8]; 72166c853ccSGustavo F. Padovan } __packed; 722a9de9248SMarcel Holtmann 723a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 724971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features { 725971e3a4bSAndre Guedes __u8 page; 726971e3a4bSAndre Guedes } __packed; 727a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 728a9de9248SMarcel Holtmann __u8 status; 729a9de9248SMarcel Holtmann __u8 page; 730a9de9248SMarcel Holtmann __u8 max_page; 731a9de9248SMarcel Holtmann __u8 features[8]; 73266c853ccSGustavo F. Padovan } __packed; 733a9de9248SMarcel Holtmann 734a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 735a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 736a9de9248SMarcel Holtmann __u8 status; 737a9de9248SMarcel Holtmann __le16 acl_mtu; 738a9de9248SMarcel Holtmann __u8 sco_mtu; 739a9de9248SMarcel Holtmann __le16 acl_max_pkt; 740a9de9248SMarcel Holtmann __le16 sco_max_pkt; 74166c853ccSGustavo F. Padovan } __packed; 742a9de9248SMarcel Holtmann 743a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 744a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 745a9de9248SMarcel Holtmann __u8 status; 7461da177e4SLinus Torvalds bdaddr_t bdaddr; 74766c853ccSGustavo F. Padovan } __packed; 7481da177e4SLinus Torvalds 749f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 750f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity { 751f6422ec6SAntti Julku __le16 interval; 752f6422ec6SAntti Julku __le16 window; 753f6422ec6SAntti Julku } __packed; 754f6422ec6SAntti Julku 755f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 756f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_STANDARD 0x00 757f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_INTERLACED 0x01 758f6422ec6SAntti Julku 759928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 760928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info { 761928abaa7SAndrei Emeltchenko __u8 status; 762928abaa7SAndrei Emeltchenko __u8 amp_status; 763928abaa7SAndrei Emeltchenko __le32 total_bw; 764928abaa7SAndrei Emeltchenko __le32 max_bw; 765928abaa7SAndrei Emeltchenko __le32 min_latency; 766928abaa7SAndrei Emeltchenko __le32 max_pdu; 767928abaa7SAndrei Emeltchenko __u8 amp_type; 768928abaa7SAndrei Emeltchenko __le16 pal_cap; 769928abaa7SAndrei Emeltchenko __le16 max_assoc_size; 770928abaa7SAndrei Emeltchenko __le32 max_flush_to; 771928abaa7SAndrei Emeltchenko __le32 be_flush_to; 772928abaa7SAndrei Emeltchenko } __packed; 773928abaa7SAndrei Emeltchenko 77463185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK 0x2001 77563185f64SVille Tervo struct hci_cp_le_set_event_mask { 77663185f64SVille Tervo __u8 mask[8]; 77763185f64SVille Tervo } __packed; 77863185f64SVille Tervo 77963185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 78063185f64SVille Tervo struct hci_rp_le_read_buffer_size { 78163185f64SVille Tervo __u8 status; 78263185f64SVille Tervo __le16 le_mtu; 78363185f64SVille Tervo __u8 le_max_pkt; 78463185f64SVille Tervo } __packed; 78563185f64SVille Tervo 78607f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM 0x200b 78707f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param { 78807f7fa5dSAndre Guedes __u8 type; 78907f7fa5dSAndre Guedes __le16 interval; 79007f7fa5dSAndre Guedes __le16 window; 79107f7fa5dSAndre Guedes __u8 own_address_type; 79207f7fa5dSAndre Guedes __u8 filter_policy; 79307f7fa5dSAndre Guedes } __packed; 79407f7fa5dSAndre Guedes 795eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 796eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable { 797eb9d91f5SAndre Guedes __u8 enable; 798eb9d91f5SAndre Guedes __u8 filter_dup; 799eb9d91f5SAndre Guedes } __packed; 800eb9d91f5SAndre Guedes 80163185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN 0x200d 80263185f64SVille Tervo struct hci_cp_le_create_conn { 80363185f64SVille Tervo __le16 scan_interval; 80463185f64SVille Tervo __le16 scan_window; 80563185f64SVille Tervo __u8 filter_policy; 80663185f64SVille Tervo __u8 peer_addr_type; 80763185f64SVille Tervo bdaddr_t peer_addr; 80863185f64SVille Tervo __u8 own_address_type; 80963185f64SVille Tervo __le16 conn_interval_min; 81063185f64SVille Tervo __le16 conn_interval_max; 81163185f64SVille Tervo __le16 conn_latency; 81263185f64SVille Tervo __le16 supervision_timeout; 81363185f64SVille Tervo __le16 min_ce_len; 81463185f64SVille Tervo __le16 max_ce_len; 81563185f64SVille Tervo } __packed; 81663185f64SVille Tervo 81763185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 81863185f64SVille Tervo 8192ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE 0x2013 8202ce603ebSClaudio Takahasi struct hci_cp_le_conn_update { 8212ce603ebSClaudio Takahasi __le16 handle; 8222ce603ebSClaudio Takahasi __le16 conn_interval_min; 8232ce603ebSClaudio Takahasi __le16 conn_interval_max; 8242ce603ebSClaudio Takahasi __le16 conn_latency; 8252ce603ebSClaudio Takahasi __le16 supervision_timeout; 8262ce603ebSClaudio Takahasi __le16 min_ce_len; 8272ce603ebSClaudio Takahasi __le16 max_ce_len; 8282ce603ebSClaudio Takahasi } __packed; 8292ce603ebSClaudio Takahasi 830a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC 0x2019 831a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc { 832a7a595f6SVinicius Costa Gomes __le16 handle; 833a7a595f6SVinicius Costa Gomes __u8 rand[8]; 834a7a595f6SVinicius Costa Gomes __le16 ediv; 835a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 836a7a595f6SVinicius Costa Gomes } __packed; 837a7a595f6SVinicius Costa Gomes 838a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY 0x201a 839a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply { 840a7a595f6SVinicius Costa Gomes __le16 handle; 841a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 842a7a595f6SVinicius Costa Gomes } __packed; 843a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply { 844a7a595f6SVinicius Costa Gomes __u8 status; 845a7a595f6SVinicius Costa Gomes __le16 handle; 846a7a595f6SVinicius Costa Gomes } __packed; 847a7a595f6SVinicius Costa Gomes 848a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY 0x201b 849a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply { 850a7a595f6SVinicius Costa Gomes __le16 handle; 851a7a595f6SVinicius Costa Gomes } __packed; 852a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply { 853a7a595f6SVinicius Costa Gomes __u8 status; 854a7a595f6SVinicius Costa Gomes __le16 handle; 855a7a595f6SVinicius Costa Gomes } __packed; 856a7a595f6SVinicius Costa Gomes 8571da177e4SLinus Torvalds /* ---- HCI Events ---- */ 8581da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 8591da177e4SLinus Torvalds 8601da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 8611da177e4SLinus Torvalds struct inquiry_info { 8621da177e4SLinus Torvalds bdaddr_t bdaddr; 8631da177e4SLinus Torvalds __u8 pscan_rep_mode; 8641da177e4SLinus Torvalds __u8 pscan_period_mode; 8651da177e4SLinus Torvalds __u8 pscan_mode; 8661da177e4SLinus Torvalds __u8 dev_class[3]; 8671ebb9252SMarcel Holtmann __le16 clock_offset; 86866c853ccSGustavo F. Padovan } __packed; 8691da177e4SLinus Torvalds 8701da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 8711da177e4SLinus Torvalds struct hci_ev_conn_complete { 8721da177e4SLinus Torvalds __u8 status; 8731ebb9252SMarcel Holtmann __le16 handle; 8741da177e4SLinus Torvalds bdaddr_t bdaddr; 8751da177e4SLinus Torvalds __u8 link_type; 8761da177e4SLinus Torvalds __u8 encr_mode; 87766c853ccSGustavo F. Padovan } __packed; 8781da177e4SLinus Torvalds 8791da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 8801da177e4SLinus Torvalds struct hci_ev_conn_request { 8811da177e4SLinus Torvalds bdaddr_t bdaddr; 8821da177e4SLinus Torvalds __u8 dev_class[3]; 8831da177e4SLinus Torvalds __u8 link_type; 88466c853ccSGustavo F. Padovan } __packed; 8851da177e4SLinus Torvalds 8861da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 8871da177e4SLinus Torvalds struct hci_ev_disconn_complete { 8881da177e4SLinus Torvalds __u8 status; 8891ebb9252SMarcel Holtmann __le16 handle; 8901da177e4SLinus Torvalds __u8 reason; 89166c853ccSGustavo F. Padovan } __packed; 8921da177e4SLinus Torvalds 8931da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 8941da177e4SLinus Torvalds struct hci_ev_auth_complete { 8951da177e4SLinus Torvalds __u8 status; 8961ebb9252SMarcel Holtmann __le16 handle; 89766c853ccSGustavo F. Padovan } __packed; 8981da177e4SLinus Torvalds 899a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 900a9de9248SMarcel Holtmann struct hci_ev_remote_name { 901a9de9248SMarcel Holtmann __u8 status; 902a9de9248SMarcel Holtmann bdaddr_t bdaddr; 9031f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 90466c853ccSGustavo F. Padovan } __packed; 905a9de9248SMarcel Holtmann 9061da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 9071da177e4SLinus Torvalds struct hci_ev_encrypt_change { 9081da177e4SLinus Torvalds __u8 status; 9091ebb9252SMarcel Holtmann __le16 handle; 9101da177e4SLinus Torvalds __u8 encrypt; 91166c853ccSGustavo F. Padovan } __packed; 9121da177e4SLinus Torvalds 913a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 914a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 9151da177e4SLinus Torvalds __u8 status; 9161ebb9252SMarcel Holtmann __le16 handle; 91766c853ccSGustavo F. Padovan } __packed; 9181da177e4SLinus Torvalds 919a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 920a9de9248SMarcel Holtmann struct hci_ev_remote_features { 921a9de9248SMarcel Holtmann __u8 status; 922a9de9248SMarcel Holtmann __le16 handle; 923a9de9248SMarcel Holtmann __u8 features[8]; 92466c853ccSGustavo F. Padovan } __packed; 925a9de9248SMarcel Holtmann 926a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 927a9de9248SMarcel Holtmann struct hci_ev_remote_version { 928a9de9248SMarcel Holtmann __u8 status; 929a9de9248SMarcel Holtmann __le16 handle; 930a9de9248SMarcel Holtmann __u8 lmp_ver; 931a9de9248SMarcel Holtmann __le16 manufacturer; 932a9de9248SMarcel Holtmann __le16 lmp_subver; 93366c853ccSGustavo F. Padovan } __packed; 934a9de9248SMarcel Holtmann 935a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 9361da177e4SLinus Torvalds struct hci_qos { 9371da177e4SLinus Torvalds __u8 service_type; 9381da177e4SLinus Torvalds __u32 token_rate; 9391da177e4SLinus Torvalds __u32 peak_bandwidth; 9401da177e4SLinus Torvalds __u32 latency; 9411da177e4SLinus Torvalds __u32 delay_variation; 94266c853ccSGustavo F. Padovan } __packed; 9431da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 9441da177e4SLinus Torvalds __u8 status; 9451ebb9252SMarcel Holtmann __le16 handle; 9461da177e4SLinus Torvalds struct hci_qos qos; 94766c853ccSGustavo F. Padovan } __packed; 9481da177e4SLinus Torvalds 949a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 9501da177e4SLinus Torvalds struct hci_ev_cmd_complete { 9511da177e4SLinus Torvalds __u8 ncmd; 9521ebb9252SMarcel Holtmann __le16 opcode; 95366c853ccSGustavo F. Padovan } __packed; 9541da177e4SLinus Torvalds 955a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 9561da177e4SLinus Torvalds struct hci_ev_cmd_status { 9571da177e4SLinus Torvalds __u8 status; 9581da177e4SLinus Torvalds __u8 ncmd; 9591ebb9252SMarcel Holtmann __le16 opcode; 96066c853ccSGustavo F. Padovan } __packed; 9611da177e4SLinus Torvalds 9621da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 9631da177e4SLinus Torvalds struct hci_ev_role_change { 9641da177e4SLinus Torvalds __u8 status; 9651da177e4SLinus Torvalds bdaddr_t bdaddr; 9661da177e4SLinus Torvalds __u8 role; 96766c853ccSGustavo F. Padovan } __packed; 9681da177e4SLinus Torvalds 969a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 970a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 971a9de9248SMarcel Holtmann __u8 num_hndl; 972a9de9248SMarcel Holtmann /* variable length part */ 97366c853ccSGustavo F. Padovan } __packed; 974a9de9248SMarcel Holtmann 9751da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 9761da177e4SLinus Torvalds struct hci_ev_mode_change { 9771da177e4SLinus Torvalds __u8 status; 9781ebb9252SMarcel Holtmann __le16 handle; 9791da177e4SLinus Torvalds __u8 mode; 9801ebb9252SMarcel Holtmann __le16 interval; 98166c853ccSGustavo F. Padovan } __packed; 9821da177e4SLinus Torvalds 9831da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 9841da177e4SLinus Torvalds struct hci_ev_pin_code_req { 9851da177e4SLinus Torvalds bdaddr_t bdaddr; 98666c853ccSGustavo F. Padovan } __packed; 9871da177e4SLinus Torvalds 9881da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 9891da177e4SLinus Torvalds struct hci_ev_link_key_req { 9901da177e4SLinus Torvalds bdaddr_t bdaddr; 99166c853ccSGustavo F. Padovan } __packed; 9921da177e4SLinus Torvalds 9931da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 9941da177e4SLinus Torvalds struct hci_ev_link_key_notify { 9951da177e4SLinus Torvalds bdaddr_t bdaddr; 9961da177e4SLinus Torvalds __u8 link_key[16]; 9971da177e4SLinus Torvalds __u8 key_type; 99866c853ccSGustavo F. Padovan } __packed; 9991da177e4SLinus Torvalds 1000a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 10011da177e4SLinus Torvalds struct hci_ev_clock_offset { 10021da177e4SLinus Torvalds __u8 status; 10031ebb9252SMarcel Holtmann __le16 handle; 10041ebb9252SMarcel Holtmann __le16 clock_offset; 100566c853ccSGustavo F. Padovan } __packed; 10061da177e4SLinus Torvalds 1007a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE 0x1d 1008a8746417SMarcel Holtmann struct hci_ev_pkt_type_change { 1009a8746417SMarcel Holtmann __u8 status; 1010a8746417SMarcel Holtmann __le16 handle; 1011a8746417SMarcel Holtmann __le16 pkt_type; 101266c853ccSGustavo F. Padovan } __packed; 1013a8746417SMarcel Holtmann 101485a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 101585a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 101685a1e930SMarcel Holtmann bdaddr_t bdaddr; 101785a1e930SMarcel Holtmann __u8 pscan_rep_mode; 101866c853ccSGustavo F. Padovan } __packed; 101985a1e930SMarcel Holtmann 1020a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 1021a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 1022a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1023a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1024a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1025a9de9248SMarcel Holtmann __u8 dev_class[3]; 1026a9de9248SMarcel Holtmann __le16 clock_offset; 1027a9de9248SMarcel Holtmann __s8 rssi; 102866c853ccSGustavo F. Padovan } __packed; 1029a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 1030a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1031a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1032a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1033a9de9248SMarcel Holtmann __u8 pscan_mode; 1034a9de9248SMarcel Holtmann __u8 dev_class[3]; 1035a9de9248SMarcel Holtmann __le16 clock_offset; 1036a9de9248SMarcel Holtmann __s8 rssi; 103766c853ccSGustavo F. Padovan } __packed; 1038a9de9248SMarcel Holtmann 1039a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 1040a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 1041a9de9248SMarcel Holtmann __u8 status; 1042a9de9248SMarcel Holtmann __le16 handle; 1043a9de9248SMarcel Holtmann __u8 page; 1044a9de9248SMarcel Holtmann __u8 max_page; 1045a9de9248SMarcel Holtmann __u8 features[8]; 104666c853ccSGustavo F. Padovan } __packed; 1047a9de9248SMarcel Holtmann 1048a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 1049a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 1050a9de9248SMarcel Holtmann __u8 status; 1051a9de9248SMarcel Holtmann __le16 handle; 1052a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1053a9de9248SMarcel Holtmann __u8 link_type; 1054a9de9248SMarcel Holtmann __u8 tx_interval; 1055a9de9248SMarcel Holtmann __u8 retrans_window; 1056a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1057a9de9248SMarcel Holtmann __le16 tx_pkt_len; 1058a9de9248SMarcel Holtmann __u8 air_mode; 105966c853ccSGustavo F. Padovan } __packed; 1060a9de9248SMarcel Holtmann 1061a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 1062a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 1063a9de9248SMarcel Holtmann __u8 status; 1064a9de9248SMarcel Holtmann __le16 handle; 1065a9de9248SMarcel Holtmann __u8 tx_interval; 1066a9de9248SMarcel Holtmann __u8 retrans_window; 1067a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1068a9de9248SMarcel Holtmann __le16 tx_pkt_len; 106966c853ccSGustavo F. Padovan } __packed; 1070a9de9248SMarcel Holtmann 1071a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 107204837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 107304837f64SMarcel Holtmann __u8 status; 107404837f64SMarcel Holtmann __le16 handle; 107504837f64SMarcel Holtmann __le16 max_tx_latency; 107604837f64SMarcel Holtmann __le16 max_rx_latency; 107704837f64SMarcel Holtmann __le16 max_remote_timeout; 107804837f64SMarcel Holtmann __le16 max_local_timeout; 107966c853ccSGustavo F. Padovan } __packed; 108004837f64SMarcel Holtmann 1081a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 1082a9de9248SMarcel Holtmann struct extended_inquiry_info { 1083a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1084a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1085a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1086a9de9248SMarcel Holtmann __u8 dev_class[3]; 1087a9de9248SMarcel Holtmann __le16 clock_offset; 1088a9de9248SMarcel Holtmann __s8 rssi; 1089a9de9248SMarcel Holtmann __u8 data[240]; 109066c853ccSGustavo F. Padovan } __packed; 1091a9de9248SMarcel Holtmann 10920493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST 0x31 10930493684eSMarcel Holtmann struct hci_ev_io_capa_request { 10940493684eSMarcel Holtmann bdaddr_t bdaddr; 109566c853ccSGustavo F. Padovan } __packed; 10960493684eSMarcel Holtmann 109703b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY 0x32 109803b555e1SJohan Hedberg struct hci_ev_io_capa_reply { 109903b555e1SJohan Hedberg bdaddr_t bdaddr; 110003b555e1SJohan Hedberg __u8 capability; 110103b555e1SJohan Hedberg __u8 oob_data; 110203b555e1SJohan Hedberg __u8 authentication; 110303b555e1SJohan Hedberg } __packed; 110403b555e1SJohan Hedberg 1105a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST 0x33 1106a5c29683SJohan Hedberg struct hci_ev_user_confirm_req { 1107a5c29683SJohan Hedberg bdaddr_t bdaddr; 1108a5c29683SJohan Hedberg __le32 passkey; 1109a5c29683SJohan Hedberg } __packed; 1110a5c29683SJohan Hedberg 11119ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST 0x34 11129ad4019aSBrian Gix struct hci_ev_user_passkey_req { 11139ad4019aSBrian Gix bdaddr_t bdaddr; 11149ad4019aSBrian Gix } __packed; 11159ad4019aSBrian Gix 11162763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 11172763eda6SSzymon Janc struct hci_ev_remote_oob_data_request { 11182763eda6SSzymon Janc bdaddr_t bdaddr; 11192763eda6SSzymon Janc } __packed; 11202763eda6SSzymon Janc 11210493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 11220493684eSMarcel Holtmann struct hci_ev_simple_pair_complete { 11230493684eSMarcel Holtmann __u8 status; 11240493684eSMarcel Holtmann bdaddr_t bdaddr; 112566c853ccSGustavo F. Padovan } __packed; 11260493684eSMarcel Holtmann 112741a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 112841a96212SMarcel Holtmann struct hci_ev_remote_host_features { 112941a96212SMarcel Holtmann bdaddr_t bdaddr; 113041a96212SMarcel Holtmann __u8 features[8]; 113166c853ccSGustavo F. Padovan } __packed; 113241a96212SMarcel Holtmann 113363185f64SVille Tervo #define HCI_EV_LE_META 0x3e 113463185f64SVille Tervo struct hci_ev_le_meta { 113563185f64SVille Tervo __u8 subevent; 113663185f64SVille Tervo } __packed; 113763185f64SVille Tervo 113863185f64SVille Tervo /* Low energy meta events */ 113963185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE 0x01 114063185f64SVille Tervo struct hci_ev_le_conn_complete { 114163185f64SVille Tervo __u8 status; 114263185f64SVille Tervo __le16 handle; 114363185f64SVille Tervo __u8 role; 114463185f64SVille Tervo __u8 bdaddr_type; 114563185f64SVille Tervo bdaddr_t bdaddr; 114663185f64SVille Tervo __le16 interval; 114763185f64SVille Tervo __le16 latency; 114863185f64SVille Tervo __le16 supervision_timeout; 114963185f64SVille Tervo __u8 clk_accurancy; 115063185f64SVille Tervo } __packed; 115163185f64SVille Tervo 1152a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ 0x05 1153a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req { 1154a7a595f6SVinicius Costa Gomes __le16 handle; 1155a7a595f6SVinicius Costa Gomes __u8 random[8]; 1156a7a595f6SVinicius Costa Gomes __le16 ediv; 1157a7a595f6SVinicius Costa Gomes } __packed; 1158a7a595f6SVinicius Costa Gomes 115957a56fd4SAnderson Briglia /* Advertising report event types */ 116057a56fd4SAnderson Briglia #define ADV_IND 0x00 116157a56fd4SAnderson Briglia #define ADV_DIRECT_IND 0x01 116257a56fd4SAnderson Briglia #define ADV_SCAN_IND 0x02 116357a56fd4SAnderson Briglia #define ADV_NONCONN_IND 0x03 116457a56fd4SAnderson Briglia #define ADV_SCAN_RSP 0x04 116557a56fd4SAnderson Briglia 116657a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC 0x00 116757a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM 0x01 116857a56fd4SAnderson Briglia 116957a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT 0x02 117057a56fd4SAnderson Briglia struct hci_ev_le_advertising_info { 117157a56fd4SAnderson Briglia __u8 evt_type; 117257a56fd4SAnderson Briglia __u8 bdaddr_type; 117357a56fd4SAnderson Briglia bdaddr_t bdaddr; 117457a56fd4SAnderson Briglia __u8 length; 117557a56fd4SAnderson Briglia __u8 data[0]; 117657a56fd4SAnderson Briglia } __packed; 117757a56fd4SAnderson Briglia 11781da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 1179a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 11801da177e4SLinus Torvalds struct hci_ev_stack_internal { 11811da177e4SLinus Torvalds __u16 type; 11821da177e4SLinus Torvalds __u8 data[0]; 118366c853ccSGustavo F. Padovan } __packed; 11841da177e4SLinus Torvalds 11851da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 11861da177e4SLinus Torvalds struct hci_ev_si_device { 11871da177e4SLinus Torvalds __u16 event; 11881da177e4SLinus Torvalds __u16 dev_id; 118966c853ccSGustavo F. Padovan } __packed; 11901da177e4SLinus Torvalds 11911da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 11921da177e4SLinus Torvalds struct hci_ev_si_security { 11931da177e4SLinus Torvalds __u16 event; 11941da177e4SLinus Torvalds __u16 proto; 11951da177e4SLinus Torvalds __u16 subproto; 11961da177e4SLinus Torvalds __u8 incoming; 119766c853ccSGustavo F. Padovan } __packed; 11981da177e4SLinus Torvalds 11991da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 12001da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 12011da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 12021da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 12031da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 12041da177e4SLinus Torvalds 12051da177e4SLinus Torvalds struct hci_command_hdr { 12061ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 12071da177e4SLinus Torvalds __u8 plen; 120866c853ccSGustavo F. Padovan } __packed; 12091da177e4SLinus Torvalds 12101da177e4SLinus Torvalds struct hci_event_hdr { 12111da177e4SLinus Torvalds __u8 evt; 12121da177e4SLinus Torvalds __u8 plen; 121366c853ccSGustavo F. Padovan } __packed; 12141da177e4SLinus Torvalds 12151da177e4SLinus Torvalds struct hci_acl_hdr { 12161ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 12171ebb9252SMarcel Holtmann __le16 dlen; 121866c853ccSGustavo F. Padovan } __packed; 12191da177e4SLinus Torvalds 12201da177e4SLinus Torvalds struct hci_sco_hdr { 12211ebb9252SMarcel Holtmann __le16 handle; 12221da177e4SLinus Torvalds __u8 dlen; 122366c853ccSGustavo F. Padovan } __packed; 12241da177e4SLinus Torvalds 12252a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h> 12262a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 12272a123b86SArnaldo Carvalho de Melo { 12282a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 12292a123b86SArnaldo Carvalho de Melo } 12302a123b86SArnaldo Carvalho de Melo 12312a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 12322a123b86SArnaldo Carvalho de Melo { 12332a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 12342a123b86SArnaldo Carvalho de Melo } 12352a123b86SArnaldo Carvalho de Melo 12362a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 12372a123b86SArnaldo Carvalho de Melo { 12382a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 12392a123b86SArnaldo Carvalho de Melo } 12402a123b86SArnaldo Carvalho de Melo 12411da177e4SLinus Torvalds /* Command opcode pack/unpack */ 12421da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 12431da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 12441da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 12451da177e4SLinus Torvalds 12461da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 12471da177e4SLinus Torvalds #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) 12481da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 12491da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 12501da177e4SLinus Torvalds 12511da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 12521da177e4SLinus Torvalds 12531da177e4SLinus Torvalds /* Socket options */ 12541da177e4SLinus Torvalds #define HCI_DATA_DIR 1 12551da177e4SLinus Torvalds #define HCI_FILTER 2 12561da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 12571da177e4SLinus Torvalds 12581da177e4SLinus Torvalds /* CMSG flags */ 12591da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 12601da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 12611da177e4SLinus Torvalds 12621da177e4SLinus Torvalds struct sockaddr_hci { 12631da177e4SLinus Torvalds sa_family_t hci_family; 12641da177e4SLinus Torvalds unsigned short hci_dev; 1265c02178d2SJohan Hedberg unsigned short hci_channel; 12661da177e4SLinus Torvalds }; 12671da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 12681da177e4SLinus Torvalds 1269c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW 0 1270c02178d2SJohan Hedberg #define HCI_CHANNEL_CONTROL 1 1271c02178d2SJohan Hedberg 12721da177e4SLinus Torvalds struct hci_filter { 12731da177e4SLinus Torvalds unsigned long type_mask; 12741da177e4SLinus Torvalds unsigned long event_mask[2]; 1275905f3ed6SAl Viro __le16 opcode; 12761da177e4SLinus Torvalds }; 12771da177e4SLinus Torvalds 12781da177e4SLinus Torvalds struct hci_ufilter { 12791da177e4SLinus Torvalds __u32 type_mask; 12801da177e4SLinus Torvalds __u32 event_mask[2]; 1281905f3ed6SAl Viro __le16 opcode; 12821da177e4SLinus Torvalds }; 12831da177e4SLinus Torvalds 12841da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 12851da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 12861da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 12871da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 12881da177e4SLinus Torvalds 12891da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 12901da177e4SLinus Torvalds struct hci_dev_stats { 12911da177e4SLinus Torvalds __u32 err_rx; 12921da177e4SLinus Torvalds __u32 err_tx; 12931da177e4SLinus Torvalds __u32 cmd_tx; 12941da177e4SLinus Torvalds __u32 evt_rx; 12951da177e4SLinus Torvalds __u32 acl_tx; 12961da177e4SLinus Torvalds __u32 acl_rx; 12971da177e4SLinus Torvalds __u32 sco_tx; 12981da177e4SLinus Torvalds __u32 sco_rx; 12991da177e4SLinus Torvalds __u32 byte_rx; 13001da177e4SLinus Torvalds __u32 byte_tx; 13011da177e4SLinus Torvalds }; 13021da177e4SLinus Torvalds 13031da177e4SLinus Torvalds struct hci_dev_info { 13041da177e4SLinus Torvalds __u16 dev_id; 13051da177e4SLinus Torvalds char name[8]; 13061da177e4SLinus Torvalds 13071da177e4SLinus Torvalds bdaddr_t bdaddr; 13081da177e4SLinus Torvalds 13091da177e4SLinus Torvalds __u32 flags; 13101da177e4SLinus Torvalds __u8 type; 13111da177e4SLinus Torvalds 13121da177e4SLinus Torvalds __u8 features[8]; 13131da177e4SLinus Torvalds 13141da177e4SLinus Torvalds __u32 pkt_type; 13151da177e4SLinus Torvalds __u32 link_policy; 13161da177e4SLinus Torvalds __u32 link_mode; 13171da177e4SLinus Torvalds 13181da177e4SLinus Torvalds __u16 acl_mtu; 13191da177e4SLinus Torvalds __u16 acl_pkts; 13201da177e4SLinus Torvalds __u16 sco_mtu; 13211da177e4SLinus Torvalds __u16 sco_pkts; 13221da177e4SLinus Torvalds 13231da177e4SLinus Torvalds struct hci_dev_stats stat; 13241da177e4SLinus Torvalds }; 13251da177e4SLinus Torvalds 13261da177e4SLinus Torvalds struct hci_conn_info { 13271da177e4SLinus Torvalds __u16 handle; 13281da177e4SLinus Torvalds bdaddr_t bdaddr; 13291da177e4SLinus Torvalds __u8 type; 13301da177e4SLinus Torvalds __u8 out; 13311da177e4SLinus Torvalds __u16 state; 13321da177e4SLinus Torvalds __u32 link_mode; 13331da177e4SLinus Torvalds }; 13341da177e4SLinus Torvalds 13351da177e4SLinus Torvalds struct hci_dev_req { 13361da177e4SLinus Torvalds __u16 dev_id; 13371da177e4SLinus Torvalds __u32 dev_opt; 13381da177e4SLinus Torvalds }; 13391da177e4SLinus Torvalds 13401da177e4SLinus Torvalds struct hci_dev_list_req { 13411da177e4SLinus Torvalds __u16 dev_num; 13421da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 13431da177e4SLinus Torvalds }; 13441da177e4SLinus Torvalds 13451da177e4SLinus Torvalds struct hci_conn_list_req { 13461da177e4SLinus Torvalds __u16 dev_id; 13471da177e4SLinus Torvalds __u16 conn_num; 13481da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 13491da177e4SLinus Torvalds }; 13501da177e4SLinus Torvalds 13511da177e4SLinus Torvalds struct hci_conn_info_req { 13521da177e4SLinus Torvalds bdaddr_t bdaddr; 13531da177e4SLinus Torvalds __u8 type; 13541da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 13551da177e4SLinus Torvalds }; 13561da177e4SLinus Torvalds 135740be492fSMarcel Holtmann struct hci_auth_info_req { 135840be492fSMarcel Holtmann bdaddr_t bdaddr; 135940be492fSMarcel Holtmann __u8 type; 136040be492fSMarcel Holtmann }; 136140be492fSMarcel Holtmann 13621da177e4SLinus Torvalds struct hci_inquiry_req { 13631da177e4SLinus Torvalds __u16 dev_id; 13641da177e4SLinus Torvalds __u16 flags; 13651da177e4SLinus Torvalds __u8 lap[3]; 13661da177e4SLinus Torvalds __u8 length; 13671da177e4SLinus Torvalds __u8 num_rsp; 13681da177e4SLinus Torvalds }; 13691da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 13701da177e4SLinus Torvalds 13718830f514SAndrei Emeltchenko extern int enable_hs; 13728830f514SAndrei Emeltchenko 13731da177e4SLinus Torvalds #endif /* __HCI_H */ 1374