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 339b3b4460SAndrei Emeltchenko #define HCI_LINK_KEY_SIZE 16 34523e93cdSAndrei Emeltchenko #define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 359b3b4460SAndrei Emeltchenko 36*903e4541SAndrei Emeltchenko #define HCI_MAX_AMP_ASSOC_SIZE 672 37*903e4541SAndrei Emeltchenko 381da177e4SLinus Torvalds /* HCI dev events */ 391da177e4SLinus Torvalds #define HCI_DEV_REG 1 401da177e4SLinus Torvalds #define HCI_DEV_UNREG 2 411da177e4SLinus Torvalds #define HCI_DEV_UP 3 421da177e4SLinus Torvalds #define HCI_DEV_DOWN 4 431da177e4SLinus Torvalds #define HCI_DEV_SUSPEND 5 441da177e4SLinus Torvalds #define HCI_DEV_RESUME 6 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds /* HCI notify events */ 471da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD 1 481da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL 2 491da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING 3 501da177e4SLinus Torvalds 51c13854ceSMarcel Holtmann /* HCI bus types */ 520ac53939SMarcel Holtmann #define HCI_VIRTUAL 0 531da177e4SLinus Torvalds #define HCI_USB 1 541da177e4SLinus Torvalds #define HCI_PCCARD 2 551da177e4SLinus Torvalds #define HCI_UART 3 561da177e4SLinus Torvalds #define HCI_RS232 4 571da177e4SLinus Torvalds #define HCI_PCI 5 580ac53939SMarcel Holtmann #define HCI_SDIO 6 591da177e4SLinus Torvalds 60943da25dSMarcel Holtmann /* HCI controller types */ 61943da25dSMarcel Holtmann #define HCI_BREDR 0x00 628f1e1742SDavid Vrabel #define HCI_AMP 0x01 63943da25dSMarcel Holtmann 648598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */ 658598d064SAndrei Emeltchenko #define HCI_BREDR_ID 0 668598d064SAndrei Emeltchenko 67ab846ec4SAndrei Emeltchenko /* AMP controller status */ 68ab846ec4SAndrei Emeltchenko #define AMP_CTRL_POWERED_DOWN 0x00 69ab846ec4SAndrei Emeltchenko #define AMP_CTRL_BLUETOOTH_ONLY 0x01 70ab846ec4SAndrei Emeltchenko #define AMP_CTRL_NO_CAPACITY 0x02 71ab846ec4SAndrei Emeltchenko #define AMP_CTRL_LOW_CAPACITY 0x03 72ab846ec4SAndrei Emeltchenko #define AMP_CTRL_MEDIUM_CAPACITY 0x04 73ab846ec4SAndrei Emeltchenko #define AMP_CTRL_HIGH_CAPACITY 0x05 74ab846ec4SAndrei Emeltchenko #define AMP_CTRL_FULL_CAPACITY 0x06 75ab846ec4SAndrei Emeltchenko 761da177e4SLinus Torvalds /* HCI device quirks */ 771da177e4SLinus Torvalds enum { 78a6c511c6SSzymon Janc HCI_QUIRK_RESET_ON_CLOSE, 79da1f5198SMarcel Holtmann HCI_QUIRK_RAW_DEVICE, 80da1f5198SMarcel Holtmann HCI_QUIRK_FIXUP_BUFFER_SIZE 811da177e4SLinus Torvalds }; 821da177e4SLinus Torvalds 831da177e4SLinus Torvalds /* HCI device flags */ 841da177e4SLinus Torvalds enum { 851da177e4SLinus Torvalds HCI_UP, 861da177e4SLinus Torvalds HCI_INIT, 871da177e4SLinus Torvalds HCI_RUNNING, 881da177e4SLinus Torvalds 891da177e4SLinus Torvalds HCI_PSCAN, 901da177e4SLinus Torvalds HCI_ISCAN, 911da177e4SLinus Torvalds HCI_AUTH, 921da177e4SLinus Torvalds HCI_ENCRYPT, 931da177e4SLinus Torvalds HCI_INQUIRY, 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds HCI_RAW, 96ab81cbf9SJohan Hedberg 9710572132SGustavo F. Padovan HCI_RESET, 981da177e4SLinus Torvalds }; 991da177e4SLinus Torvalds 100d23264a8SAndre Guedes /* 101d23264a8SAndre Guedes * BR/EDR and/or LE controller flags: the flags defined here should represent 102d23264a8SAndre Guedes * states from the controller. 103d23264a8SAndre Guedes */ 104d23264a8SAndre Guedes enum { 105a8b2d5c2SJohan Hedberg HCI_SETUP, 106a8b2d5c2SJohan Hedberg HCI_AUTO_OFF, 107a8b2d5c2SJohan Hedberg HCI_MGMT, 108a8b2d5c2SJohan Hedberg HCI_PAIRABLE, 109a8b2d5c2SJohan Hedberg HCI_SERVICE_CACHE, 110a8b2d5c2SJohan Hedberg HCI_LINK_KEYS, 111a8b2d5c2SJohan Hedberg HCI_DEBUG_KEYS, 11294324962SJohan Hovold HCI_UNREGISTER, 113a8b2d5c2SJohan Hedberg 114d23264a8SAndre Guedes HCI_LE_SCAN, 11584bde9d6SJohan Hedberg HCI_SSP_ENABLED, 1166d80dfd0SJohan Hedberg HCI_HS_ENABLED, 11706199cf8SJohan Hedberg HCI_LE_ENABLED, 1185e5282bbSJohan Hedberg HCI_CONNECTABLE, 1195e5282bbSJohan Hedberg HCI_DISCOVERABLE, 12047990ea0SJohan Hedberg HCI_LINK_SECURITY, 121c95f0ba7SJohan Hedberg HCI_PENDING_CLASS, 12221693c15SAndre Guedes HCI_PERIODIC_INQ, 123d23264a8SAndre Guedes }; 124d23264a8SAndre Guedes 1251da177e4SLinus Torvalds /* HCI ioctl defines */ 1261da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 1271da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 1281da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 1291da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 1301da177e4SLinus Torvalds 1311da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 1321da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 1331da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 1341da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 13540be492fSMarcel Holtmann #define HCIGETAUTHINFO _IOR('H', 215, int) 1361da177e4SLinus Torvalds 1371da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 1381da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 1391da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 1401da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 1411da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 1421da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 1431da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 1441da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 1451da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 1461da177e4SLinus Torvalds 147f0358568SJohan Hedberg #define HCIBLOCKADDR _IOW('H', 230, int) 148f0358568SJohan Hedberg #define HCIUNBLOCKADDR _IOW('H', 231, int) 149f0358568SJohan Hedberg 1501da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1511da177e4SLinus Torvalds 1521da177e4SLinus Torvalds /* HCI timeouts */ 1535f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 1545f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 1555f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ 1569345d40cSAndrei Emeltchenko #define HCI_CMD_TIMEOUT msecs_to_jiffies(1000) /* 1 second */ 1575f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 1589345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 1591da177e4SLinus Torvalds 1605b7f9909SMarcel Holtmann /* HCI data types */ 1611da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1621da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1631da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1641da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1651da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1661da177e4SLinus Torvalds 1675b7f9909SMarcel Holtmann /* HCI packet types */ 1681da177e4SLinus Torvalds #define HCI_DM1 0x0008 1691da177e4SLinus Torvalds #define HCI_DM3 0x0400 1701da177e4SLinus Torvalds #define HCI_DM5 0x4000 1711da177e4SLinus Torvalds #define HCI_DH1 0x0010 1721da177e4SLinus Torvalds #define HCI_DH3 0x0800 1731da177e4SLinus Torvalds #define HCI_DH5 0x8000 1741da177e4SLinus Torvalds 1751da177e4SLinus Torvalds #define HCI_HV1 0x0020 1761da177e4SLinus Torvalds #define HCI_HV2 0x0040 1771da177e4SLinus Torvalds #define HCI_HV3 0x0080 1781da177e4SLinus Torvalds 1791da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1801da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1811da177e4SLinus Torvalds 1825b7f9909SMarcel Holtmann /* eSCO packet types */ 1835b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1845b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1855b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1865b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1875b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1885b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 189efc7688bSMarcel Holtmann #define ESCO_2EV3 0x0040 190efc7688bSMarcel Holtmann #define ESCO_3EV3 0x0080 191efc7688bSMarcel Holtmann #define ESCO_2EV5 0x0100 192efc7688bSMarcel Holtmann #define ESCO_3EV5 0x0200 1935b7f9909SMarcel Holtmann 194a8746417SMarcel Holtmann #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 195efc7688bSMarcel Holtmann #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 196a8746417SMarcel Holtmann 1971da177e4SLinus Torvalds /* ACL flags */ 198e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH 0x00 1991da177e4SLinus Torvalds #define ACL_CONT 0x01 2001da177e4SLinus Torvalds #define ACL_START 0x02 2011da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 2021da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 2031da177e4SLinus Torvalds 2041da177e4SLinus Torvalds /* Baseband links */ 2051da177e4SLinus Torvalds #define SCO_LINK 0x00 2061da177e4SLinus Torvalds #define ACL_LINK 0x01 2075b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 208fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */ 209fcd89c09SVille Tervo #define LE_LINK 0x80 2101da177e4SLinus Torvalds 2111da177e4SLinus Torvalds /* LMP features */ 2121da177e4SLinus Torvalds #define LMP_3SLOT 0x01 2131da177e4SLinus Torvalds #define LMP_5SLOT 0x02 2141da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 2151da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 2161da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 2171da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 2181da177e4SLinus Torvalds #define LMP_HOLD 0x40 21904837f64SMarcel Holtmann #define LMP_SNIFF 0x80 2201da177e4SLinus Torvalds 2211da177e4SLinus Torvalds #define LMP_PARK 0x01 2221da177e4SLinus Torvalds #define LMP_RSSI 0x02 2231da177e4SLinus Torvalds #define LMP_QUALITY 0x04 2241da177e4SLinus Torvalds #define LMP_SCO 0x08 2251da177e4SLinus Torvalds #define LMP_HV2 0x10 2261da177e4SLinus Torvalds #define LMP_HV3 0x20 2271da177e4SLinus Torvalds #define LMP_ULAW 0x40 2281da177e4SLinus Torvalds #define LMP_ALAW 0x80 2291da177e4SLinus Torvalds 2301da177e4SLinus Torvalds #define LMP_CVSD 0x01 2311da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 2321da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 2331da177e4SLinus Torvalds 234d5859e22SJohan Hedberg #define LMP_RSSI_INQ 0x40 2355b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 2365b7f9909SMarcel Holtmann 2375b7f9909SMarcel Holtmann #define LMP_EV4 0x01 2385b7f9909SMarcel Holtmann #define LMP_EV5 0x02 23969ab39eaSJohan Hedberg #define LMP_NO_BREDR 0x20 240d5859e22SJohan Hedberg #define LMP_LE 0x40 2415b7f9909SMarcel Holtmann 24204837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 243d5859e22SJohan Hedberg #define LMP_PAUSE_ENC 0x04 244efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M 0x20 245efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M 0x40 246efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO 0x80 24704837f64SMarcel Holtmann 248d5859e22SJohan Hedberg #define LMP_EXT_INQ 0x01 249e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR 0x02 250769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR 0x08 251e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH 0x40 252769be974SMarcel Holtmann 253d5859e22SJohan Hedberg #define LMP_LSTO 0x01 254d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR 0x02 255971e3a4bSAndre Guedes #define LMP_EXTFEATURES 0x80 256d5859e22SJohan Hedberg 257eead27daSAndre Guedes /* Extended LMP features */ 258cc2c04ecSJohan Hedberg #define LMP_HOST_SSP 0x01 259eead27daSAndre Guedes #define LMP_HOST_LE 0x02 260cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR 0x04 261eead27daSAndre Guedes 26204837f64SMarcel Holtmann /* Connection modes */ 26304837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 26404837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 26504837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 26604837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 26704837f64SMarcel Holtmann 2681da177e4SLinus Torvalds /* Link policies */ 2691da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 2701da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 2711da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 2721da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 2731da177e4SLinus Torvalds 27404837f64SMarcel Holtmann /* Link modes */ 2751da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 2761da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 2771da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 2781da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 2791da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 2801da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2811da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2821da177e4SLinus Torvalds 28340be492fSMarcel Holtmann /* Authentication types */ 28440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING 0x00 28540be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM 0x01 28640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING 0x02 28740be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM 0x03 28840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING 0x04 28940be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM 0x05 29040be492fSMarcel Holtmann 291b6020ba0SWaldemar Rymarkiewicz /* Link Key types */ 292b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION 0x00 293b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT 0x01 294b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT 0x02 295b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION 0x03 296b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION 0x04 297b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION 0x05 298b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION 0x06 299b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ 300b899efafSVinicius Costa Gomes #define HCI_SMP_STK 0x80 301b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE 0x81 302b899efafSVinicius Costa Gomes #define HCI_SMP_LTK 0x82 303b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE 0x83 304b6020ba0SWaldemar Rymarkiewicz 3059f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */ 3069f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE 0x05 307cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 3089f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR 0x0f 3099f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM 0x13 310cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 311cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF 0x15 3129f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM 0x16 3139f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 3149f5a0d7bSAndrei Emeltchenko 3152455a3eaSAndrei Emeltchenko /* Flow control modes */ 3162455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 3172455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 3182455a3eaSAndrei Emeltchenko 31932748db0SJohan Hedberg /* Extended Inquiry Response field types */ 32032748db0SJohan Hedberg #define EIR_FLAGS 0x01 /* flags */ 32132748db0SJohan Hedberg #define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 32232748db0SJohan Hedberg #define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ 32332748db0SJohan Hedberg #define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ 32432748db0SJohan Hedberg #define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ 32532748db0SJohan Hedberg #define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ 32632748db0SJohan Hedberg #define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ 32732748db0SJohan Hedberg #define EIR_NAME_SHORT 0x08 /* shortened local name */ 32832748db0SJohan Hedberg #define EIR_NAME_COMPLETE 0x09 /* complete local name */ 32932748db0SJohan Hedberg #define EIR_TX_POWER 0x0A /* transmit power level */ 3309ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ 3319ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */ 3329ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ 33332748db0SJohan Hedberg #define EIR_DEVICE_ID 0x10 /* device ID */ 33432748db0SJohan Hedberg 3351da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 3366bd32326SVille Tervo #define HCI_OP_NOP 0x0000 3376bd32326SVille Tervo 338a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 339a9de9248SMarcel Holtmann struct hci_cp_inquiry { 340a9de9248SMarcel Holtmann __u8 lap[3]; 341a9de9248SMarcel Holtmann __u8 length; 342a9de9248SMarcel Holtmann __u8 num_rsp; 34366c853ccSGustavo F. Padovan } __packed; 3441da177e4SLinus Torvalds 345a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 346a9de9248SMarcel Holtmann 34779d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ 0x0403 34879d6e068SAndre Guedes 349a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 350a9de9248SMarcel Holtmann 351a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 352a9de9248SMarcel Holtmann struct hci_cp_create_conn { 353a9de9248SMarcel Holtmann bdaddr_t bdaddr; 354a9de9248SMarcel Holtmann __le16 pkt_type; 355a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 356a9de9248SMarcel Holtmann __u8 pscan_mode; 357a9de9248SMarcel Holtmann __le16 clock_offset; 358a9de9248SMarcel Holtmann __u8 role_switch; 35966c853ccSGustavo F. Padovan } __packed; 3601da177e4SLinus Torvalds 361a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 362a9de9248SMarcel Holtmann struct hci_cp_disconnect { 363a9de9248SMarcel Holtmann __le16 handle; 364a9de9248SMarcel Holtmann __u8 reason; 36566c853ccSGustavo F. Padovan } __packed; 3661da177e4SLinus Torvalds 367a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 368a9de9248SMarcel Holtmann struct hci_cp_add_sco { 369a9de9248SMarcel Holtmann __le16 handle; 370a9de9248SMarcel Holtmann __le16 pkt_type; 37166c853ccSGustavo F. Padovan } __packed; 372a9de9248SMarcel Holtmann 373a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 374a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 3751da177e4SLinus Torvalds bdaddr_t bdaddr; 37666c853ccSGustavo F. Padovan } __packed; 3771da177e4SLinus Torvalds 378a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 379a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 380a9de9248SMarcel Holtmann bdaddr_t bdaddr; 381a9de9248SMarcel Holtmann __u8 role; 38266c853ccSGustavo F. Padovan } __packed; 3831da177e4SLinus Torvalds 384a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 385a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 386a9de9248SMarcel Holtmann bdaddr_t bdaddr; 387a9de9248SMarcel Holtmann __u8 reason; 38866c853ccSGustavo F. Padovan } __packed; 3891da177e4SLinus Torvalds 390a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 391a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 392a9de9248SMarcel Holtmann bdaddr_t bdaddr; 3939b3b4460SAndrei Emeltchenko __u8 link_key[HCI_LINK_KEY_SIZE]; 39466c853ccSGustavo F. Padovan } __packed; 3951da177e4SLinus Torvalds 396a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 397a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 398a9de9248SMarcel Holtmann bdaddr_t bdaddr; 39966c853ccSGustavo F. Padovan } __packed; 4001da177e4SLinus Torvalds 401a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 402a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 403a9de9248SMarcel Holtmann bdaddr_t bdaddr; 404a9de9248SMarcel Holtmann __u8 pin_len; 405a9de9248SMarcel Holtmann __u8 pin_code[16]; 40666c853ccSGustavo F. Padovan } __packed; 407980e1a53SJohan Hedberg struct hci_rp_pin_code_reply { 408980e1a53SJohan Hedberg __u8 status; 409980e1a53SJohan Hedberg bdaddr_t bdaddr; 410980e1a53SJohan Hedberg } __packed; 411a9de9248SMarcel Holtmann 412a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 413a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 414a9de9248SMarcel Holtmann bdaddr_t bdaddr; 41566c853ccSGustavo F. Padovan } __packed; 416980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply { 417980e1a53SJohan Hedberg __u8 status; 418980e1a53SJohan Hedberg bdaddr_t bdaddr; 419980e1a53SJohan Hedberg } __packed; 420a9de9248SMarcel Holtmann 421a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 422a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 423a9de9248SMarcel Holtmann __le16 handle; 424a9de9248SMarcel Holtmann __le16 pkt_type; 42566c853ccSGustavo F. Padovan } __packed; 426a9de9248SMarcel Holtmann 427a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 428a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 429a9de9248SMarcel Holtmann __le16 handle; 43066c853ccSGustavo F. Padovan } __packed; 431a9de9248SMarcel Holtmann 432a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 433a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 434a9de9248SMarcel Holtmann __le16 handle; 435a9de9248SMarcel Holtmann __u8 encrypt; 43666c853ccSGustavo F. Padovan } __packed; 437a9de9248SMarcel Holtmann 438a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 439a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 440a9de9248SMarcel Holtmann __le16 handle; 44166c853ccSGustavo F. Padovan } __packed; 442a9de9248SMarcel Holtmann 443a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 444a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 445a9de9248SMarcel Holtmann bdaddr_t bdaddr; 446a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 447a9de9248SMarcel Holtmann __u8 pscan_mode; 448a9de9248SMarcel Holtmann __le16 clock_offset; 44966c853ccSGustavo F. Padovan } __packed; 450a9de9248SMarcel Holtmann 451a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 452a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 453a9de9248SMarcel Holtmann bdaddr_t bdaddr; 45466c853ccSGustavo F. Padovan } __packed; 455a9de9248SMarcel Holtmann 456a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 457a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 458a9de9248SMarcel Holtmann __le16 handle; 45966c853ccSGustavo F. Padovan } __packed; 460a9de9248SMarcel Holtmann 461a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 462a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 463a9de9248SMarcel Holtmann __le16 handle; 464a9de9248SMarcel Holtmann __u8 page; 46566c853ccSGustavo F. Padovan } __packed; 466a9de9248SMarcel Holtmann 467a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 468a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 469a9de9248SMarcel Holtmann __le16 handle; 47066c853ccSGustavo F. Padovan } __packed; 471a9de9248SMarcel Holtmann 472a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 473a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 474a9de9248SMarcel Holtmann __le16 handle; 475a9de9248SMarcel Holtmann __le32 tx_bandwidth; 476a9de9248SMarcel Holtmann __le32 rx_bandwidth; 477a9de9248SMarcel Holtmann __le16 max_latency; 478a9de9248SMarcel Holtmann __le16 voice_setting; 479a9de9248SMarcel Holtmann __u8 retrans_effort; 480a9de9248SMarcel Holtmann __le16 pkt_type; 48166c853ccSGustavo F. Padovan } __packed; 482a9de9248SMarcel Holtmann 483a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 484a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 485a9de9248SMarcel Holtmann bdaddr_t bdaddr; 486a9de9248SMarcel Holtmann __le32 tx_bandwidth; 487a9de9248SMarcel Holtmann __le32 rx_bandwidth; 488a9de9248SMarcel Holtmann __le16 max_latency; 489a9de9248SMarcel Holtmann __le16 content_format; 490a9de9248SMarcel Holtmann __u8 retrans_effort; 491a9de9248SMarcel Holtmann __le16 pkt_type; 49266c853ccSGustavo F. Padovan } __packed; 493a9de9248SMarcel Holtmann 494a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 495a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 496a9de9248SMarcel Holtmann bdaddr_t bdaddr; 497a9de9248SMarcel Holtmann __u8 reason; 49866c853ccSGustavo F. Padovan } __packed; 499a9de9248SMarcel Holtmann 50017fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY 0x042b 50117fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply { 50217fa4b9dSJohan Hedberg bdaddr_t bdaddr; 50317fa4b9dSJohan Hedberg __u8 capability; 50417fa4b9dSJohan Hedberg __u8 oob_data; 50517fa4b9dSJohan Hedberg __u8 authentication; 50617fa4b9dSJohan Hedberg } __packed; 50717fa4b9dSJohan Hedberg 508a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY 0x042c 509a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply { 510a5c29683SJohan Hedberg bdaddr_t bdaddr; 511a5c29683SJohan Hedberg } __packed; 512a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply { 513a5c29683SJohan Hedberg __u8 status; 514a5c29683SJohan Hedberg bdaddr_t bdaddr; 515a5c29683SJohan Hedberg } __packed; 516a5c29683SJohan Hedberg 517a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 518a5c29683SJohan Hedberg 5199ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY 0x042e 5209ad4019aSBrian Gix struct hci_cp_user_passkey_reply { 5219ad4019aSBrian Gix bdaddr_t bdaddr; 5229ad4019aSBrian Gix __le32 passkey; 5239ad4019aSBrian Gix } __packed; 5249ad4019aSBrian Gix 5259ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f 5269ad4019aSBrian Gix 5272763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 5282763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply { 5292763eda6SSzymon Janc bdaddr_t bdaddr; 5302763eda6SSzymon Janc __u8 hash[16]; 5312763eda6SSzymon Janc __u8 randomizer[16]; 5322763eda6SSzymon Janc } __packed; 5332763eda6SSzymon Janc 5342763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 5352763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply { 5362763eda6SSzymon Janc bdaddr_t bdaddr; 5372763eda6SSzymon Janc } __packed; 5382763eda6SSzymon Janc 53903b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 54003b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply { 54103b555e1SJohan Hedberg bdaddr_t bdaddr; 54203b555e1SJohan Hedberg __u8 reason; 54303b555e1SJohan Hedberg } __packed; 54403b555e1SJohan Hedberg 545523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK 0x0435 546523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link { 547523e93cdSAndrei Emeltchenko __u8 phy_handle; 548523e93cdSAndrei Emeltchenko __u8 key_len; 549523e93cdSAndrei Emeltchenko __u8 key_type; 550523e93cdSAndrei Emeltchenko __u8 key[HCI_AMP_LINK_KEY_SIZE]; 551523e93cdSAndrei Emeltchenko } __packed; 552523e93cdSAndrei Emeltchenko 553523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK 0x0436 554523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link { 555523e93cdSAndrei Emeltchenko __u8 phy_handle; 556523e93cdSAndrei Emeltchenko __u8 key_len; 557523e93cdSAndrei Emeltchenko __u8 key_type; 558523e93cdSAndrei Emeltchenko __u8 key[HCI_AMP_LINK_KEY_SIZE]; 559523e93cdSAndrei Emeltchenko } __packed; 560523e93cdSAndrei Emeltchenko 561523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK 0x0437 562523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link { 563523e93cdSAndrei Emeltchenko __u8 phy_handle; 564523e93cdSAndrei Emeltchenko __u8 reason; 565b078b564SAndrei Emeltchenko } __packed; 566b078b564SAndrei Emeltchenko 567b078b564SAndrei Emeltchenko struct ext_flow_spec { 568b078b564SAndrei Emeltchenko __u8 id; 569b078b564SAndrei Emeltchenko __u8 stype; 570b078b564SAndrei Emeltchenko __le16 msdu; 571b078b564SAndrei Emeltchenko __le32 sdu_itime; 572b078b564SAndrei Emeltchenko __le32 acc_lat; 573b078b564SAndrei Emeltchenko __le32 flush_to; 574b078b564SAndrei Emeltchenko } __packed; 575b078b564SAndrei Emeltchenko 576b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK 0x0438 577b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439 578b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link { 579b078b564SAndrei Emeltchenko __u8 phy_handle; 580b078b564SAndrei Emeltchenko struct ext_flow_spec tx_flow_spec; 581b078b564SAndrei Emeltchenko struct ext_flow_spec rx_flow_spec; 582b078b564SAndrei Emeltchenko } __packed; 583b078b564SAndrei Emeltchenko 584b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK 0x043a 585b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link { 586b078b564SAndrei Emeltchenko __le16 log_handle; 587b078b564SAndrei Emeltchenko } __packed; 588b078b564SAndrei Emeltchenko 589b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL 0x043b 590b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel { 591b078b564SAndrei Emeltchenko __u8 phy_handle; 592b078b564SAndrei Emeltchenko __u8 flow_spec_id; 593b078b564SAndrei Emeltchenko } __packed; 594b078b564SAndrei Emeltchenko 595b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel { 596b078b564SAndrei Emeltchenko __u8 status; 597b078b564SAndrei Emeltchenko __u8 phy_handle; 598b078b564SAndrei Emeltchenko __u8 flow_spec_id; 599523e93cdSAndrei Emeltchenko } __packed; 600523e93cdSAndrei Emeltchenko 601a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 602a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 603a9de9248SMarcel Holtmann __le16 handle; 604a9de9248SMarcel Holtmann __le16 max_interval; 605a9de9248SMarcel Holtmann __le16 min_interval; 606a9de9248SMarcel Holtmann __le16 attempt; 607a9de9248SMarcel Holtmann __le16 timeout; 60866c853ccSGustavo F. Padovan } __packed; 609a9de9248SMarcel Holtmann 610a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 611a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 612a9de9248SMarcel Holtmann __le16 handle; 61366c853ccSGustavo F. Padovan } __packed; 614a9de9248SMarcel Holtmann 615a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 616a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 617a9de9248SMarcel Holtmann __le16 handle; 61866c853ccSGustavo F. Padovan } __packed; 619a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 620a9de9248SMarcel Holtmann __u8 status; 621a9de9248SMarcel Holtmann __le16 handle; 622a9de9248SMarcel Holtmann __u8 role; 62366c853ccSGustavo F. Padovan } __packed; 624a9de9248SMarcel Holtmann 625a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 626a9de9248SMarcel Holtmann struct hci_cp_switch_role { 627a9de9248SMarcel Holtmann bdaddr_t bdaddr; 628a9de9248SMarcel Holtmann __u8 role; 62966c853ccSGustavo F. Padovan } __packed; 630a9de9248SMarcel Holtmann 631a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 632a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 633a9de9248SMarcel Holtmann __le16 handle; 63466c853ccSGustavo F. Padovan } __packed; 635a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 636a9de9248SMarcel Holtmann __u8 status; 637a9de9248SMarcel Holtmann __le16 handle; 638a9de9248SMarcel Holtmann __le16 policy; 63966c853ccSGustavo F. Padovan } __packed; 640a9de9248SMarcel Holtmann 641a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 642a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 643a9de9248SMarcel Holtmann __le16 handle; 644a9de9248SMarcel Holtmann __le16 policy; 64566c853ccSGustavo F. Padovan } __packed; 646a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 647a9de9248SMarcel Holtmann __u8 status; 648a9de9248SMarcel Holtmann __le16 handle; 64966c853ccSGustavo F. Padovan } __packed; 650a9de9248SMarcel Holtmann 651e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 652e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy { 653e4e8e37cSMarcel Holtmann __u8 status; 654e4e8e37cSMarcel Holtmann __le16 policy; 65566c853ccSGustavo F. Padovan } __packed; 656e4e8e37cSMarcel Holtmann 657e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 658e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy { 659e4e8e37cSMarcel Holtmann __le16 policy; 66066c853ccSGustavo F. Padovan } __packed; 661e4e8e37cSMarcel Holtmann 662a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 663a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 664a9de9248SMarcel Holtmann __le16 handle; 665a9de9248SMarcel Holtmann __le16 max_latency; 666a9de9248SMarcel Holtmann __le16 min_remote_timeout; 667a9de9248SMarcel Holtmann __le16 min_local_timeout; 66866c853ccSGustavo F. Padovan } __packed; 669a9de9248SMarcel Holtmann 670a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 671a9de9248SMarcel Holtmann struct hci_cp_set_event_mask { 672a9de9248SMarcel Holtmann __u8 mask[8]; 67366c853ccSGustavo F. Padovan } __packed; 674a9de9248SMarcel Holtmann 675a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 676a9de9248SMarcel Holtmann 677a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 6781da177e4SLinus Torvalds struct hci_cp_set_event_flt { 6791da177e4SLinus Torvalds __u8 flt_type; 6801da177e4SLinus Torvalds __u8 cond_type; 6811da177e4SLinus Torvalds __u8 condition[0]; 68266c853ccSGustavo F. Padovan } __packed; 6831da177e4SLinus Torvalds 6841da177e4SLinus Torvalds /* Filter types */ 6851da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 6861da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 6871da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 6881da177e4SLinus Torvalds 6891da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 6901da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 6911da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 6921da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 6931da177e4SLinus Torvalds 6941da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 6951da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 6961da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 6971da177e4SLinus Torvalds 698b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 699b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key { 700b0916ea0SJohan Hedberg bdaddr_t bdaddr; 701b0916ea0SJohan Hedberg __u8 delete_all; 702b0916ea0SJohan Hedberg } __packed; 703b0916ea0SJohan Hedberg 7041f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH 248 7051f6c6378SJohan Hedberg 706a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 707a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 7081f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 70966c853ccSGustavo F. Padovan } __packed; 710a9de9248SMarcel Holtmann 711a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 712a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 713a9de9248SMarcel Holtmann __u8 status; 7141f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 71566c853ccSGustavo F. Padovan } __packed; 716a9de9248SMarcel Holtmann 717a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 718a9de9248SMarcel Holtmann 719a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 720a9de9248SMarcel Holtmann 721a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 722a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 723a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 724a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 725a9de9248SMarcel Holtmann 726a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 727a9de9248SMarcel Holtmann 728a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 729a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 730a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 731a9de9248SMarcel Holtmann 732a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 733a9de9248SMarcel Holtmann 734a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 735a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 736a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 737a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 738a9de9248SMarcel Holtmann 739a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 740a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 7411da177e4SLinus Torvalds __u8 status; 7421da177e4SLinus Torvalds __u8 dev_class[3]; 74366c853ccSGustavo F. Padovan } __packed; 7441da177e4SLinus Torvalds 745a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 746a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 7471da177e4SLinus Torvalds __u8 dev_class[3]; 74866c853ccSGustavo F. Padovan } __packed; 7491da177e4SLinus Torvalds 750a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 7511da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 7521da177e4SLinus Torvalds __u8 status; 7531ebb9252SMarcel Holtmann __le16 voice_setting; 75466c853ccSGustavo F. Padovan } __packed; 7551da177e4SLinus Torvalds 756a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 7571da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 7581ebb9252SMarcel Holtmann __le16 voice_setting; 75966c853ccSGustavo F. Padovan } __packed; 7601da177e4SLinus Torvalds 761a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 7621da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 7631ebb9252SMarcel Holtmann __le16 acl_mtu; 7641da177e4SLinus Torvalds __u8 sco_mtu; 7651ebb9252SMarcel Holtmann __le16 acl_max_pkt; 7661ebb9252SMarcel Holtmann __le16 sco_max_pkt; 76766c853ccSGustavo F. Padovan } __packed; 7681da177e4SLinus Torvalds 769d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 770d5859e22SJohan Hedberg 77180a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH 240 77280a1e1dbSJohan Hedberg 77380a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR 0x0c52 77480a1e1dbSJohan Hedberg struct hci_cp_write_eir { 775816a11d5SJohan Hedberg __u8 fec; 776816a11d5SJohan Hedberg __u8 data[HCI_MAX_EIR_LENGTH]; 77780a1e1dbSJohan Hedberg } __packed; 77880a1e1dbSJohan Hedberg 779333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE 0x0c55 780333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode { 781333140b5SMarcel Holtmann __u8 status; 782333140b5SMarcel Holtmann __u8 mode; 78366c853ccSGustavo F. Padovan } __packed; 784333140b5SMarcel Holtmann 785333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE 0x0c56 786333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode { 787333140b5SMarcel Holtmann __u8 mode; 78866c853ccSGustavo F. Padovan } __packed; 789333140b5SMarcel Holtmann 790c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 791c35938b2SSzymon Janc struct hci_rp_read_local_oob_data { 792c35938b2SSzymon Janc __u8 status; 793c35938b2SSzymon Janc __u8 hash[16]; 794c35938b2SSzymon Janc __u8 randomizer[16]; 795c35938b2SSzymon Janc } __packed; 796c35938b2SSzymon Janc 797d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 79891c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power { 79991c4e9b1SMarcel Holtmann __u8 status; 80091c4e9b1SMarcel Holtmann __s8 tx_power; 80191c4e9b1SMarcel Holtmann } __packed; 802d5859e22SJohan Hedberg 8031e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 8041e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode { 8051e89cffbSAndrei Emeltchenko __u8 status; 8061e89cffbSAndrei Emeltchenko __u8 mode; 8071e89cffbSAndrei Emeltchenko } __packed; 8081e89cffbSAndrei Emeltchenko 809f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 810f9b49306SAndre Guedes struct hci_cp_write_le_host_supported { 811f9b49306SAndre Guedes __u8 le; 812f9b49306SAndre Guedes __u8 simul; 813f9b49306SAndre Guedes } __packed; 814f9b49306SAndre Guedes 815a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 816a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 8171da177e4SLinus Torvalds __u8 status; 818a9de9248SMarcel Holtmann __u8 hci_ver; 819a9de9248SMarcel Holtmann __le16 hci_rev; 820a9de9248SMarcel Holtmann __u8 lmp_ver; 821a9de9248SMarcel Holtmann __le16 manufacturer; 822a9de9248SMarcel Holtmann __le16 lmp_subver; 82366c853ccSGustavo F. Padovan } __packed; 8241da177e4SLinus Torvalds 825a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 826a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 8271da177e4SLinus Torvalds __u8 status; 828a9de9248SMarcel Holtmann __u8 commands[64]; 82966c853ccSGustavo F. Padovan } __packed; 8301da177e4SLinus Torvalds 831a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 832a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 833a9de9248SMarcel Holtmann __u8 status; 834a9de9248SMarcel Holtmann __u8 features[8]; 83566c853ccSGustavo F. Padovan } __packed; 836a9de9248SMarcel Holtmann 837a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 838971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features { 839971e3a4bSAndre Guedes __u8 page; 840971e3a4bSAndre Guedes } __packed; 841a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 842a9de9248SMarcel Holtmann __u8 status; 843a9de9248SMarcel Holtmann __u8 page; 844a9de9248SMarcel Holtmann __u8 max_page; 845a9de9248SMarcel Holtmann __u8 features[8]; 84666c853ccSGustavo F. Padovan } __packed; 847a9de9248SMarcel Holtmann 848a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 849a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 850a9de9248SMarcel Holtmann __u8 status; 851a9de9248SMarcel Holtmann __le16 acl_mtu; 852a9de9248SMarcel Holtmann __u8 sco_mtu; 853a9de9248SMarcel Holtmann __le16 acl_max_pkt; 854a9de9248SMarcel Holtmann __le16 sco_max_pkt; 85566c853ccSGustavo F. Padovan } __packed; 856a9de9248SMarcel Holtmann 857a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 858a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 859a9de9248SMarcel Holtmann __u8 status; 8601da177e4SLinus Torvalds bdaddr_t bdaddr; 86166c853ccSGustavo F. Padovan } __packed; 8621da177e4SLinus Torvalds 863350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a 864350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size { 865350ee4cfSAndrei Emeltchenko __u8 status; 866350ee4cfSAndrei Emeltchenko __le16 max_acl_len; 867350ee4cfSAndrei Emeltchenko __le16 block_len; 868350ee4cfSAndrei Emeltchenko __le16 num_blocks; 869350ee4cfSAndrei Emeltchenko } __packed; 870350ee4cfSAndrei Emeltchenko 871f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 872f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity { 873f6422ec6SAntti Julku __le16 interval; 874f6422ec6SAntti Julku __le16 window; 875f6422ec6SAntti Julku } __packed; 876f6422ec6SAntti Julku 877f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 878f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_STANDARD 0x00 879f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_INTERLACED 0x01 880f6422ec6SAntti Julku 881928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 882928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info { 883928abaa7SAndrei Emeltchenko __u8 status; 884928abaa7SAndrei Emeltchenko __u8 amp_status; 885928abaa7SAndrei Emeltchenko __le32 total_bw; 886928abaa7SAndrei Emeltchenko __le32 max_bw; 887928abaa7SAndrei Emeltchenko __le32 min_latency; 888928abaa7SAndrei Emeltchenko __le32 max_pdu; 889928abaa7SAndrei Emeltchenko __u8 amp_type; 890928abaa7SAndrei Emeltchenko __le16 pal_cap; 891928abaa7SAndrei Emeltchenko __le16 max_assoc_size; 892928abaa7SAndrei Emeltchenko __le32 max_flush_to; 893928abaa7SAndrei Emeltchenko __le32 be_flush_to; 894928abaa7SAndrei Emeltchenko } __packed; 895928abaa7SAndrei Emeltchenko 896523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a 897523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc { 898523e93cdSAndrei Emeltchenko __u8 phy_handle; 899523e93cdSAndrei Emeltchenko __le16 len_so_far; 900523e93cdSAndrei Emeltchenko __le16 max_len; 901523e93cdSAndrei Emeltchenko } __packed; 902523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc { 903523e93cdSAndrei Emeltchenko __u8 status; 904523e93cdSAndrei Emeltchenko __u8 phy_handle; 905523e93cdSAndrei Emeltchenko __le16 rem_len; 906523e93cdSAndrei Emeltchenko __u8 frag[0]; 907523e93cdSAndrei Emeltchenko } __packed; 908523e93cdSAndrei Emeltchenko 909523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b 910523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc { 911523e93cdSAndrei Emeltchenko __u8 phy_handle; 912523e93cdSAndrei Emeltchenko __le16 len_so_far; 913523e93cdSAndrei Emeltchenko __le16 rem_len; 914523e93cdSAndrei Emeltchenko __u8 frag[0]; 915523e93cdSAndrei Emeltchenko } __packed; 916523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc { 917523e93cdSAndrei Emeltchenko __u8 status; 918523e93cdSAndrei Emeltchenko __u8 phy_handle; 919523e93cdSAndrei Emeltchenko } __packed; 920523e93cdSAndrei Emeltchenko 92163185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK 0x2001 92263185f64SVille Tervo struct hci_cp_le_set_event_mask { 92363185f64SVille Tervo __u8 mask[8]; 92463185f64SVille Tervo } __packed; 92563185f64SVille Tervo 92663185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 92763185f64SVille Tervo struct hci_rp_le_read_buffer_size { 92863185f64SVille Tervo __u8 status; 92963185f64SVille Tervo __le16 le_mtu; 93063185f64SVille Tervo __u8 le_max_pkt; 93163185f64SVille Tervo } __packed; 93263185f64SVille Tervo 93307f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM 0x200b 93407f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param { 93507f7fa5dSAndre Guedes __u8 type; 93607f7fa5dSAndre Guedes __le16 interval; 93707f7fa5dSAndre Guedes __le16 window; 93807f7fa5dSAndre Guedes __u8 own_address_type; 93907f7fa5dSAndre Guedes __u8 filter_policy; 94007f7fa5dSAndre Guedes } __packed; 94107f7fa5dSAndre Guedes 94268a8aea4SAndrei Emeltchenko #define LE_SCANNING_DISABLED 0x00 94368a8aea4SAndrei Emeltchenko #define LE_SCANNING_ENABLED 0x01 94468a8aea4SAndrei Emeltchenko 945eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 946eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable { 947eb9d91f5SAndre Guedes __u8 enable; 948eb9d91f5SAndre Guedes __u8 filter_dup; 949eb9d91f5SAndre Guedes } __packed; 950eb9d91f5SAndre Guedes 95163185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN 0x200d 95263185f64SVille Tervo struct hci_cp_le_create_conn { 95363185f64SVille Tervo __le16 scan_interval; 95463185f64SVille Tervo __le16 scan_window; 95563185f64SVille Tervo __u8 filter_policy; 95663185f64SVille Tervo __u8 peer_addr_type; 95763185f64SVille Tervo bdaddr_t peer_addr; 95863185f64SVille Tervo __u8 own_address_type; 95963185f64SVille Tervo __le16 conn_interval_min; 96063185f64SVille Tervo __le16 conn_interval_max; 96163185f64SVille Tervo __le16 conn_latency; 96263185f64SVille Tervo __le16 supervision_timeout; 96363185f64SVille Tervo __le16 min_ce_len; 96463185f64SVille Tervo __le16 max_ce_len; 96563185f64SVille Tervo } __packed; 96663185f64SVille Tervo 96763185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 96863185f64SVille Tervo 9692ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE 0x2013 9702ce603ebSClaudio Takahasi struct hci_cp_le_conn_update { 9712ce603ebSClaudio Takahasi __le16 handle; 9722ce603ebSClaudio Takahasi __le16 conn_interval_min; 9732ce603ebSClaudio Takahasi __le16 conn_interval_max; 9742ce603ebSClaudio Takahasi __le16 conn_latency; 9752ce603ebSClaudio Takahasi __le16 supervision_timeout; 9762ce603ebSClaudio Takahasi __le16 min_ce_len; 9772ce603ebSClaudio Takahasi __le16 max_ce_len; 9782ce603ebSClaudio Takahasi } __packed; 9792ce603ebSClaudio Takahasi 980a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC 0x2019 981a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc { 982a7a595f6SVinicius Costa Gomes __le16 handle; 983a7a595f6SVinicius Costa Gomes __u8 rand[8]; 984a7a595f6SVinicius Costa Gomes __le16 ediv; 985a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 986a7a595f6SVinicius Costa Gomes } __packed; 987a7a595f6SVinicius Costa Gomes 988a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY 0x201a 989a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply { 990a7a595f6SVinicius Costa Gomes __le16 handle; 991a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 992a7a595f6SVinicius Costa Gomes } __packed; 993a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply { 994a7a595f6SVinicius Costa Gomes __u8 status; 995a7a595f6SVinicius Costa Gomes __le16 handle; 996a7a595f6SVinicius Costa Gomes } __packed; 997a7a595f6SVinicius Costa Gomes 998a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY 0x201b 999a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply { 1000a7a595f6SVinicius Costa Gomes __le16 handle; 1001a7a595f6SVinicius Costa Gomes } __packed; 1002a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply { 1003a7a595f6SVinicius Costa Gomes __u8 status; 1004a7a595f6SVinicius Costa Gomes __le16 handle; 1005a7a595f6SVinicius Costa Gomes } __packed; 1006a7a595f6SVinicius Costa Gomes 10071da177e4SLinus Torvalds /* ---- HCI Events ---- */ 10081da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 10091da177e4SLinus Torvalds 10101da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 10111da177e4SLinus Torvalds struct inquiry_info { 10121da177e4SLinus Torvalds bdaddr_t bdaddr; 10131da177e4SLinus Torvalds __u8 pscan_rep_mode; 10141da177e4SLinus Torvalds __u8 pscan_period_mode; 10151da177e4SLinus Torvalds __u8 pscan_mode; 10161da177e4SLinus Torvalds __u8 dev_class[3]; 10171ebb9252SMarcel Holtmann __le16 clock_offset; 101866c853ccSGustavo F. Padovan } __packed; 10191da177e4SLinus Torvalds 10201da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 10211da177e4SLinus Torvalds struct hci_ev_conn_complete { 10221da177e4SLinus Torvalds __u8 status; 10231ebb9252SMarcel Holtmann __le16 handle; 10241da177e4SLinus Torvalds bdaddr_t bdaddr; 10251da177e4SLinus Torvalds __u8 link_type; 10261da177e4SLinus Torvalds __u8 encr_mode; 102766c853ccSGustavo F. Padovan } __packed; 10281da177e4SLinus Torvalds 10291da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 10301da177e4SLinus Torvalds struct hci_ev_conn_request { 10311da177e4SLinus Torvalds bdaddr_t bdaddr; 10321da177e4SLinus Torvalds __u8 dev_class[3]; 10331da177e4SLinus Torvalds __u8 link_type; 103466c853ccSGustavo F. Padovan } __packed; 10351da177e4SLinus Torvalds 10361da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 10371da177e4SLinus Torvalds struct hci_ev_disconn_complete { 10381da177e4SLinus Torvalds __u8 status; 10391ebb9252SMarcel Holtmann __le16 handle; 10401da177e4SLinus Torvalds __u8 reason; 104166c853ccSGustavo F. Padovan } __packed; 10421da177e4SLinus Torvalds 10431da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 10441da177e4SLinus Torvalds struct hci_ev_auth_complete { 10451da177e4SLinus Torvalds __u8 status; 10461ebb9252SMarcel Holtmann __le16 handle; 104766c853ccSGustavo F. Padovan } __packed; 10481da177e4SLinus Torvalds 1049a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 1050a9de9248SMarcel Holtmann struct hci_ev_remote_name { 1051a9de9248SMarcel Holtmann __u8 status; 1052a9de9248SMarcel Holtmann bdaddr_t bdaddr; 10531f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 105466c853ccSGustavo F. Padovan } __packed; 1055a9de9248SMarcel Holtmann 10561da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 10571da177e4SLinus Torvalds struct hci_ev_encrypt_change { 10581da177e4SLinus Torvalds __u8 status; 10591ebb9252SMarcel Holtmann __le16 handle; 10601da177e4SLinus Torvalds __u8 encrypt; 106166c853ccSGustavo F. Padovan } __packed; 10621da177e4SLinus Torvalds 1063a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 1064a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 10651da177e4SLinus Torvalds __u8 status; 10661ebb9252SMarcel Holtmann __le16 handle; 106766c853ccSGustavo F. Padovan } __packed; 10681da177e4SLinus Torvalds 1069a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 1070a9de9248SMarcel Holtmann struct hci_ev_remote_features { 1071a9de9248SMarcel Holtmann __u8 status; 1072a9de9248SMarcel Holtmann __le16 handle; 1073a9de9248SMarcel Holtmann __u8 features[8]; 107466c853ccSGustavo F. Padovan } __packed; 1075a9de9248SMarcel Holtmann 1076a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 1077a9de9248SMarcel Holtmann struct hci_ev_remote_version { 1078a9de9248SMarcel Holtmann __u8 status; 1079a9de9248SMarcel Holtmann __le16 handle; 1080a9de9248SMarcel Holtmann __u8 lmp_ver; 1081a9de9248SMarcel Holtmann __le16 manufacturer; 1082a9de9248SMarcel Holtmann __le16 lmp_subver; 108366c853ccSGustavo F. Padovan } __packed; 1084a9de9248SMarcel Holtmann 1085a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 10861da177e4SLinus Torvalds struct hci_qos { 10871da177e4SLinus Torvalds __u8 service_type; 10881da177e4SLinus Torvalds __u32 token_rate; 10891da177e4SLinus Torvalds __u32 peak_bandwidth; 10901da177e4SLinus Torvalds __u32 latency; 10911da177e4SLinus Torvalds __u32 delay_variation; 109266c853ccSGustavo F. Padovan } __packed; 10931da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 10941da177e4SLinus Torvalds __u8 status; 10951ebb9252SMarcel Holtmann __le16 handle; 10961da177e4SLinus Torvalds struct hci_qos qos; 109766c853ccSGustavo F. Padovan } __packed; 10981da177e4SLinus Torvalds 1099a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 11001da177e4SLinus Torvalds struct hci_ev_cmd_complete { 11011da177e4SLinus Torvalds __u8 ncmd; 11021ebb9252SMarcel Holtmann __le16 opcode; 110366c853ccSGustavo F. Padovan } __packed; 11041da177e4SLinus Torvalds 1105a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 11061da177e4SLinus Torvalds struct hci_ev_cmd_status { 11071da177e4SLinus Torvalds __u8 status; 11081da177e4SLinus Torvalds __u8 ncmd; 11091ebb9252SMarcel Holtmann __le16 opcode; 111066c853ccSGustavo F. Padovan } __packed; 11111da177e4SLinus Torvalds 11121da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 11131da177e4SLinus Torvalds struct hci_ev_role_change { 11141da177e4SLinus Torvalds __u8 status; 11151da177e4SLinus Torvalds bdaddr_t bdaddr; 11161da177e4SLinus Torvalds __u8 role; 111766c853ccSGustavo F. Padovan } __packed; 11181da177e4SLinus Torvalds 1119a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 1120613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info { 1121613a1c0cSAndrei Emeltchenko __le16 handle; 1122613a1c0cSAndrei Emeltchenko __le16 count; 1123613a1c0cSAndrei Emeltchenko } __packed; 1124613a1c0cSAndrei Emeltchenko 1125a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 1126a9de9248SMarcel Holtmann __u8 num_hndl; 1127613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info handles[0]; 112866c853ccSGustavo F. Padovan } __packed; 1129a9de9248SMarcel Holtmann 11301da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 11311da177e4SLinus Torvalds struct hci_ev_mode_change { 11321da177e4SLinus Torvalds __u8 status; 11331ebb9252SMarcel Holtmann __le16 handle; 11341da177e4SLinus Torvalds __u8 mode; 11351ebb9252SMarcel Holtmann __le16 interval; 113666c853ccSGustavo F. Padovan } __packed; 11371da177e4SLinus Torvalds 11381da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 11391da177e4SLinus Torvalds struct hci_ev_pin_code_req { 11401da177e4SLinus Torvalds bdaddr_t bdaddr; 114166c853ccSGustavo F. Padovan } __packed; 11421da177e4SLinus Torvalds 11431da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 11441da177e4SLinus Torvalds struct hci_ev_link_key_req { 11451da177e4SLinus Torvalds bdaddr_t bdaddr; 114666c853ccSGustavo F. Padovan } __packed; 11471da177e4SLinus Torvalds 11481da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 11491da177e4SLinus Torvalds struct hci_ev_link_key_notify { 11501da177e4SLinus Torvalds bdaddr_t bdaddr; 11519b3b4460SAndrei Emeltchenko __u8 link_key[HCI_LINK_KEY_SIZE]; 11521da177e4SLinus Torvalds __u8 key_type; 115366c853ccSGustavo F. Padovan } __packed; 11541da177e4SLinus Torvalds 1155a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 11561da177e4SLinus Torvalds struct hci_ev_clock_offset { 11571da177e4SLinus Torvalds __u8 status; 11581ebb9252SMarcel Holtmann __le16 handle; 11591ebb9252SMarcel Holtmann __le16 clock_offset; 116066c853ccSGustavo F. Padovan } __packed; 11611da177e4SLinus Torvalds 1162a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE 0x1d 1163a8746417SMarcel Holtmann struct hci_ev_pkt_type_change { 1164a8746417SMarcel Holtmann __u8 status; 1165a8746417SMarcel Holtmann __le16 handle; 1166a8746417SMarcel Holtmann __le16 pkt_type; 116766c853ccSGustavo F. Padovan } __packed; 1168a8746417SMarcel Holtmann 116985a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 117085a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 117185a1e930SMarcel Holtmann bdaddr_t bdaddr; 117285a1e930SMarcel Holtmann __u8 pscan_rep_mode; 117366c853ccSGustavo F. Padovan } __packed; 117485a1e930SMarcel Holtmann 1175a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 1176a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 1177a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1178a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1179a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1180a9de9248SMarcel Holtmann __u8 dev_class[3]; 1181a9de9248SMarcel Holtmann __le16 clock_offset; 1182a9de9248SMarcel Holtmann __s8 rssi; 118366c853ccSGustavo F. Padovan } __packed; 1184a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 1185a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1186a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1187a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1188a9de9248SMarcel Holtmann __u8 pscan_mode; 1189a9de9248SMarcel Holtmann __u8 dev_class[3]; 1190a9de9248SMarcel Holtmann __le16 clock_offset; 1191a9de9248SMarcel Holtmann __s8 rssi; 119266c853ccSGustavo F. Padovan } __packed; 1193a9de9248SMarcel Holtmann 1194a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 1195a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 1196a9de9248SMarcel Holtmann __u8 status; 1197a9de9248SMarcel Holtmann __le16 handle; 1198a9de9248SMarcel Holtmann __u8 page; 1199a9de9248SMarcel Holtmann __u8 max_page; 1200a9de9248SMarcel Holtmann __u8 features[8]; 120166c853ccSGustavo F. Padovan } __packed; 1202a9de9248SMarcel Holtmann 1203a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 1204a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 1205a9de9248SMarcel Holtmann __u8 status; 1206a9de9248SMarcel Holtmann __le16 handle; 1207a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1208a9de9248SMarcel Holtmann __u8 link_type; 1209a9de9248SMarcel Holtmann __u8 tx_interval; 1210a9de9248SMarcel Holtmann __u8 retrans_window; 1211a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1212a9de9248SMarcel Holtmann __le16 tx_pkt_len; 1213a9de9248SMarcel Holtmann __u8 air_mode; 121466c853ccSGustavo F. Padovan } __packed; 1215a9de9248SMarcel Holtmann 1216a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 1217a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 1218a9de9248SMarcel Holtmann __u8 status; 1219a9de9248SMarcel Holtmann __le16 handle; 1220a9de9248SMarcel Holtmann __u8 tx_interval; 1221a9de9248SMarcel Holtmann __u8 retrans_window; 1222a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1223a9de9248SMarcel Holtmann __le16 tx_pkt_len; 122466c853ccSGustavo F. Padovan } __packed; 1225a9de9248SMarcel Holtmann 1226a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 122704837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 122804837f64SMarcel Holtmann __u8 status; 122904837f64SMarcel Holtmann __le16 handle; 123004837f64SMarcel Holtmann __le16 max_tx_latency; 123104837f64SMarcel Holtmann __le16 max_rx_latency; 123204837f64SMarcel Holtmann __le16 max_remote_timeout; 123304837f64SMarcel Holtmann __le16 max_local_timeout; 123466c853ccSGustavo F. Padovan } __packed; 123504837f64SMarcel Holtmann 1236a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 1237a9de9248SMarcel Holtmann struct extended_inquiry_info { 1238a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1239a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1240a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1241a9de9248SMarcel Holtmann __u8 dev_class[3]; 1242a9de9248SMarcel Holtmann __le16 clock_offset; 1243a9de9248SMarcel Holtmann __s8 rssi; 1244a9de9248SMarcel Holtmann __u8 data[240]; 124566c853ccSGustavo F. Padovan } __packed; 1246a9de9248SMarcel Holtmann 12471c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE 0x30 12481c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete { 12491c2e0041SJohan Hedberg __u8 status; 12501c2e0041SJohan Hedberg __le16 handle; 12511c2e0041SJohan Hedberg } __packed; 12521c2e0041SJohan Hedberg 12530493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST 0x31 12540493684eSMarcel Holtmann struct hci_ev_io_capa_request { 12550493684eSMarcel Holtmann bdaddr_t bdaddr; 125666c853ccSGustavo F. Padovan } __packed; 12570493684eSMarcel Holtmann 125803b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY 0x32 125903b555e1SJohan Hedberg struct hci_ev_io_capa_reply { 126003b555e1SJohan Hedberg bdaddr_t bdaddr; 126103b555e1SJohan Hedberg __u8 capability; 126203b555e1SJohan Hedberg __u8 oob_data; 126303b555e1SJohan Hedberg __u8 authentication; 126403b555e1SJohan Hedberg } __packed; 126503b555e1SJohan Hedberg 1266a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST 0x33 1267a5c29683SJohan Hedberg struct hci_ev_user_confirm_req { 1268a5c29683SJohan Hedberg bdaddr_t bdaddr; 1269a5c29683SJohan Hedberg __le32 passkey; 1270a5c29683SJohan Hedberg } __packed; 1271a5c29683SJohan Hedberg 12729ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST 0x34 12739ad4019aSBrian Gix struct hci_ev_user_passkey_req { 12749ad4019aSBrian Gix bdaddr_t bdaddr; 12759ad4019aSBrian Gix } __packed; 12769ad4019aSBrian Gix 12772763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 12782763eda6SSzymon Janc struct hci_ev_remote_oob_data_request { 12792763eda6SSzymon Janc bdaddr_t bdaddr; 12802763eda6SSzymon Janc } __packed; 12812763eda6SSzymon Janc 12820493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 12830493684eSMarcel Holtmann struct hci_ev_simple_pair_complete { 12840493684eSMarcel Holtmann __u8 status; 12850493684eSMarcel Holtmann bdaddr_t bdaddr; 128666c853ccSGustavo F. Padovan } __packed; 12870493684eSMarcel Holtmann 128892a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY 0x3b 128992a25256SJohan Hedberg struct hci_ev_user_passkey_notify { 129092a25256SJohan Hedberg bdaddr_t bdaddr; 129192a25256SJohan Hedberg __le32 passkey; 129292a25256SJohan Hedberg } __packed; 129392a25256SJohan Hedberg 129492a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED 0 129592a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED 1 129692a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED 2 129792a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED 3 129892a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED 4 129992a25256SJohan Hedberg 130092a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY 0x3c 130192a25256SJohan Hedberg struct hci_ev_keypress_notify { 130292a25256SJohan Hedberg bdaddr_t bdaddr; 130392a25256SJohan Hedberg __u8 type; 130492a25256SJohan Hedberg } __packed; 130592a25256SJohan Hedberg 130641a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 130741a96212SMarcel Holtmann struct hci_ev_remote_host_features { 130841a96212SMarcel Holtmann bdaddr_t bdaddr; 130941a96212SMarcel Holtmann __u8 features[8]; 131066c853ccSGustavo F. Padovan } __packed; 131141a96212SMarcel Holtmann 131263185f64SVille Tervo #define HCI_EV_LE_META 0x3e 131363185f64SVille Tervo struct hci_ev_le_meta { 131463185f64SVille Tervo __u8 subevent; 131563185f64SVille Tervo } __packed; 131663185f64SVille Tervo 1317523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE 0x40 1318523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete { 1319523e93cdSAndrei Emeltchenko __u8 status; 1320523e93cdSAndrei Emeltchenko __u8 phy_handle; 1321523e93cdSAndrei Emeltchenko } __packed; 1322523e93cdSAndrei Emeltchenko 1323523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED 0x41 1324523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected { 1325523e93cdSAndrei Emeltchenko __u8 phy_handle; 1326523e93cdSAndrei Emeltchenko } __packed; 1327523e93cdSAndrei Emeltchenko 1328523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42 1329523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete { 1330523e93cdSAndrei Emeltchenko __u8 status; 1331523e93cdSAndrei Emeltchenko __u8 phy_handle; 1332523e93cdSAndrei Emeltchenko __u8 reason; 1333523e93cdSAndrei Emeltchenko } __packed; 1334523e93cdSAndrei Emeltchenko 1335523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE 0x45 1336523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete { 1337523e93cdSAndrei Emeltchenko __u8 status; 1338523e93cdSAndrei Emeltchenko __le16 handle; 1339523e93cdSAndrei Emeltchenko __u8 phy_handle; 1340523e93cdSAndrei Emeltchenko __u8 flow_spec_id; 1341523e93cdSAndrei Emeltchenko } __packed; 1342523e93cdSAndrei Emeltchenko 1343523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46 1344523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete { 1345523e93cdSAndrei Emeltchenko __u8 status; 1346523e93cdSAndrei Emeltchenko __le16 handle; 1347523e93cdSAndrei Emeltchenko __u8 reason; 1348523e93cdSAndrei Emeltchenko } __packed; 1349523e93cdSAndrei Emeltchenko 135025e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS 0x48 135125e89e99SAndrei Emeltchenko struct hci_comp_blocks_info { 135225e89e99SAndrei Emeltchenko __le16 handle; 135325e89e99SAndrei Emeltchenko __le16 pkts; 135425e89e99SAndrei Emeltchenko __le16 blocks; 135525e89e99SAndrei Emeltchenko } __packed; 135625e89e99SAndrei Emeltchenko 135725e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks { 135825e89e99SAndrei Emeltchenko __le16 num_blocks; 135925e89e99SAndrei Emeltchenko __u8 num_hndl; 136025e89e99SAndrei Emeltchenko struct hci_comp_blocks_info handles[0]; 136125e89e99SAndrei Emeltchenko } __packed; 136225e89e99SAndrei Emeltchenko 136363185f64SVille Tervo /* Low energy meta events */ 1364b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER 0x00 1365b9b343d2SAndre Guedes 136663185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE 0x01 136763185f64SVille Tervo struct hci_ev_le_conn_complete { 136863185f64SVille Tervo __u8 status; 136963185f64SVille Tervo __le16 handle; 137063185f64SVille Tervo __u8 role; 137163185f64SVille Tervo __u8 bdaddr_type; 137263185f64SVille Tervo bdaddr_t bdaddr; 137363185f64SVille Tervo __le16 interval; 137463185f64SVille Tervo __le16 latency; 137563185f64SVille Tervo __le16 supervision_timeout; 137663185f64SVille Tervo __u8 clk_accurancy; 137763185f64SVille Tervo } __packed; 137863185f64SVille Tervo 1379a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ 0x05 1380a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req { 1381a7a595f6SVinicius Costa Gomes __le16 handle; 1382a7a595f6SVinicius Costa Gomes __u8 random[8]; 1383a7a595f6SVinicius Costa Gomes __le16 ediv; 1384a7a595f6SVinicius Costa Gomes } __packed; 1385a7a595f6SVinicius Costa Gomes 138657a56fd4SAnderson Briglia /* Advertising report event types */ 138757a56fd4SAnderson Briglia #define ADV_IND 0x00 138857a56fd4SAnderson Briglia #define ADV_DIRECT_IND 0x01 138957a56fd4SAnderson Briglia #define ADV_SCAN_IND 0x02 139057a56fd4SAnderson Briglia #define ADV_NONCONN_IND 0x03 139157a56fd4SAnderson Briglia #define ADV_SCAN_RSP 0x04 139257a56fd4SAnderson Briglia 139357a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC 0x00 139457a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM 0x01 139557a56fd4SAnderson Briglia 139657a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT 0x02 139757a56fd4SAnderson Briglia struct hci_ev_le_advertising_info { 139857a56fd4SAnderson Briglia __u8 evt_type; 139957a56fd4SAnderson Briglia __u8 bdaddr_type; 140057a56fd4SAnderson Briglia bdaddr_t bdaddr; 140157a56fd4SAnderson Briglia __u8 length; 140257a56fd4SAnderson Briglia __u8 data[0]; 140357a56fd4SAnderson Briglia } __packed; 140457a56fd4SAnderson Briglia 14051da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 1406a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 14071da177e4SLinus Torvalds struct hci_ev_stack_internal { 14081da177e4SLinus Torvalds __u16 type; 14091da177e4SLinus Torvalds __u8 data[0]; 141066c853ccSGustavo F. Padovan } __packed; 14111da177e4SLinus Torvalds 14121da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 14131da177e4SLinus Torvalds struct hci_ev_si_device { 14141da177e4SLinus Torvalds __u16 event; 14151da177e4SLinus Torvalds __u16 dev_id; 141666c853ccSGustavo F. Padovan } __packed; 14171da177e4SLinus Torvalds 14181da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 14191da177e4SLinus Torvalds struct hci_ev_si_security { 14201da177e4SLinus Torvalds __u16 event; 14211da177e4SLinus Torvalds __u16 proto; 14221da177e4SLinus Torvalds __u16 subproto; 14231da177e4SLinus Torvalds __u8 incoming; 142466c853ccSGustavo F. Padovan } __packed; 14251da177e4SLinus Torvalds 14261da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 14271da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 14281da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 14291da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 14301da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 14311da177e4SLinus Torvalds 14321da177e4SLinus Torvalds struct hci_command_hdr { 14331ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 14341da177e4SLinus Torvalds __u8 plen; 143566c853ccSGustavo F. Padovan } __packed; 14361da177e4SLinus Torvalds 14371da177e4SLinus Torvalds struct hci_event_hdr { 14381da177e4SLinus Torvalds __u8 evt; 14391da177e4SLinus Torvalds __u8 plen; 144066c853ccSGustavo F. Padovan } __packed; 14411da177e4SLinus Torvalds 14421da177e4SLinus Torvalds struct hci_acl_hdr { 14431ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 14441ebb9252SMarcel Holtmann __le16 dlen; 144566c853ccSGustavo F. Padovan } __packed; 14461da177e4SLinus Torvalds 14471da177e4SLinus Torvalds struct hci_sco_hdr { 14481ebb9252SMarcel Holtmann __le16 handle; 14491da177e4SLinus Torvalds __u8 dlen; 145066c853ccSGustavo F. Padovan } __packed; 14511da177e4SLinus Torvalds 14522a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 14532a123b86SArnaldo Carvalho de Melo { 14542a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 14552a123b86SArnaldo Carvalho de Melo } 14562a123b86SArnaldo Carvalho de Melo 14572a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 14582a123b86SArnaldo Carvalho de Melo { 14592a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 14602a123b86SArnaldo Carvalho de Melo } 14612a123b86SArnaldo Carvalho de Melo 14622a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 14632a123b86SArnaldo Carvalho de Melo { 14642a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 14652a123b86SArnaldo Carvalho de Melo } 14662a123b86SArnaldo Carvalho de Melo 14671da177e4SLinus Torvalds /* Command opcode pack/unpack */ 1468c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10))) 14691da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 14701da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 14711da177e4SLinus Torvalds 14721da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 1473c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12))) 14741da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 14751da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 14761da177e4SLinus Torvalds 14771da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 14781da177e4SLinus Torvalds 14791da177e4SLinus Torvalds /* Socket options */ 14801da177e4SLinus Torvalds #define HCI_DATA_DIR 1 14811da177e4SLinus Torvalds #define HCI_FILTER 2 14821da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 14831da177e4SLinus Torvalds 14841da177e4SLinus Torvalds /* CMSG flags */ 14851da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 14861da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 14871da177e4SLinus Torvalds 14881da177e4SLinus Torvalds struct sockaddr_hci { 14891da177e4SLinus Torvalds sa_family_t hci_family; 14901da177e4SLinus Torvalds unsigned short hci_dev; 1491c02178d2SJohan Hedberg unsigned short hci_channel; 14921da177e4SLinus Torvalds }; 14931da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 14941da177e4SLinus Torvalds 1495c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW 0 1496cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR 2 149766f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL 3 1498c02178d2SJohan Hedberg 14991da177e4SLinus Torvalds struct hci_filter { 15001da177e4SLinus Torvalds unsigned long type_mask; 15011da177e4SLinus Torvalds unsigned long event_mask[2]; 1502905f3ed6SAl Viro __le16 opcode; 15031da177e4SLinus Torvalds }; 15041da177e4SLinus Torvalds 15051da177e4SLinus Torvalds struct hci_ufilter { 15061da177e4SLinus Torvalds __u32 type_mask; 15071da177e4SLinus Torvalds __u32 event_mask[2]; 1508905f3ed6SAl Viro __le16 opcode; 15091da177e4SLinus Torvalds }; 15101da177e4SLinus Torvalds 15111da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 15121da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 15131da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 15141da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 15151da177e4SLinus Torvalds 15161da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 15171da177e4SLinus Torvalds struct hci_dev_stats { 15181da177e4SLinus Torvalds __u32 err_rx; 15191da177e4SLinus Torvalds __u32 err_tx; 15201da177e4SLinus Torvalds __u32 cmd_tx; 15211da177e4SLinus Torvalds __u32 evt_rx; 15221da177e4SLinus Torvalds __u32 acl_tx; 15231da177e4SLinus Torvalds __u32 acl_rx; 15241da177e4SLinus Torvalds __u32 sco_tx; 15251da177e4SLinus Torvalds __u32 sco_rx; 15261da177e4SLinus Torvalds __u32 byte_rx; 15271da177e4SLinus Torvalds __u32 byte_tx; 15281da177e4SLinus Torvalds }; 15291da177e4SLinus Torvalds 15301da177e4SLinus Torvalds struct hci_dev_info { 15311da177e4SLinus Torvalds __u16 dev_id; 15321da177e4SLinus Torvalds char name[8]; 15331da177e4SLinus Torvalds 15341da177e4SLinus Torvalds bdaddr_t bdaddr; 15351da177e4SLinus Torvalds 15361da177e4SLinus Torvalds __u32 flags; 15371da177e4SLinus Torvalds __u8 type; 15381da177e4SLinus Torvalds 15391da177e4SLinus Torvalds __u8 features[8]; 15401da177e4SLinus Torvalds 15411da177e4SLinus Torvalds __u32 pkt_type; 15421da177e4SLinus Torvalds __u32 link_policy; 15431da177e4SLinus Torvalds __u32 link_mode; 15441da177e4SLinus Torvalds 15451da177e4SLinus Torvalds __u16 acl_mtu; 15461da177e4SLinus Torvalds __u16 acl_pkts; 15471da177e4SLinus Torvalds __u16 sco_mtu; 15481da177e4SLinus Torvalds __u16 sco_pkts; 15491da177e4SLinus Torvalds 15501da177e4SLinus Torvalds struct hci_dev_stats stat; 15511da177e4SLinus Torvalds }; 15521da177e4SLinus Torvalds 15531da177e4SLinus Torvalds struct hci_conn_info { 15541da177e4SLinus Torvalds __u16 handle; 15551da177e4SLinus Torvalds bdaddr_t bdaddr; 15561da177e4SLinus Torvalds __u8 type; 15571da177e4SLinus Torvalds __u8 out; 15581da177e4SLinus Torvalds __u16 state; 15591da177e4SLinus Torvalds __u32 link_mode; 15601da177e4SLinus Torvalds }; 15611da177e4SLinus Torvalds 15621da177e4SLinus Torvalds struct hci_dev_req { 15631da177e4SLinus Torvalds __u16 dev_id; 15641da177e4SLinus Torvalds __u32 dev_opt; 15651da177e4SLinus Torvalds }; 15661da177e4SLinus Torvalds 15671da177e4SLinus Torvalds struct hci_dev_list_req { 15681da177e4SLinus Torvalds __u16 dev_num; 15691da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 15701da177e4SLinus Torvalds }; 15711da177e4SLinus Torvalds 15721da177e4SLinus Torvalds struct hci_conn_list_req { 15731da177e4SLinus Torvalds __u16 dev_id; 15741da177e4SLinus Torvalds __u16 conn_num; 15751da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 15761da177e4SLinus Torvalds }; 15771da177e4SLinus Torvalds 15781da177e4SLinus Torvalds struct hci_conn_info_req { 15791da177e4SLinus Torvalds bdaddr_t bdaddr; 15801da177e4SLinus Torvalds __u8 type; 15811da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 15821da177e4SLinus Torvalds }; 15831da177e4SLinus Torvalds 158440be492fSMarcel Holtmann struct hci_auth_info_req { 158540be492fSMarcel Holtmann bdaddr_t bdaddr; 158640be492fSMarcel Holtmann __u8 type; 158740be492fSMarcel Holtmann }; 158840be492fSMarcel Holtmann 15891da177e4SLinus Torvalds struct hci_inquiry_req { 15901da177e4SLinus Torvalds __u16 dev_id; 15911da177e4SLinus Torvalds __u16 flags; 15921da177e4SLinus Torvalds __u8 lap[3]; 15931da177e4SLinus Torvalds __u8 length; 15941da177e4SLinus Torvalds __u8 num_rsp; 15951da177e4SLinus Torvalds }; 15961da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 15971da177e4SLinus Torvalds 15988b281b9cSFabio Estevam extern bool enable_hs; 15998830f514SAndrei Emeltchenko 16001da177e4SLinus Torvalds #endif /* __HCI_H */ 1601