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 36903e4541SAndrei Emeltchenko #define HCI_MAX_AMP_ASSOC_SIZE 672 37903e4541SAndrei Emeltchenko 38*7d1dab49SDoHyun Pyun #define HCI_MAX_CSB_DATA_SIZE 252 39*7d1dab49SDoHyun Pyun 401da177e4SLinus Torvalds /* HCI dev events */ 411da177e4SLinus Torvalds #define HCI_DEV_REG 1 421da177e4SLinus Torvalds #define HCI_DEV_UNREG 2 431da177e4SLinus Torvalds #define HCI_DEV_UP 3 441da177e4SLinus Torvalds #define HCI_DEV_DOWN 4 451da177e4SLinus Torvalds #define HCI_DEV_SUSPEND 5 461da177e4SLinus Torvalds #define HCI_DEV_RESUME 6 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds /* HCI notify events */ 491da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD 1 501da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL 2 511da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING 3 521da177e4SLinus Torvalds 53c13854ceSMarcel Holtmann /* HCI bus types */ 540ac53939SMarcel Holtmann #define HCI_VIRTUAL 0 551da177e4SLinus Torvalds #define HCI_USB 1 561da177e4SLinus Torvalds #define HCI_PCCARD 2 571da177e4SLinus Torvalds #define HCI_UART 3 581da177e4SLinus Torvalds #define HCI_RS232 4 591da177e4SLinus Torvalds #define HCI_PCI 5 600ac53939SMarcel Holtmann #define HCI_SDIO 6 611da177e4SLinus Torvalds 62943da25dSMarcel Holtmann /* HCI controller types */ 63943da25dSMarcel Holtmann #define HCI_BREDR 0x00 648f1e1742SDavid Vrabel #define HCI_AMP 0x01 65943da25dSMarcel Holtmann 668598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */ 678598d064SAndrei Emeltchenko #define HCI_BREDR_ID 0 688598d064SAndrei Emeltchenko 69ab846ec4SAndrei Emeltchenko /* AMP controller status */ 70ab846ec4SAndrei Emeltchenko #define AMP_CTRL_POWERED_DOWN 0x00 71ab846ec4SAndrei Emeltchenko #define AMP_CTRL_BLUETOOTH_ONLY 0x01 72ab846ec4SAndrei Emeltchenko #define AMP_CTRL_NO_CAPACITY 0x02 73ab846ec4SAndrei Emeltchenko #define AMP_CTRL_LOW_CAPACITY 0x03 74ab846ec4SAndrei Emeltchenko #define AMP_CTRL_MEDIUM_CAPACITY 0x04 75ab846ec4SAndrei Emeltchenko #define AMP_CTRL_HIGH_CAPACITY 0x05 76ab846ec4SAndrei Emeltchenko #define AMP_CTRL_FULL_CAPACITY 0x06 77ab846ec4SAndrei Emeltchenko 781da177e4SLinus Torvalds /* HCI device quirks */ 791da177e4SLinus Torvalds enum { 80a6c511c6SSzymon Janc HCI_QUIRK_RESET_ON_CLOSE, 81da1f5198SMarcel Holtmann HCI_QUIRK_RAW_DEVICE, 82da1f5198SMarcel Holtmann HCI_QUIRK_FIXUP_BUFFER_SIZE 831da177e4SLinus Torvalds }; 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds /* HCI device flags */ 861da177e4SLinus Torvalds enum { 871da177e4SLinus Torvalds HCI_UP, 881da177e4SLinus Torvalds HCI_INIT, 891da177e4SLinus Torvalds HCI_RUNNING, 901da177e4SLinus Torvalds 911da177e4SLinus Torvalds HCI_PSCAN, 921da177e4SLinus Torvalds HCI_ISCAN, 931da177e4SLinus Torvalds HCI_AUTH, 941da177e4SLinus Torvalds HCI_ENCRYPT, 951da177e4SLinus Torvalds HCI_INQUIRY, 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds HCI_RAW, 98ab81cbf9SJohan Hedberg 9910572132SGustavo F. Padovan HCI_RESET, 1001da177e4SLinus Torvalds }; 1011da177e4SLinus Torvalds 102d23264a8SAndre Guedes /* 103d23264a8SAndre Guedes * BR/EDR and/or LE controller flags: the flags defined here should represent 104d23264a8SAndre Guedes * states from the controller. 105d23264a8SAndre Guedes */ 106d23264a8SAndre Guedes enum { 107a8b2d5c2SJohan Hedberg HCI_SETUP, 108a8b2d5c2SJohan Hedberg HCI_AUTO_OFF, 1095e130367SJohan Hedberg HCI_RFKILLED, 110a8b2d5c2SJohan Hedberg HCI_MGMT, 111a8b2d5c2SJohan Hedberg HCI_PAIRABLE, 112a8b2d5c2SJohan Hedberg HCI_SERVICE_CACHE, 113a8b2d5c2SJohan Hedberg HCI_DEBUG_KEYS, 11494324962SJohan Hovold HCI_UNREGISTER, 1150736cfa8SMarcel Holtmann HCI_USER_CHANNEL, 116a8b2d5c2SJohan Hedberg 117d23264a8SAndre Guedes HCI_LE_SCAN, 11884bde9d6SJohan Hedberg HCI_SSP_ENABLED, 1196d80dfd0SJohan Hedberg HCI_HS_ENABLED, 12006199cf8SJohan Hedberg HCI_LE_ENABLED, 12133f8f526SJohan Hedberg HCI_LE_PERIPHERAL, 1225e5282bbSJohan Hedberg HCI_CONNECTABLE, 1235e5282bbSJohan Hedberg HCI_DISCOVERABLE, 12447990ea0SJohan Hedberg HCI_LINK_SECURITY, 12521693c15SAndre Guedes HCI_PERIODIC_INQ, 1261a4d3c4bSJohan Hedberg HCI_FAST_CONNECTABLE, 12756f87901SJohan Hedberg HCI_BREDR_ENABLED, 128d23264a8SAndre Guedes }; 129d23264a8SAndre Guedes 1302cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens 1312cc6fb00SJohan Hedberg * or the HCI device is closed. 1322cc6fb00SJohan Hedberg */ 1331a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ 1341a4d3c4bSJohan Hedberg BIT(HCI_FAST_CONNECTABLE)) 1352cc6fb00SJohan Hedberg 1361da177e4SLinus Torvalds /* HCI ioctl defines */ 1371da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 1381da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 1391da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 1401da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 1411da177e4SLinus Torvalds 1421da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 1431da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 1441da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 1451da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 14640be492fSMarcel Holtmann #define HCIGETAUTHINFO _IOR('H', 215, int) 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 1491da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 1501da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 1511da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 1521da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 1531da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 1541da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 1551da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 1561da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 1571da177e4SLinus Torvalds 158f0358568SJohan Hedberg #define HCIBLOCKADDR _IOW('H', 230, int) 159f0358568SJohan Hedberg #define HCIUNBLOCKADDR _IOW('H', 231, int) 160f0358568SJohan Hedberg 1611da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1621da177e4SLinus Torvalds 1631da177e4SLinus Torvalds /* HCI timeouts */ 1645f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 1655f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 1665f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ 167d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 1685f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 1699345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 1701da177e4SLinus Torvalds 1715b7f9909SMarcel Holtmann /* HCI data types */ 1721da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1731da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1741da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1751da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1761da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1771da177e4SLinus Torvalds 1785b7f9909SMarcel Holtmann /* HCI packet types */ 1791da177e4SLinus Torvalds #define HCI_DM1 0x0008 1801da177e4SLinus Torvalds #define HCI_DM3 0x0400 1811da177e4SLinus Torvalds #define HCI_DM5 0x4000 1821da177e4SLinus Torvalds #define HCI_DH1 0x0010 1831da177e4SLinus Torvalds #define HCI_DH3 0x0800 1841da177e4SLinus Torvalds #define HCI_DH5 0x8000 1851da177e4SLinus Torvalds 1861da177e4SLinus Torvalds #define HCI_HV1 0x0020 1871da177e4SLinus Torvalds #define HCI_HV2 0x0040 1881da177e4SLinus Torvalds #define HCI_HV3 0x0080 1891da177e4SLinus Torvalds 1901da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1911da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1921da177e4SLinus Torvalds 1935b7f9909SMarcel Holtmann /* eSCO packet types */ 1945b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1955b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1965b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1975b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1985b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1995b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 200efc7688bSMarcel Holtmann #define ESCO_2EV3 0x0040 201efc7688bSMarcel Holtmann #define ESCO_3EV3 0x0080 202efc7688bSMarcel Holtmann #define ESCO_2EV5 0x0100 203efc7688bSMarcel Holtmann #define ESCO_3EV5 0x0200 2045b7f9909SMarcel Holtmann 205a8746417SMarcel Holtmann #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 206efc7688bSMarcel Holtmann #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 207a8746417SMarcel Holtmann 2081da177e4SLinus Torvalds /* ACL flags */ 209e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH 0x00 2101da177e4SLinus Torvalds #define ACL_CONT 0x01 2111da177e4SLinus Torvalds #define ACL_START 0x02 212d73a0988SAndrei Emeltchenko #define ACL_COMPLETE 0x03 2131da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 2141da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 2151da177e4SLinus Torvalds 2161da177e4SLinus Torvalds /* Baseband links */ 2171da177e4SLinus Torvalds #define SCO_LINK 0x00 2181da177e4SLinus Torvalds #define ACL_LINK 0x01 2195b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 220fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */ 221fcd89c09SVille Tervo #define LE_LINK 0x80 2223161ae1cSAndrei Emeltchenko #define AMP_LINK 0x81 2231da177e4SLinus Torvalds 2241da177e4SLinus Torvalds /* LMP features */ 2251da177e4SLinus Torvalds #define LMP_3SLOT 0x01 2261da177e4SLinus Torvalds #define LMP_5SLOT 0x02 2271da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 2281da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 2291da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 2301da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 2311da177e4SLinus Torvalds #define LMP_HOLD 0x40 23204837f64SMarcel Holtmann #define LMP_SNIFF 0x80 2331da177e4SLinus Torvalds 2341da177e4SLinus Torvalds #define LMP_PARK 0x01 2351da177e4SLinus Torvalds #define LMP_RSSI 0x02 2361da177e4SLinus Torvalds #define LMP_QUALITY 0x04 2371da177e4SLinus Torvalds #define LMP_SCO 0x08 2381da177e4SLinus Torvalds #define LMP_HV2 0x10 2391da177e4SLinus Torvalds #define LMP_HV3 0x20 2401da177e4SLinus Torvalds #define LMP_ULAW 0x40 2411da177e4SLinus Torvalds #define LMP_ALAW 0x80 2421da177e4SLinus Torvalds 2431da177e4SLinus Torvalds #define LMP_CVSD 0x01 2441da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 2451da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 24607a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT 0x08 2471da177e4SLinus Torvalds 248d5859e22SJohan Hedberg #define LMP_RSSI_INQ 0x40 2495b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 2505b7f9909SMarcel Holtmann 2515b7f9909SMarcel Holtmann #define LMP_EV4 0x01 2525b7f9909SMarcel Holtmann #define LMP_EV5 0x02 25369ab39eaSJohan Hedberg #define LMP_NO_BREDR 0x20 254d5859e22SJohan Hedberg #define LMP_LE 0x40 2555b7f9909SMarcel Holtmann 25604837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 257d5859e22SJohan Hedberg #define LMP_PAUSE_ENC 0x04 258efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M 0x20 259efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M 0x40 260efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO 0x80 26104837f64SMarcel Holtmann 262d5859e22SJohan Hedberg #define LMP_EXT_INQ 0x01 263e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR 0x02 264769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR 0x08 265e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH 0x40 266769be974SMarcel Holtmann 267d5859e22SJohan Hedberg #define LMP_LSTO 0x01 268d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR 0x02 269971e3a4bSAndre Guedes #define LMP_EXTFEATURES 0x80 270d5859e22SJohan Hedberg 271eead27daSAndre Guedes /* Extended LMP features */ 272cc2c04ecSJohan Hedberg #define LMP_HOST_SSP 0x01 273eead27daSAndre Guedes #define LMP_HOST_LE 0x02 274cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR 0x04 275eead27daSAndre Guedes 27604837f64SMarcel Holtmann /* Connection modes */ 27704837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 27804837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 27904837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 28004837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 28104837f64SMarcel Holtmann 2821da177e4SLinus Torvalds /* Link policies */ 2831da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 2841da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 2851da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 2861da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 2871da177e4SLinus Torvalds 28804837f64SMarcel Holtmann /* Link modes */ 2891da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 2901da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 2911da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 2921da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 2931da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 2941da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2951da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2961da177e4SLinus Torvalds 29740be492fSMarcel Holtmann /* Authentication types */ 29840be492fSMarcel Holtmann #define HCI_AT_NO_BONDING 0x00 29940be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM 0x01 30040be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING 0x02 30140be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM 0x03 30240be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING 0x04 30340be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM 0x05 30440be492fSMarcel Holtmann 305a77b15a6SMikel Astiz /* I/O capabilities */ 306a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY 0x00 307a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO 0x01 308a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY 0x02 309a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT 0x03 310a77b15a6SMikel Astiz 311b6020ba0SWaldemar Rymarkiewicz /* Link Key types */ 312b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION 0x00 313b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT 0x01 314b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT 0x02 315b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION 0x03 316b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION 0x04 317b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION 0x05 318b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION 0x06 319b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ 320b899efafSVinicius Costa Gomes #define HCI_SMP_STK 0x80 321b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE 0x81 322b899efafSVinicius Costa Gomes #define HCI_SMP_LTK 0x82 323b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE 0x83 324b6020ba0SWaldemar Rymarkiewicz 3259f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */ 3269f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE 0x05 327cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 3289f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR 0x0f 3299f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM 0x13 330cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 331cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF 0x15 3329f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM 0x16 3339f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 3349f5a0d7bSAndrei Emeltchenko 3352455a3eaSAndrei Emeltchenko /* Flow control modes */ 3362455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 3372455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 3382455a3eaSAndrei Emeltchenko 339bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */ 340bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID 127 341bbaf444aSJohan Hedberg 34232748db0SJohan Hedberg /* Extended Inquiry Response field types */ 34332748db0SJohan Hedberg #define EIR_FLAGS 0x01 /* flags */ 34432748db0SJohan Hedberg #define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 34532748db0SJohan Hedberg #define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ 34632748db0SJohan Hedberg #define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ 34732748db0SJohan Hedberg #define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ 34832748db0SJohan Hedberg #define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ 34932748db0SJohan Hedberg #define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ 35032748db0SJohan Hedberg #define EIR_NAME_SHORT 0x08 /* shortened local name */ 35132748db0SJohan Hedberg #define EIR_NAME_COMPLETE 0x09 /* complete local name */ 35232748db0SJohan Hedberg #define EIR_TX_POWER 0x0A /* transmit power level */ 3539ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ 3549ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */ 3559ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ 35632748db0SJohan Hedberg #define EIR_DEVICE_ID 0x10 /* device ID */ 35732748db0SJohan Hedberg 3583f0f524bSJohan Hedberg /* Low Energy Advertising Flags */ 3593f0f524bSJohan Hedberg #define LE_AD_LIMITED 0x01 /* Limited Discoverable */ 3603f0f524bSJohan Hedberg #define LE_AD_GENERAL 0x02 /* General Discoverable */ 3613f0f524bSJohan Hedberg #define LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */ 3623f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL 0x08 /* Simultaneous LE & BR/EDR Controller */ 3633f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST 0x10 /* Simultaneous LE & BR/EDR Host */ 3643f0f524bSJohan Hedberg 3651da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 3666bd32326SVille Tervo #define HCI_OP_NOP 0x0000 3676bd32326SVille Tervo 368a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 369a9de9248SMarcel Holtmann struct hci_cp_inquiry { 370a9de9248SMarcel Holtmann __u8 lap[3]; 371a9de9248SMarcel Holtmann __u8 length; 372a9de9248SMarcel Holtmann __u8 num_rsp; 37366c853ccSGustavo F. Padovan } __packed; 3741da177e4SLinus Torvalds 375a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 376a9de9248SMarcel Holtmann 37779d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ 0x0403 37879d6e068SAndre Guedes 379a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 380a9de9248SMarcel Holtmann 381a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 382a9de9248SMarcel Holtmann struct hci_cp_create_conn { 383a9de9248SMarcel Holtmann bdaddr_t bdaddr; 384a9de9248SMarcel Holtmann __le16 pkt_type; 385a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 386a9de9248SMarcel Holtmann __u8 pscan_mode; 387a9de9248SMarcel Holtmann __le16 clock_offset; 388a9de9248SMarcel Holtmann __u8 role_switch; 38966c853ccSGustavo F. Padovan } __packed; 3901da177e4SLinus Torvalds 391a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 392a9de9248SMarcel Holtmann struct hci_cp_disconnect { 393a9de9248SMarcel Holtmann __le16 handle; 394a9de9248SMarcel Holtmann __u8 reason; 39566c853ccSGustavo F. Padovan } __packed; 3961da177e4SLinus Torvalds 397a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 398a9de9248SMarcel Holtmann struct hci_cp_add_sco { 399a9de9248SMarcel Holtmann __le16 handle; 400a9de9248SMarcel Holtmann __le16 pkt_type; 40166c853ccSGustavo F. Padovan } __packed; 402a9de9248SMarcel Holtmann 403a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 404a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 4051da177e4SLinus Torvalds bdaddr_t bdaddr; 40666c853ccSGustavo F. Padovan } __packed; 4071da177e4SLinus Torvalds 408a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 409a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 410a9de9248SMarcel Holtmann bdaddr_t bdaddr; 411a9de9248SMarcel Holtmann __u8 role; 41266c853ccSGustavo F. Padovan } __packed; 4131da177e4SLinus Torvalds 414a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 415a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 416a9de9248SMarcel Holtmann bdaddr_t bdaddr; 417a9de9248SMarcel Holtmann __u8 reason; 41866c853ccSGustavo F. Padovan } __packed; 4191da177e4SLinus Torvalds 420a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 421a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 422a9de9248SMarcel Holtmann bdaddr_t bdaddr; 4239b3b4460SAndrei Emeltchenko __u8 link_key[HCI_LINK_KEY_SIZE]; 42466c853ccSGustavo F. Padovan } __packed; 4251da177e4SLinus Torvalds 426a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 427a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 428a9de9248SMarcel Holtmann bdaddr_t bdaddr; 42966c853ccSGustavo F. Padovan } __packed; 4301da177e4SLinus Torvalds 431a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 432a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 433a9de9248SMarcel Holtmann bdaddr_t bdaddr; 434a9de9248SMarcel Holtmann __u8 pin_len; 435a9de9248SMarcel Holtmann __u8 pin_code[16]; 43666c853ccSGustavo F. Padovan } __packed; 437980e1a53SJohan Hedberg struct hci_rp_pin_code_reply { 438980e1a53SJohan Hedberg __u8 status; 439980e1a53SJohan Hedberg bdaddr_t bdaddr; 440980e1a53SJohan Hedberg } __packed; 441a9de9248SMarcel Holtmann 442a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 443a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 444a9de9248SMarcel Holtmann bdaddr_t bdaddr; 44566c853ccSGustavo F. Padovan } __packed; 446980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply { 447980e1a53SJohan Hedberg __u8 status; 448980e1a53SJohan Hedberg bdaddr_t bdaddr; 449980e1a53SJohan Hedberg } __packed; 450a9de9248SMarcel Holtmann 451a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 452a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 453a9de9248SMarcel Holtmann __le16 handle; 454a9de9248SMarcel Holtmann __le16 pkt_type; 45566c853ccSGustavo F. Padovan } __packed; 456a9de9248SMarcel Holtmann 457a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 458a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 459a9de9248SMarcel Holtmann __le16 handle; 46066c853ccSGustavo F. Padovan } __packed; 461a9de9248SMarcel Holtmann 462a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 463a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 464a9de9248SMarcel Holtmann __le16 handle; 465a9de9248SMarcel Holtmann __u8 encrypt; 46666c853ccSGustavo F. Padovan } __packed; 467a9de9248SMarcel Holtmann 468a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 469a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 470a9de9248SMarcel Holtmann __le16 handle; 47166c853ccSGustavo F. Padovan } __packed; 472a9de9248SMarcel Holtmann 473a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 474a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 475a9de9248SMarcel Holtmann bdaddr_t bdaddr; 476a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 477a9de9248SMarcel Holtmann __u8 pscan_mode; 478a9de9248SMarcel Holtmann __le16 clock_offset; 47966c853ccSGustavo F. Padovan } __packed; 480a9de9248SMarcel Holtmann 481a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 482a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 483a9de9248SMarcel Holtmann bdaddr_t bdaddr; 48466c853ccSGustavo F. Padovan } __packed; 485a9de9248SMarcel Holtmann 486a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 487a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 488a9de9248SMarcel Holtmann __le16 handle; 48966c853ccSGustavo F. Padovan } __packed; 490a9de9248SMarcel Holtmann 491a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 492a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 493a9de9248SMarcel Holtmann __le16 handle; 494a9de9248SMarcel Holtmann __u8 page; 49566c853ccSGustavo F. Padovan } __packed; 496a9de9248SMarcel Holtmann 497a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 498a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 499a9de9248SMarcel Holtmann __le16 handle; 50066c853ccSGustavo F. Padovan } __packed; 501a9de9248SMarcel Holtmann 502a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 503a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 504a9de9248SMarcel Holtmann __le16 handle; 505a9de9248SMarcel Holtmann __le32 tx_bandwidth; 506a9de9248SMarcel Holtmann __le32 rx_bandwidth; 507a9de9248SMarcel Holtmann __le16 max_latency; 508a9de9248SMarcel Holtmann __le16 voice_setting; 509a9de9248SMarcel Holtmann __u8 retrans_effort; 510a9de9248SMarcel Holtmann __le16 pkt_type; 51166c853ccSGustavo F. Padovan } __packed; 512a9de9248SMarcel Holtmann 513a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 514a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 515a9de9248SMarcel Holtmann bdaddr_t bdaddr; 516a9de9248SMarcel Holtmann __le32 tx_bandwidth; 517a9de9248SMarcel Holtmann __le32 rx_bandwidth; 518a9de9248SMarcel Holtmann __le16 max_latency; 519a9de9248SMarcel Holtmann __le16 content_format; 520a9de9248SMarcel Holtmann __u8 retrans_effort; 521a9de9248SMarcel Holtmann __le16 pkt_type; 52266c853ccSGustavo F. Padovan } __packed; 523a9de9248SMarcel Holtmann 524a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 525a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 526a9de9248SMarcel Holtmann bdaddr_t bdaddr; 527a9de9248SMarcel Holtmann __u8 reason; 52866c853ccSGustavo F. Padovan } __packed; 529a9de9248SMarcel Holtmann 53017fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY 0x042b 53117fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply { 53217fa4b9dSJohan Hedberg bdaddr_t bdaddr; 53317fa4b9dSJohan Hedberg __u8 capability; 53417fa4b9dSJohan Hedberg __u8 oob_data; 53517fa4b9dSJohan Hedberg __u8 authentication; 53617fa4b9dSJohan Hedberg } __packed; 53717fa4b9dSJohan Hedberg 538a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY 0x042c 539a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply { 540a5c29683SJohan Hedberg bdaddr_t bdaddr; 541a5c29683SJohan Hedberg } __packed; 542a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply { 543a5c29683SJohan Hedberg __u8 status; 544a5c29683SJohan Hedberg bdaddr_t bdaddr; 545a5c29683SJohan Hedberg } __packed; 546a5c29683SJohan Hedberg 547a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 548a5c29683SJohan Hedberg 5499ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY 0x042e 5509ad4019aSBrian Gix struct hci_cp_user_passkey_reply { 5519ad4019aSBrian Gix bdaddr_t bdaddr; 5529ad4019aSBrian Gix __le32 passkey; 5539ad4019aSBrian Gix } __packed; 5549ad4019aSBrian Gix 5559ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f 5569ad4019aSBrian Gix 5572763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 5582763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply { 5592763eda6SSzymon Janc bdaddr_t bdaddr; 5602763eda6SSzymon Janc __u8 hash[16]; 5612763eda6SSzymon Janc __u8 randomizer[16]; 5622763eda6SSzymon Janc } __packed; 5632763eda6SSzymon Janc 5642763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 5652763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply { 5662763eda6SSzymon Janc bdaddr_t bdaddr; 5672763eda6SSzymon Janc } __packed; 5682763eda6SSzymon Janc 56903b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 57003b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply { 57103b555e1SJohan Hedberg bdaddr_t bdaddr; 57203b555e1SJohan Hedberg __u8 reason; 57303b555e1SJohan Hedberg } __packed; 57403b555e1SJohan Hedberg 575523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK 0x0435 576523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link { 577523e93cdSAndrei Emeltchenko __u8 phy_handle; 578523e93cdSAndrei Emeltchenko __u8 key_len; 579523e93cdSAndrei Emeltchenko __u8 key_type; 580523e93cdSAndrei Emeltchenko __u8 key[HCI_AMP_LINK_KEY_SIZE]; 581523e93cdSAndrei Emeltchenko } __packed; 582523e93cdSAndrei Emeltchenko 583523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK 0x0436 584523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link { 585523e93cdSAndrei Emeltchenko __u8 phy_handle; 586523e93cdSAndrei Emeltchenko __u8 key_len; 587523e93cdSAndrei Emeltchenko __u8 key_type; 588523e93cdSAndrei Emeltchenko __u8 key[HCI_AMP_LINK_KEY_SIZE]; 589523e93cdSAndrei Emeltchenko } __packed; 590523e93cdSAndrei Emeltchenko 591523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK 0x0437 592523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link { 593523e93cdSAndrei Emeltchenko __u8 phy_handle; 594523e93cdSAndrei Emeltchenko __u8 reason; 595b078b564SAndrei Emeltchenko } __packed; 596b078b564SAndrei Emeltchenko 597b078b564SAndrei Emeltchenko struct ext_flow_spec { 598b078b564SAndrei Emeltchenko __u8 id; 599b078b564SAndrei Emeltchenko __u8 stype; 600b078b564SAndrei Emeltchenko __le16 msdu; 601b078b564SAndrei Emeltchenko __le32 sdu_itime; 602b078b564SAndrei Emeltchenko __le32 acc_lat; 603b078b564SAndrei Emeltchenko __le32 flush_to; 604b078b564SAndrei Emeltchenko } __packed; 605b078b564SAndrei Emeltchenko 606b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK 0x0438 607b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439 608b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link { 609b078b564SAndrei Emeltchenko __u8 phy_handle; 610b078b564SAndrei Emeltchenko struct ext_flow_spec tx_flow_spec; 611b078b564SAndrei Emeltchenko struct ext_flow_spec rx_flow_spec; 612b078b564SAndrei Emeltchenko } __packed; 613b078b564SAndrei Emeltchenko 614b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK 0x043a 615b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link { 616b078b564SAndrei Emeltchenko __le16 log_handle; 617b078b564SAndrei Emeltchenko } __packed; 618b078b564SAndrei Emeltchenko 619b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL 0x043b 620b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel { 621b078b564SAndrei Emeltchenko __u8 phy_handle; 622b078b564SAndrei Emeltchenko __u8 flow_spec_id; 623b078b564SAndrei Emeltchenko } __packed; 624b078b564SAndrei Emeltchenko 625b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel { 626b078b564SAndrei Emeltchenko __u8 status; 627b078b564SAndrei Emeltchenko __u8 phy_handle; 628b078b564SAndrei Emeltchenko __u8 flow_spec_id; 629523e93cdSAndrei Emeltchenko } __packed; 630523e93cdSAndrei Emeltchenko 631a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 632a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 633a9de9248SMarcel Holtmann __le16 handle; 634a9de9248SMarcel Holtmann __le16 max_interval; 635a9de9248SMarcel Holtmann __le16 min_interval; 636a9de9248SMarcel Holtmann __le16 attempt; 637a9de9248SMarcel Holtmann __le16 timeout; 63866c853ccSGustavo F. Padovan } __packed; 639a9de9248SMarcel Holtmann 640a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 641a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 642a9de9248SMarcel Holtmann __le16 handle; 64366c853ccSGustavo F. Padovan } __packed; 644a9de9248SMarcel Holtmann 645a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 646a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 647a9de9248SMarcel Holtmann __le16 handle; 64866c853ccSGustavo F. Padovan } __packed; 649a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 650a9de9248SMarcel Holtmann __u8 status; 651a9de9248SMarcel Holtmann __le16 handle; 652a9de9248SMarcel Holtmann __u8 role; 65366c853ccSGustavo F. Padovan } __packed; 654a9de9248SMarcel Holtmann 655a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 656a9de9248SMarcel Holtmann struct hci_cp_switch_role { 657a9de9248SMarcel Holtmann bdaddr_t bdaddr; 658a9de9248SMarcel Holtmann __u8 role; 65966c853ccSGustavo F. Padovan } __packed; 660a9de9248SMarcel Holtmann 661a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 662a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 663a9de9248SMarcel Holtmann __le16 handle; 66466c853ccSGustavo F. Padovan } __packed; 665a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 666a9de9248SMarcel Holtmann __u8 status; 667a9de9248SMarcel Holtmann __le16 handle; 668a9de9248SMarcel Holtmann __le16 policy; 66966c853ccSGustavo F. Padovan } __packed; 670a9de9248SMarcel Holtmann 671a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 672a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 673a9de9248SMarcel Holtmann __le16 handle; 674a9de9248SMarcel Holtmann __le16 policy; 67566c853ccSGustavo F. Padovan } __packed; 676a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 677a9de9248SMarcel Holtmann __u8 status; 678a9de9248SMarcel Holtmann __le16 handle; 67966c853ccSGustavo F. Padovan } __packed; 680a9de9248SMarcel Holtmann 681e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 682e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy { 683e4e8e37cSMarcel Holtmann __u8 status; 684e4e8e37cSMarcel Holtmann __le16 policy; 68566c853ccSGustavo F. Padovan } __packed; 686e4e8e37cSMarcel Holtmann 687e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 688e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy { 689e4e8e37cSMarcel Holtmann __le16 policy; 69066c853ccSGustavo F. Padovan } __packed; 691e4e8e37cSMarcel Holtmann 692a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 693a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 694a9de9248SMarcel Holtmann __le16 handle; 695a9de9248SMarcel Holtmann __le16 max_latency; 696a9de9248SMarcel Holtmann __le16 min_remote_timeout; 697a9de9248SMarcel Holtmann __le16 min_local_timeout; 69866c853ccSGustavo F. Padovan } __packed; 699a9de9248SMarcel Holtmann 700a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 701a9de9248SMarcel Holtmann 702a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 703a9de9248SMarcel Holtmann 704a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 7051da177e4SLinus Torvalds struct hci_cp_set_event_flt { 7061da177e4SLinus Torvalds __u8 flt_type; 7071da177e4SLinus Torvalds __u8 cond_type; 7081da177e4SLinus Torvalds __u8 condition[0]; 70966c853ccSGustavo F. Padovan } __packed; 7101da177e4SLinus Torvalds 7111da177e4SLinus Torvalds /* Filter types */ 7121da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 7131da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 7141da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 7151da177e4SLinus Torvalds 7161da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 7171da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 7181da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 7191da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 7201da177e4SLinus Torvalds 7211da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 7221da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 7231da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 7241da177e4SLinus Torvalds 725b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 726b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key { 727b0916ea0SJohan Hedberg bdaddr_t bdaddr; 728b0916ea0SJohan Hedberg __u8 delete_all; 729b0916ea0SJohan Hedberg } __packed; 730b0916ea0SJohan Hedberg 7311f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH 248 7321f6c6378SJohan Hedberg 733a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 734a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 7351f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 73666c853ccSGustavo F. Padovan } __packed; 737a9de9248SMarcel Holtmann 738a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 739a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 740a9de9248SMarcel Holtmann __u8 status; 7411f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 74266c853ccSGustavo F. Padovan } __packed; 743a9de9248SMarcel Holtmann 744a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 745a9de9248SMarcel Holtmann 746a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 747a9de9248SMarcel Holtmann 748a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 749a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 750a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 751a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 752a9de9248SMarcel Holtmann 753a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 754a9de9248SMarcel Holtmann 755a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 756a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 757a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 758a9de9248SMarcel Holtmann 759a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 760a9de9248SMarcel Holtmann 761a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 762a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 763a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 764a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 765a9de9248SMarcel Holtmann 766a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 767a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 7681da177e4SLinus Torvalds __u8 status; 7691da177e4SLinus Torvalds __u8 dev_class[3]; 77066c853ccSGustavo F. Padovan } __packed; 7711da177e4SLinus Torvalds 772a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 773a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 7741da177e4SLinus Torvalds __u8 dev_class[3]; 77566c853ccSGustavo F. Padovan } __packed; 7761da177e4SLinus Torvalds 777a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 7781da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 7791da177e4SLinus Torvalds __u8 status; 7801ebb9252SMarcel Holtmann __le16 voice_setting; 78166c853ccSGustavo F. Padovan } __packed; 7821da177e4SLinus Torvalds 783a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 7841da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 7851ebb9252SMarcel Holtmann __le16 voice_setting; 78666c853ccSGustavo F. Padovan } __packed; 7871da177e4SLinus Torvalds 788a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 7891da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 7901ebb9252SMarcel Holtmann __le16 acl_mtu; 7911da177e4SLinus Torvalds __u8 sco_mtu; 7921ebb9252SMarcel Holtmann __le16 acl_max_pkt; 7931ebb9252SMarcel Holtmann __le16 sco_max_pkt; 79466c853ccSGustavo F. Padovan } __packed; 7951da177e4SLinus Torvalds 796d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 797d5859e22SJohan Hedberg 79880a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH 240 79980a1e1dbSJohan Hedberg 80080a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR 0x0c52 80180a1e1dbSJohan Hedberg struct hci_cp_write_eir { 802816a11d5SJohan Hedberg __u8 fec; 803816a11d5SJohan Hedberg __u8 data[HCI_MAX_EIR_LENGTH]; 80480a1e1dbSJohan Hedberg } __packed; 80580a1e1dbSJohan Hedberg 806333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE 0x0c55 807333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode { 808333140b5SMarcel Holtmann __u8 status; 809333140b5SMarcel Holtmann __u8 mode; 81066c853ccSGustavo F. Padovan } __packed; 811333140b5SMarcel Holtmann 812333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE 0x0c56 813333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode { 814333140b5SMarcel Holtmann __u8 mode; 81566c853ccSGustavo F. Padovan } __packed; 816333140b5SMarcel Holtmann 817c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 818c35938b2SSzymon Janc struct hci_rp_read_local_oob_data { 819c35938b2SSzymon Janc __u8 status; 820c35938b2SSzymon Janc __u8 hash[16]; 821c35938b2SSzymon Janc __u8 randomizer[16]; 822c35938b2SSzymon Janc } __packed; 823c35938b2SSzymon Janc 824d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 82591c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power { 82691c4e9b1SMarcel Holtmann __u8 status; 82791c4e9b1SMarcel Holtmann __s8 tx_power; 82891c4e9b1SMarcel Holtmann } __packed; 829d5859e22SJohan Hedberg 830d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63 831d62e6d67SJohan Hedberg 8321e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 8331e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode { 8341e89cffbSAndrei Emeltchenko __u8 status; 8351e89cffbSAndrei Emeltchenko __u8 mode; 8361e89cffbSAndrei Emeltchenko } __packed; 8371e89cffbSAndrei Emeltchenko 838f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 839f9b49306SAndre Guedes struct hci_cp_write_le_host_supported { 840f9b49306SAndre Guedes __u8 le; 841f9b49306SAndre Guedes __u8 simul; 842f9b49306SAndre Guedes } __packed; 843f9b49306SAndre Guedes 844d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74 845d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr { 846d0bf75a5SDoHyun Pyun __u8 lt_addr; 847d0bf75a5SDoHyun Pyun } __packed; 848d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr { 849d0bf75a5SDoHyun Pyun __u8 status; 850d0bf75a5SDoHyun Pyun __u8 lt_addr; 851d0bf75a5SDoHyun Pyun } __packed; 852d0bf75a5SDoHyun Pyun 8536a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75 8546a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr { 8556a20eaf4SDoHyun Pyun __u8 lt_addr; 8566a20eaf4SDoHyun Pyun } __packed; 8576a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr { 8586a20eaf4SDoHyun Pyun __u8 status; 8596a20eaf4SDoHyun Pyun __u8 lt_addr; 8606a20eaf4SDoHyun Pyun } __packed; 8616a20eaf4SDoHyun Pyun 862*7d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA 0x0c76 863*7d1dab49SDoHyun Pyun struct hci_cp_set_csb_data { 864*7d1dab49SDoHyun Pyun __u8 lt_addr; 865*7d1dab49SDoHyun Pyun __u8 fragment; 866*7d1dab49SDoHyun Pyun __u8 data_length; 867*7d1dab49SDoHyun Pyun __u8 data[HCI_MAX_CSB_DATA_SIZE]; 868*7d1dab49SDoHyun Pyun } __packed; 869*7d1dab49SDoHyun Pyun struct hci_rp_set_csb_data { 870*7d1dab49SDoHyun Pyun __u8 status; 871*7d1dab49SDoHyun Pyun __u8 lt_addr; 872*7d1dab49SDoHyun Pyun } __packed; 873*7d1dab49SDoHyun Pyun 8745d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77 8755d4e7e8dSJohan Hedberg 876a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 877a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 8781da177e4SLinus Torvalds __u8 status; 879a9de9248SMarcel Holtmann __u8 hci_ver; 880a9de9248SMarcel Holtmann __le16 hci_rev; 881a9de9248SMarcel Holtmann __u8 lmp_ver; 882a9de9248SMarcel Holtmann __le16 manufacturer; 883a9de9248SMarcel Holtmann __le16 lmp_subver; 88466c853ccSGustavo F. Padovan } __packed; 8851da177e4SLinus Torvalds 886a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 887a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 8881da177e4SLinus Torvalds __u8 status; 889a9de9248SMarcel Holtmann __u8 commands[64]; 89066c853ccSGustavo F. Padovan } __packed; 8911da177e4SLinus Torvalds 892a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 893a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 894a9de9248SMarcel Holtmann __u8 status; 895a9de9248SMarcel Holtmann __u8 features[8]; 89666c853ccSGustavo F. Padovan } __packed; 897a9de9248SMarcel Holtmann 898a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 899971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features { 900971e3a4bSAndre Guedes __u8 page; 901971e3a4bSAndre Guedes } __packed; 902a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 903a9de9248SMarcel Holtmann __u8 status; 904a9de9248SMarcel Holtmann __u8 page; 905a9de9248SMarcel Holtmann __u8 max_page; 906a9de9248SMarcel Holtmann __u8 features[8]; 90766c853ccSGustavo F. Padovan } __packed; 908a9de9248SMarcel Holtmann 909a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 910a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 911a9de9248SMarcel Holtmann __u8 status; 912a9de9248SMarcel Holtmann __le16 acl_mtu; 913a9de9248SMarcel Holtmann __u8 sco_mtu; 914a9de9248SMarcel Holtmann __le16 acl_max_pkt; 915a9de9248SMarcel Holtmann __le16 sco_max_pkt; 91666c853ccSGustavo F. Padovan } __packed; 917a9de9248SMarcel Holtmann 918a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 919a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 920a9de9248SMarcel Holtmann __u8 status; 9211da177e4SLinus Torvalds bdaddr_t bdaddr; 92266c853ccSGustavo F. Padovan } __packed; 9231da177e4SLinus Torvalds 924350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a 925350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size { 926350ee4cfSAndrei Emeltchenko __u8 status; 927350ee4cfSAndrei Emeltchenko __le16 max_acl_len; 928350ee4cfSAndrei Emeltchenko __le16 block_len; 929350ee4cfSAndrei Emeltchenko __le16 num_blocks; 930350ee4cfSAndrei Emeltchenko } __packed; 931350ee4cfSAndrei Emeltchenko 932f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b 933f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity { 934f332ec66SJohan Hedberg __u8 status; 935f332ec66SJohan Hedberg __le16 interval; 936f332ec66SJohan Hedberg __le16 window; 937f332ec66SJohan Hedberg } __packed; 938f332ec66SJohan Hedberg 939f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 940f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity { 941f6422ec6SAntti Julku __le16 interval; 942f6422ec6SAntti Julku __le16 window; 943f6422ec6SAntti Julku } __packed; 944f6422ec6SAntti Julku 945f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 946f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type { 947f332ec66SJohan Hedberg __u8 status; 948f332ec66SJohan Hedberg __u8 type; 949f332ec66SJohan Hedberg } __packed; 950f332ec66SJohan Hedberg 951f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 952f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_STANDARD 0x00 953f6422ec6SAntti Julku #define PAGE_SCAN_TYPE_INTERLACED 0x01 954f6422ec6SAntti Julku 955928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 956928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info { 957928abaa7SAndrei Emeltchenko __u8 status; 958928abaa7SAndrei Emeltchenko __u8 amp_status; 959928abaa7SAndrei Emeltchenko __le32 total_bw; 960928abaa7SAndrei Emeltchenko __le32 max_bw; 961928abaa7SAndrei Emeltchenko __le32 min_latency; 962928abaa7SAndrei Emeltchenko __le32 max_pdu; 963928abaa7SAndrei Emeltchenko __u8 amp_type; 964928abaa7SAndrei Emeltchenko __le16 pal_cap; 965928abaa7SAndrei Emeltchenko __le16 max_assoc_size; 966928abaa7SAndrei Emeltchenko __le32 max_flush_to; 967928abaa7SAndrei Emeltchenko __le32 be_flush_to; 968928abaa7SAndrei Emeltchenko } __packed; 969928abaa7SAndrei Emeltchenko 970523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a 971523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc { 972523e93cdSAndrei Emeltchenko __u8 phy_handle; 973523e93cdSAndrei Emeltchenko __le16 len_so_far; 974523e93cdSAndrei Emeltchenko __le16 max_len; 975523e93cdSAndrei Emeltchenko } __packed; 976523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc { 977523e93cdSAndrei Emeltchenko __u8 status; 978523e93cdSAndrei Emeltchenko __u8 phy_handle; 979523e93cdSAndrei Emeltchenko __le16 rem_len; 980523e93cdSAndrei Emeltchenko __u8 frag[0]; 981523e93cdSAndrei Emeltchenko } __packed; 982523e93cdSAndrei Emeltchenko 983523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b 984523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc { 985523e93cdSAndrei Emeltchenko __u8 phy_handle; 986523e93cdSAndrei Emeltchenko __le16 len_so_far; 987523e93cdSAndrei Emeltchenko __le16 rem_len; 988523e93cdSAndrei Emeltchenko __u8 frag[0]; 989523e93cdSAndrei Emeltchenko } __packed; 990523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc { 991523e93cdSAndrei Emeltchenko __u8 status; 992523e93cdSAndrei Emeltchenko __u8 phy_handle; 993523e93cdSAndrei Emeltchenko } __packed; 994523e93cdSAndrei Emeltchenko 99563185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK 0x2001 99663185f64SVille Tervo struct hci_cp_le_set_event_mask { 99763185f64SVille Tervo __u8 mask[8]; 99863185f64SVille Tervo } __packed; 99963185f64SVille Tervo 100063185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 100163185f64SVille Tervo struct hci_rp_le_read_buffer_size { 100263185f64SVille Tervo __u8 status; 100363185f64SVille Tervo __le16 le_mtu; 100463185f64SVille Tervo __u8 le_max_pkt; 100563185f64SVille Tervo } __packed; 100663185f64SVille Tervo 100760e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES 0x2003 100860e77321SJohan Hedberg struct hci_rp_le_read_local_features { 100960e77321SJohan Hedberg __u8 status; 101060e77321SJohan Hedberg __u8 features[8]; 101160e77321SJohan Hedberg } __packed; 101260e77321SJohan Hedberg 1013d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR 0x2005 1014d13eafceSMarcel Holtmann 10158fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 10168fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power { 10178fa19098SJohan Hedberg __u8 status; 10188fa19098SJohan Hedberg __s8 tx_power; 10198fa19098SJohan Hedberg } __packed; 10208fa19098SJohan Hedberg 10213f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH 31 10223f0f524bSJohan Hedberg 10233f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA 0x2008 10243f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data { 10253f0f524bSJohan Hedberg __u8 length; 10263f0f524bSJohan Hedberg __u8 data[HCI_MAX_AD_LENGTH]; 10273f0f524bSJohan Hedberg } __packed; 10283f0f524bSJohan Hedberg 1029c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1030c1d5dc4aSJohan Hedberg 10315df480b5SAndre Guedes #define LE_SCAN_PASSIVE 0x00 10325df480b5SAndre Guedes #define LE_SCAN_ACTIVE 0x01 10335df480b5SAndre Guedes 103407f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM 0x200b 103507f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param { 103607f7fa5dSAndre Guedes __u8 type; 103707f7fa5dSAndre Guedes __le16 interval; 103807f7fa5dSAndre Guedes __le16 window; 103907f7fa5dSAndre Guedes __u8 own_address_type; 104007f7fa5dSAndre Guedes __u8 filter_policy; 104107f7fa5dSAndre Guedes } __packed; 104207f7fa5dSAndre Guedes 104376a388beSAndre Guedes #define LE_SCAN_DISABLE 0x00 104476a388beSAndre Guedes #define LE_SCAN_ENABLE 0x01 1045525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE 0x00 1046525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE 0x01 104768a8aea4SAndrei Emeltchenko 1048eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 1049eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable { 1050eb9d91f5SAndre Guedes __u8 enable; 1051eb9d91f5SAndre Guedes __u8 filter_dup; 1052eb9d91f5SAndre Guedes } __packed; 1053eb9d91f5SAndre Guedes 105463185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN 0x200d 105563185f64SVille Tervo struct hci_cp_le_create_conn { 105663185f64SVille Tervo __le16 scan_interval; 105763185f64SVille Tervo __le16 scan_window; 105863185f64SVille Tervo __u8 filter_policy; 105963185f64SVille Tervo __u8 peer_addr_type; 106063185f64SVille Tervo bdaddr_t peer_addr; 106163185f64SVille Tervo __u8 own_address_type; 106263185f64SVille Tervo __le16 conn_interval_min; 106363185f64SVille Tervo __le16 conn_interval_max; 106463185f64SVille Tervo __le16 conn_latency; 106563185f64SVille Tervo __le16 supervision_timeout; 106663185f64SVille Tervo __le16 min_ce_len; 106763185f64SVille Tervo __le16 max_ce_len; 106863185f64SVille Tervo } __packed; 106963185f64SVille Tervo 107063185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 107163185f64SVille Tervo 1072cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE 0x200f 1073cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size { 1074cf1d081fSJohan Hedberg __u8 status; 1075cf1d081fSJohan Hedberg __u8 size; 1076cf1d081fSJohan Hedberg } __packed; 1077cf1d081fSJohan Hedberg 10782ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE 0x2013 10792ce603ebSClaudio Takahasi struct hci_cp_le_conn_update { 10802ce603ebSClaudio Takahasi __le16 handle; 10812ce603ebSClaudio Takahasi __le16 conn_interval_min; 10822ce603ebSClaudio Takahasi __le16 conn_interval_max; 10832ce603ebSClaudio Takahasi __le16 conn_latency; 10842ce603ebSClaudio Takahasi __le16 supervision_timeout; 10852ce603ebSClaudio Takahasi __le16 min_ce_len; 10862ce603ebSClaudio Takahasi __le16 max_ce_len; 10872ce603ebSClaudio Takahasi } __packed; 10882ce603ebSClaudio Takahasi 1089a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC 0x2019 1090a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc { 1091a7a595f6SVinicius Costa Gomes __le16 handle; 1092a7a595f6SVinicius Costa Gomes __u8 rand[8]; 1093a7a595f6SVinicius Costa Gomes __le16 ediv; 1094a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 1095a7a595f6SVinicius Costa Gomes } __packed; 1096a7a595f6SVinicius Costa Gomes 1097a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY 0x201a 1098a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply { 1099a7a595f6SVinicius Costa Gomes __le16 handle; 1100a7a595f6SVinicius Costa Gomes __u8 ltk[16]; 1101a7a595f6SVinicius Costa Gomes } __packed; 1102a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply { 1103a7a595f6SVinicius Costa Gomes __u8 status; 1104a7a595f6SVinicius Costa Gomes __le16 handle; 1105a7a595f6SVinicius Costa Gomes } __packed; 1106a7a595f6SVinicius Costa Gomes 1107a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY 0x201b 1108a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply { 1109a7a595f6SVinicius Costa Gomes __le16 handle; 1110a7a595f6SVinicius Costa Gomes } __packed; 1111a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply { 1112a7a595f6SVinicius Costa Gomes __u8 status; 1113a7a595f6SVinicius Costa Gomes __le16 handle; 1114a7a595f6SVinicius Costa Gomes } __packed; 1115a7a595f6SVinicius Costa Gomes 11169b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES 0x201c 11179b008c04SJohan Hedberg struct hci_rp_le_read_supported_states { 11189b008c04SJohan Hedberg __u8 status; 11199b008c04SJohan Hedberg __u8 le_states[8]; 11209b008c04SJohan Hedberg } __packed; 11219b008c04SJohan Hedberg 11221da177e4SLinus Torvalds /* ---- HCI Events ---- */ 11231da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 11241da177e4SLinus Torvalds 11251da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 11261da177e4SLinus Torvalds struct inquiry_info { 11271da177e4SLinus Torvalds bdaddr_t bdaddr; 11281da177e4SLinus Torvalds __u8 pscan_rep_mode; 11291da177e4SLinus Torvalds __u8 pscan_period_mode; 11301da177e4SLinus Torvalds __u8 pscan_mode; 11311da177e4SLinus Torvalds __u8 dev_class[3]; 11321ebb9252SMarcel Holtmann __le16 clock_offset; 113366c853ccSGustavo F. Padovan } __packed; 11341da177e4SLinus Torvalds 11351da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 11361da177e4SLinus Torvalds struct hci_ev_conn_complete { 11371da177e4SLinus Torvalds __u8 status; 11381ebb9252SMarcel Holtmann __le16 handle; 11391da177e4SLinus Torvalds bdaddr_t bdaddr; 11401da177e4SLinus Torvalds __u8 link_type; 11411da177e4SLinus Torvalds __u8 encr_mode; 114266c853ccSGustavo F. Padovan } __packed; 11431da177e4SLinus Torvalds 11441da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 11451da177e4SLinus Torvalds struct hci_ev_conn_request { 11461da177e4SLinus Torvalds bdaddr_t bdaddr; 11471da177e4SLinus Torvalds __u8 dev_class[3]; 11481da177e4SLinus Torvalds __u8 link_type; 114966c853ccSGustavo F. Padovan } __packed; 11501da177e4SLinus Torvalds 11511da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 11521da177e4SLinus Torvalds struct hci_ev_disconn_complete { 11531da177e4SLinus Torvalds __u8 status; 11541ebb9252SMarcel Holtmann __le16 handle; 11551da177e4SLinus Torvalds __u8 reason; 115666c853ccSGustavo F. Padovan } __packed; 11571da177e4SLinus Torvalds 11581da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 11591da177e4SLinus Torvalds struct hci_ev_auth_complete { 11601da177e4SLinus Torvalds __u8 status; 11611ebb9252SMarcel Holtmann __le16 handle; 116266c853ccSGustavo F. Padovan } __packed; 11631da177e4SLinus Torvalds 1164a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 1165a9de9248SMarcel Holtmann struct hci_ev_remote_name { 1166a9de9248SMarcel Holtmann __u8 status; 1167a9de9248SMarcel Holtmann bdaddr_t bdaddr; 11681f6c6378SJohan Hedberg __u8 name[HCI_MAX_NAME_LENGTH]; 116966c853ccSGustavo F. Padovan } __packed; 1170a9de9248SMarcel Holtmann 11711da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 11721da177e4SLinus Torvalds struct hci_ev_encrypt_change { 11731da177e4SLinus Torvalds __u8 status; 11741ebb9252SMarcel Holtmann __le16 handle; 11751da177e4SLinus Torvalds __u8 encrypt; 117666c853ccSGustavo F. Padovan } __packed; 11771da177e4SLinus Torvalds 1178a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 1179a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 11801da177e4SLinus Torvalds __u8 status; 11811ebb9252SMarcel Holtmann __le16 handle; 118266c853ccSGustavo F. Padovan } __packed; 11831da177e4SLinus Torvalds 1184a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 1185a9de9248SMarcel Holtmann struct hci_ev_remote_features { 1186a9de9248SMarcel Holtmann __u8 status; 1187a9de9248SMarcel Holtmann __le16 handle; 1188a9de9248SMarcel Holtmann __u8 features[8]; 118966c853ccSGustavo F. Padovan } __packed; 1190a9de9248SMarcel Holtmann 1191a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 1192a9de9248SMarcel Holtmann struct hci_ev_remote_version { 1193a9de9248SMarcel Holtmann __u8 status; 1194a9de9248SMarcel Holtmann __le16 handle; 1195a9de9248SMarcel Holtmann __u8 lmp_ver; 1196a9de9248SMarcel Holtmann __le16 manufacturer; 1197a9de9248SMarcel Holtmann __le16 lmp_subver; 119866c853ccSGustavo F. Padovan } __packed; 1199a9de9248SMarcel Holtmann 1200a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 12011da177e4SLinus Torvalds struct hci_qos { 12021da177e4SLinus Torvalds __u8 service_type; 12031da177e4SLinus Torvalds __u32 token_rate; 12041da177e4SLinus Torvalds __u32 peak_bandwidth; 12051da177e4SLinus Torvalds __u32 latency; 12061da177e4SLinus Torvalds __u32 delay_variation; 120766c853ccSGustavo F. Padovan } __packed; 12081da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 12091da177e4SLinus Torvalds __u8 status; 12101ebb9252SMarcel Holtmann __le16 handle; 12111da177e4SLinus Torvalds struct hci_qos qos; 121266c853ccSGustavo F. Padovan } __packed; 12131da177e4SLinus Torvalds 1214a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 12151da177e4SLinus Torvalds struct hci_ev_cmd_complete { 12161da177e4SLinus Torvalds __u8 ncmd; 12171ebb9252SMarcel Holtmann __le16 opcode; 121866c853ccSGustavo F. Padovan } __packed; 12191da177e4SLinus Torvalds 1220a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 12211da177e4SLinus Torvalds struct hci_ev_cmd_status { 12221da177e4SLinus Torvalds __u8 status; 12231da177e4SLinus Torvalds __u8 ncmd; 12241ebb9252SMarcel Holtmann __le16 opcode; 122566c853ccSGustavo F. Padovan } __packed; 12261da177e4SLinus Torvalds 12271da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 12281da177e4SLinus Torvalds struct hci_ev_role_change { 12291da177e4SLinus Torvalds __u8 status; 12301da177e4SLinus Torvalds bdaddr_t bdaddr; 12311da177e4SLinus Torvalds __u8 role; 123266c853ccSGustavo F. Padovan } __packed; 12331da177e4SLinus Torvalds 1234a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 1235613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info { 1236613a1c0cSAndrei Emeltchenko __le16 handle; 1237613a1c0cSAndrei Emeltchenko __le16 count; 1238613a1c0cSAndrei Emeltchenko } __packed; 1239613a1c0cSAndrei Emeltchenko 1240a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 1241a9de9248SMarcel Holtmann __u8 num_hndl; 1242613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info handles[0]; 124366c853ccSGustavo F. Padovan } __packed; 1244a9de9248SMarcel Holtmann 12451da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 12461da177e4SLinus Torvalds struct hci_ev_mode_change { 12471da177e4SLinus Torvalds __u8 status; 12481ebb9252SMarcel Holtmann __le16 handle; 12491da177e4SLinus Torvalds __u8 mode; 12501ebb9252SMarcel Holtmann __le16 interval; 125166c853ccSGustavo F. Padovan } __packed; 12521da177e4SLinus Torvalds 12531da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 12541da177e4SLinus Torvalds struct hci_ev_pin_code_req { 12551da177e4SLinus Torvalds bdaddr_t bdaddr; 125666c853ccSGustavo F. Padovan } __packed; 12571da177e4SLinus Torvalds 12581da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 12591da177e4SLinus Torvalds struct hci_ev_link_key_req { 12601da177e4SLinus Torvalds bdaddr_t bdaddr; 126166c853ccSGustavo F. Padovan } __packed; 12621da177e4SLinus Torvalds 12631da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 12641da177e4SLinus Torvalds struct hci_ev_link_key_notify { 12651da177e4SLinus Torvalds bdaddr_t bdaddr; 12669b3b4460SAndrei Emeltchenko __u8 link_key[HCI_LINK_KEY_SIZE]; 12671da177e4SLinus Torvalds __u8 key_type; 126866c853ccSGustavo F. Padovan } __packed; 12691da177e4SLinus Torvalds 1270a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 12711da177e4SLinus Torvalds struct hci_ev_clock_offset { 12721da177e4SLinus Torvalds __u8 status; 12731ebb9252SMarcel Holtmann __le16 handle; 12741ebb9252SMarcel Holtmann __le16 clock_offset; 127566c853ccSGustavo F. Padovan } __packed; 12761da177e4SLinus Torvalds 1277a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE 0x1d 1278a8746417SMarcel Holtmann struct hci_ev_pkt_type_change { 1279a8746417SMarcel Holtmann __u8 status; 1280a8746417SMarcel Holtmann __le16 handle; 1281a8746417SMarcel Holtmann __le16 pkt_type; 128266c853ccSGustavo F. Padovan } __packed; 1283a8746417SMarcel Holtmann 128485a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 128585a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 128685a1e930SMarcel Holtmann bdaddr_t bdaddr; 128785a1e930SMarcel Holtmann __u8 pscan_rep_mode; 128866c853ccSGustavo F. Padovan } __packed; 128985a1e930SMarcel Holtmann 1290a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 1291a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 1292a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1293a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1294a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1295a9de9248SMarcel Holtmann __u8 dev_class[3]; 1296a9de9248SMarcel Holtmann __le16 clock_offset; 1297a9de9248SMarcel Holtmann __s8 rssi; 129866c853ccSGustavo F. Padovan } __packed; 1299a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 1300a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1301a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1302a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1303a9de9248SMarcel Holtmann __u8 pscan_mode; 1304a9de9248SMarcel Holtmann __u8 dev_class[3]; 1305a9de9248SMarcel Holtmann __le16 clock_offset; 1306a9de9248SMarcel Holtmann __s8 rssi; 130766c853ccSGustavo F. Padovan } __packed; 1308a9de9248SMarcel Holtmann 1309a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 1310a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 1311a9de9248SMarcel Holtmann __u8 status; 1312a9de9248SMarcel Holtmann __le16 handle; 1313a9de9248SMarcel Holtmann __u8 page; 1314a9de9248SMarcel Holtmann __u8 max_page; 1315a9de9248SMarcel Holtmann __u8 features[8]; 131666c853ccSGustavo F. Padovan } __packed; 1317a9de9248SMarcel Holtmann 1318a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 1319a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 1320a9de9248SMarcel Holtmann __u8 status; 1321a9de9248SMarcel Holtmann __le16 handle; 1322a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1323a9de9248SMarcel Holtmann __u8 link_type; 1324a9de9248SMarcel Holtmann __u8 tx_interval; 1325a9de9248SMarcel Holtmann __u8 retrans_window; 1326a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1327a9de9248SMarcel Holtmann __le16 tx_pkt_len; 1328a9de9248SMarcel Holtmann __u8 air_mode; 132966c853ccSGustavo F. Padovan } __packed; 1330a9de9248SMarcel Holtmann 1331a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 1332a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 1333a9de9248SMarcel Holtmann __u8 status; 1334a9de9248SMarcel Holtmann __le16 handle; 1335a9de9248SMarcel Holtmann __u8 tx_interval; 1336a9de9248SMarcel Holtmann __u8 retrans_window; 1337a9de9248SMarcel Holtmann __le16 rx_pkt_len; 1338a9de9248SMarcel Holtmann __le16 tx_pkt_len; 133966c853ccSGustavo F. Padovan } __packed; 1340a9de9248SMarcel Holtmann 1341a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 134204837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 134304837f64SMarcel Holtmann __u8 status; 134404837f64SMarcel Holtmann __le16 handle; 134504837f64SMarcel Holtmann __le16 max_tx_latency; 134604837f64SMarcel Holtmann __le16 max_rx_latency; 134704837f64SMarcel Holtmann __le16 max_remote_timeout; 134804837f64SMarcel Holtmann __le16 max_local_timeout; 134966c853ccSGustavo F. Padovan } __packed; 135004837f64SMarcel Holtmann 1351a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 1352a9de9248SMarcel Holtmann struct extended_inquiry_info { 1353a9de9248SMarcel Holtmann bdaddr_t bdaddr; 1354a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 1355a9de9248SMarcel Holtmann __u8 pscan_period_mode; 1356a9de9248SMarcel Holtmann __u8 dev_class[3]; 1357a9de9248SMarcel Holtmann __le16 clock_offset; 1358a9de9248SMarcel Holtmann __s8 rssi; 1359a9de9248SMarcel Holtmann __u8 data[240]; 136066c853ccSGustavo F. Padovan } __packed; 1361a9de9248SMarcel Holtmann 13621c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE 0x30 13631c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete { 13641c2e0041SJohan Hedberg __u8 status; 13651c2e0041SJohan Hedberg __le16 handle; 13661c2e0041SJohan Hedberg } __packed; 13671c2e0041SJohan Hedberg 13680493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST 0x31 13690493684eSMarcel Holtmann struct hci_ev_io_capa_request { 13700493684eSMarcel Holtmann bdaddr_t bdaddr; 137166c853ccSGustavo F. Padovan } __packed; 13720493684eSMarcel Holtmann 137303b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY 0x32 137403b555e1SJohan Hedberg struct hci_ev_io_capa_reply { 137503b555e1SJohan Hedberg bdaddr_t bdaddr; 137603b555e1SJohan Hedberg __u8 capability; 137703b555e1SJohan Hedberg __u8 oob_data; 137803b555e1SJohan Hedberg __u8 authentication; 137903b555e1SJohan Hedberg } __packed; 138003b555e1SJohan Hedberg 1381a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST 0x33 1382a5c29683SJohan Hedberg struct hci_ev_user_confirm_req { 1383a5c29683SJohan Hedberg bdaddr_t bdaddr; 1384a5c29683SJohan Hedberg __le32 passkey; 1385a5c29683SJohan Hedberg } __packed; 1386a5c29683SJohan Hedberg 13879ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST 0x34 13889ad4019aSBrian Gix struct hci_ev_user_passkey_req { 13899ad4019aSBrian Gix bdaddr_t bdaddr; 13909ad4019aSBrian Gix } __packed; 13919ad4019aSBrian Gix 13922763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 13932763eda6SSzymon Janc struct hci_ev_remote_oob_data_request { 13942763eda6SSzymon Janc bdaddr_t bdaddr; 13952763eda6SSzymon Janc } __packed; 13962763eda6SSzymon Janc 13970493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 13980493684eSMarcel Holtmann struct hci_ev_simple_pair_complete { 13990493684eSMarcel Holtmann __u8 status; 14000493684eSMarcel Holtmann bdaddr_t bdaddr; 140166c853ccSGustavo F. Padovan } __packed; 14020493684eSMarcel Holtmann 140392a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY 0x3b 140492a25256SJohan Hedberg struct hci_ev_user_passkey_notify { 140592a25256SJohan Hedberg bdaddr_t bdaddr; 140692a25256SJohan Hedberg __le32 passkey; 140792a25256SJohan Hedberg } __packed; 140892a25256SJohan Hedberg 140992a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED 0 141092a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED 1 141192a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED 2 141292a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED 3 141392a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED 4 141492a25256SJohan Hedberg 141592a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY 0x3c 141692a25256SJohan Hedberg struct hci_ev_keypress_notify { 141792a25256SJohan Hedberg bdaddr_t bdaddr; 141892a25256SJohan Hedberg __u8 type; 141992a25256SJohan Hedberg } __packed; 142092a25256SJohan Hedberg 142141a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 142241a96212SMarcel Holtmann struct hci_ev_remote_host_features { 142341a96212SMarcel Holtmann bdaddr_t bdaddr; 142441a96212SMarcel Holtmann __u8 features[8]; 142566c853ccSGustavo F. Padovan } __packed; 142641a96212SMarcel Holtmann 142763185f64SVille Tervo #define HCI_EV_LE_META 0x3e 142863185f64SVille Tervo struct hci_ev_le_meta { 142963185f64SVille Tervo __u8 subevent; 143063185f64SVille Tervo } __packed; 143163185f64SVille Tervo 1432523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE 0x40 1433523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete { 1434523e93cdSAndrei Emeltchenko __u8 status; 1435523e93cdSAndrei Emeltchenko __u8 phy_handle; 1436523e93cdSAndrei Emeltchenko } __packed; 1437523e93cdSAndrei Emeltchenko 1438523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED 0x41 1439523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected { 1440523e93cdSAndrei Emeltchenko __u8 phy_handle; 1441523e93cdSAndrei Emeltchenko } __packed; 1442523e93cdSAndrei Emeltchenko 1443523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42 1444523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete { 1445523e93cdSAndrei Emeltchenko __u8 status; 1446523e93cdSAndrei Emeltchenko __u8 phy_handle; 1447523e93cdSAndrei Emeltchenko __u8 reason; 1448523e93cdSAndrei Emeltchenko } __packed; 1449523e93cdSAndrei Emeltchenko 1450523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE 0x45 1451523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete { 1452523e93cdSAndrei Emeltchenko __u8 status; 1453523e93cdSAndrei Emeltchenko __le16 handle; 1454523e93cdSAndrei Emeltchenko __u8 phy_handle; 1455523e93cdSAndrei Emeltchenko __u8 flow_spec_id; 1456523e93cdSAndrei Emeltchenko } __packed; 1457523e93cdSAndrei Emeltchenko 1458523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46 1459523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete { 1460523e93cdSAndrei Emeltchenko __u8 status; 1461523e93cdSAndrei Emeltchenko __le16 handle; 1462523e93cdSAndrei Emeltchenko __u8 reason; 1463523e93cdSAndrei Emeltchenko } __packed; 1464523e93cdSAndrei Emeltchenko 146525e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS 0x48 146625e89e99SAndrei Emeltchenko struct hci_comp_blocks_info { 146725e89e99SAndrei Emeltchenko __le16 handle; 146825e89e99SAndrei Emeltchenko __le16 pkts; 146925e89e99SAndrei Emeltchenko __le16 blocks; 147025e89e99SAndrei Emeltchenko } __packed; 147125e89e99SAndrei Emeltchenko 147225e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks { 147325e89e99SAndrei Emeltchenko __le16 num_blocks; 147425e89e99SAndrei Emeltchenko __u8 num_hndl; 147525e89e99SAndrei Emeltchenko struct hci_comp_blocks_info handles[0]; 147625e89e99SAndrei Emeltchenko } __packed; 147725e89e99SAndrei Emeltchenko 147863185f64SVille Tervo /* Low energy meta events */ 1479b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER 0x00 1480b9b343d2SAndre Guedes 148163185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE 0x01 148263185f64SVille Tervo struct hci_ev_le_conn_complete { 148363185f64SVille Tervo __u8 status; 148463185f64SVille Tervo __le16 handle; 148563185f64SVille Tervo __u8 role; 148663185f64SVille Tervo __u8 bdaddr_type; 148763185f64SVille Tervo bdaddr_t bdaddr; 148863185f64SVille Tervo __le16 interval; 148963185f64SVille Tervo __le16 latency; 149063185f64SVille Tervo __le16 supervision_timeout; 149163185f64SVille Tervo __u8 clk_accurancy; 149263185f64SVille Tervo } __packed; 149363185f64SVille Tervo 1494a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ 0x05 1495a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req { 1496a7a595f6SVinicius Costa Gomes __le16 handle; 1497a7a595f6SVinicius Costa Gomes __u8 random[8]; 1498a7a595f6SVinicius Costa Gomes __le16 ediv; 1499a7a595f6SVinicius Costa Gomes } __packed; 1500a7a595f6SVinicius Costa Gomes 150157a56fd4SAnderson Briglia /* Advertising report event types */ 150257a56fd4SAnderson Briglia #define ADV_IND 0x00 150357a56fd4SAnderson Briglia #define ADV_DIRECT_IND 0x01 150457a56fd4SAnderson Briglia #define ADV_SCAN_IND 0x02 150557a56fd4SAnderson Briglia #define ADV_NONCONN_IND 0x03 150657a56fd4SAnderson Briglia #define ADV_SCAN_RSP 0x04 150757a56fd4SAnderson Briglia 150857a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC 0x00 150957a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM 0x01 151057a56fd4SAnderson Briglia 151157a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT 0x02 151257a56fd4SAnderson Briglia struct hci_ev_le_advertising_info { 151357a56fd4SAnderson Briglia __u8 evt_type; 151457a56fd4SAnderson Briglia __u8 bdaddr_type; 151557a56fd4SAnderson Briglia bdaddr_t bdaddr; 151657a56fd4SAnderson Briglia __u8 length; 151757a56fd4SAnderson Briglia __u8 data[0]; 151857a56fd4SAnderson Briglia } __packed; 151957a56fd4SAnderson Briglia 15201da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 1521a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 15221da177e4SLinus Torvalds struct hci_ev_stack_internal { 15231da177e4SLinus Torvalds __u16 type; 15241da177e4SLinus Torvalds __u8 data[0]; 152566c853ccSGustavo F. Padovan } __packed; 15261da177e4SLinus Torvalds 15271da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 15281da177e4SLinus Torvalds struct hci_ev_si_device { 15291da177e4SLinus Torvalds __u16 event; 15301da177e4SLinus Torvalds __u16 dev_id; 153166c853ccSGustavo F. Padovan } __packed; 15321da177e4SLinus Torvalds 15331da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 15341da177e4SLinus Torvalds struct hci_ev_si_security { 15351da177e4SLinus Torvalds __u16 event; 15361da177e4SLinus Torvalds __u16 proto; 15371da177e4SLinus Torvalds __u16 subproto; 15381da177e4SLinus Torvalds __u8 incoming; 153966c853ccSGustavo F. Padovan } __packed; 15401da177e4SLinus Torvalds 15411da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 15421da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 15431da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 15441da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 15451da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 15461da177e4SLinus Torvalds 15471da177e4SLinus Torvalds struct hci_command_hdr { 15481ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 15491da177e4SLinus Torvalds __u8 plen; 155066c853ccSGustavo F. Padovan } __packed; 15511da177e4SLinus Torvalds 15521da177e4SLinus Torvalds struct hci_event_hdr { 15531da177e4SLinus Torvalds __u8 evt; 15541da177e4SLinus Torvalds __u8 plen; 155566c853ccSGustavo F. Padovan } __packed; 15561da177e4SLinus Torvalds 15571da177e4SLinus Torvalds struct hci_acl_hdr { 15581ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 15591ebb9252SMarcel Holtmann __le16 dlen; 156066c853ccSGustavo F. Padovan } __packed; 15611da177e4SLinus Torvalds 15621da177e4SLinus Torvalds struct hci_sco_hdr { 15631ebb9252SMarcel Holtmann __le16 handle; 15641da177e4SLinus Torvalds __u8 dlen; 156566c853ccSGustavo F. Padovan } __packed; 15661da177e4SLinus Torvalds 15672a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 15682a123b86SArnaldo Carvalho de Melo { 15692a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 15702a123b86SArnaldo Carvalho de Melo } 15712a123b86SArnaldo Carvalho de Melo 15722a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 15732a123b86SArnaldo Carvalho de Melo { 15742a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 15752a123b86SArnaldo Carvalho de Melo } 15762a123b86SArnaldo Carvalho de Melo 15772a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 15782a123b86SArnaldo Carvalho de Melo { 15792a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 15802a123b86SArnaldo Carvalho de Melo } 15812a123b86SArnaldo Carvalho de Melo 15821da177e4SLinus Torvalds /* Command opcode pack/unpack */ 1583c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10))) 15841da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 15851da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 15861da177e4SLinus Torvalds 15871da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 1588c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12))) 15891da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 15901da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 15911da177e4SLinus Torvalds 15921da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 15931da177e4SLinus Torvalds 15941da177e4SLinus Torvalds /* Socket options */ 15951da177e4SLinus Torvalds #define HCI_DATA_DIR 1 15961da177e4SLinus Torvalds #define HCI_FILTER 2 15971da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 15981da177e4SLinus Torvalds 15991da177e4SLinus Torvalds /* CMSG flags */ 16001da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 16011da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 16021da177e4SLinus Torvalds 16031da177e4SLinus Torvalds struct sockaddr_hci { 16041da177e4SLinus Torvalds sa_family_t hci_family; 16051da177e4SLinus Torvalds unsigned short hci_dev; 1606c02178d2SJohan Hedberg unsigned short hci_channel; 16071da177e4SLinus Torvalds }; 16081da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 16091da177e4SLinus Torvalds 1610c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW 0 161123500189SMarcel Holtmann #define HCI_CHANNEL_USER 1 1612cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR 2 161366f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL 3 1614c02178d2SJohan Hedberg 16151da177e4SLinus Torvalds struct hci_filter { 16161da177e4SLinus Torvalds unsigned long type_mask; 16171da177e4SLinus Torvalds unsigned long event_mask[2]; 1618905f3ed6SAl Viro __le16 opcode; 16191da177e4SLinus Torvalds }; 16201da177e4SLinus Torvalds 16211da177e4SLinus Torvalds struct hci_ufilter { 16221da177e4SLinus Torvalds __u32 type_mask; 16231da177e4SLinus Torvalds __u32 event_mask[2]; 1624905f3ed6SAl Viro __le16 opcode; 16251da177e4SLinus Torvalds }; 16261da177e4SLinus Torvalds 16271da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 16281da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 16291da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 16301da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 16311da177e4SLinus Torvalds 16321da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 16331da177e4SLinus Torvalds struct hci_dev_stats { 16341da177e4SLinus Torvalds __u32 err_rx; 16351da177e4SLinus Torvalds __u32 err_tx; 16361da177e4SLinus Torvalds __u32 cmd_tx; 16371da177e4SLinus Torvalds __u32 evt_rx; 16381da177e4SLinus Torvalds __u32 acl_tx; 16391da177e4SLinus Torvalds __u32 acl_rx; 16401da177e4SLinus Torvalds __u32 sco_tx; 16411da177e4SLinus Torvalds __u32 sco_rx; 16421da177e4SLinus Torvalds __u32 byte_rx; 16431da177e4SLinus Torvalds __u32 byte_tx; 16441da177e4SLinus Torvalds }; 16451da177e4SLinus Torvalds 16461da177e4SLinus Torvalds struct hci_dev_info { 16471da177e4SLinus Torvalds __u16 dev_id; 16481da177e4SLinus Torvalds char name[8]; 16491da177e4SLinus Torvalds 16501da177e4SLinus Torvalds bdaddr_t bdaddr; 16511da177e4SLinus Torvalds 16521da177e4SLinus Torvalds __u32 flags; 16531da177e4SLinus Torvalds __u8 type; 16541da177e4SLinus Torvalds 16551da177e4SLinus Torvalds __u8 features[8]; 16561da177e4SLinus Torvalds 16571da177e4SLinus Torvalds __u32 pkt_type; 16581da177e4SLinus Torvalds __u32 link_policy; 16591da177e4SLinus Torvalds __u32 link_mode; 16601da177e4SLinus Torvalds 16611da177e4SLinus Torvalds __u16 acl_mtu; 16621da177e4SLinus Torvalds __u16 acl_pkts; 16631da177e4SLinus Torvalds __u16 sco_mtu; 16641da177e4SLinus Torvalds __u16 sco_pkts; 16651da177e4SLinus Torvalds 16661da177e4SLinus Torvalds struct hci_dev_stats stat; 16671da177e4SLinus Torvalds }; 16681da177e4SLinus Torvalds 16691da177e4SLinus Torvalds struct hci_conn_info { 16701da177e4SLinus Torvalds __u16 handle; 16711da177e4SLinus Torvalds bdaddr_t bdaddr; 16721da177e4SLinus Torvalds __u8 type; 16731da177e4SLinus Torvalds __u8 out; 16741da177e4SLinus Torvalds __u16 state; 16751da177e4SLinus Torvalds __u32 link_mode; 16761da177e4SLinus Torvalds }; 16771da177e4SLinus Torvalds 16781da177e4SLinus Torvalds struct hci_dev_req { 16791da177e4SLinus Torvalds __u16 dev_id; 16801da177e4SLinus Torvalds __u32 dev_opt; 16811da177e4SLinus Torvalds }; 16821da177e4SLinus Torvalds 16831da177e4SLinus Torvalds struct hci_dev_list_req { 16841da177e4SLinus Torvalds __u16 dev_num; 16851da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 16861da177e4SLinus Torvalds }; 16871da177e4SLinus Torvalds 16881da177e4SLinus Torvalds struct hci_conn_list_req { 16891da177e4SLinus Torvalds __u16 dev_id; 16901da177e4SLinus Torvalds __u16 conn_num; 16911da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 16921da177e4SLinus Torvalds }; 16931da177e4SLinus Torvalds 16941da177e4SLinus Torvalds struct hci_conn_info_req { 16951da177e4SLinus Torvalds bdaddr_t bdaddr; 16961da177e4SLinus Torvalds __u8 type; 16971da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 16981da177e4SLinus Torvalds }; 16991da177e4SLinus Torvalds 170040be492fSMarcel Holtmann struct hci_auth_info_req { 170140be492fSMarcel Holtmann bdaddr_t bdaddr; 170240be492fSMarcel Holtmann __u8 type; 170340be492fSMarcel Holtmann }; 170440be492fSMarcel Holtmann 17051da177e4SLinus Torvalds struct hci_inquiry_req { 17061da177e4SLinus Torvalds __u16 dev_id; 17071da177e4SLinus Torvalds __u16 flags; 17081da177e4SLinus Torvalds __u8 lap[3]; 17091da177e4SLinus Torvalds __u8 length; 17101da177e4SLinus Torvalds __u8 num_rsp; 17111da177e4SLinus Torvalds }; 17121da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 17131da177e4SLinus Torvalds 17148b281b9cSFabio Estevam extern bool enable_hs; 17158830f514SAndrei Emeltchenko 17161da177e4SLinus Torvalds #endif /* __HCI_H */ 1717