1 /* 2 BlueZ - Bluetooth protocol stack for Linux 3 Copyright (C) 2000-2001 Qualcomm Incorporated 4 5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License version 2 as 9 published by the Free Software Foundation; 10 11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 22 SOFTWARE IS DISCLAIMED. 23 */ 24 25 #ifndef __HCI_H 26 #define __HCI_H 27 28 #define HCI_MAX_ACL_SIZE 1024 29 #define HCI_MAX_SCO_SIZE 255 30 #define HCI_MAX_ISO_SIZE 251 31 #define HCI_MAX_EVENT_SIZE 260 32 #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 33 34 #define HCI_LINK_KEY_SIZE 16 35 #define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 36 37 #define HCI_MAX_AMP_ASSOC_SIZE 672 38 39 #define HCI_MAX_CSB_DATA_SIZE 252 40 41 /* HCI dev events */ 42 #define HCI_DEV_REG 1 43 #define HCI_DEV_UNREG 2 44 #define HCI_DEV_UP 3 45 #define HCI_DEV_DOWN 4 46 #define HCI_DEV_SUSPEND 5 47 #define HCI_DEV_RESUME 6 48 #define HCI_DEV_OPEN 7 49 #define HCI_DEV_CLOSE 8 50 #define HCI_DEV_SETUP 9 51 52 /* HCI notify events */ 53 #define HCI_NOTIFY_CONN_ADD 1 54 #define HCI_NOTIFY_CONN_DEL 2 55 #define HCI_NOTIFY_VOICE_SETTING 3 56 #define HCI_NOTIFY_ENABLE_SCO_CVSD 4 57 #define HCI_NOTIFY_ENABLE_SCO_TRANSP 5 58 #define HCI_NOTIFY_DISABLE_SCO 6 59 60 /* HCI bus types */ 61 #define HCI_VIRTUAL 0 62 #define HCI_USB 1 63 #define HCI_PCCARD 2 64 #define HCI_UART 3 65 #define HCI_RS232 4 66 #define HCI_PCI 5 67 #define HCI_SDIO 6 68 #define HCI_SPI 7 69 #define HCI_I2C 8 70 #define HCI_SMD 9 71 72 /* HCI controller types */ 73 #define HCI_PRIMARY 0x00 74 #define HCI_AMP 0x01 75 76 /* First BR/EDR Controller shall have ID = 0 */ 77 #define AMP_ID_BREDR 0x00 78 79 /* AMP controller types */ 80 #define AMP_TYPE_BREDR 0x00 81 #define AMP_TYPE_80211 0x01 82 83 /* AMP controller status */ 84 #define AMP_STATUS_POWERED_DOWN 0x00 85 #define AMP_STATUS_BLUETOOTH_ONLY 0x01 86 #define AMP_STATUS_NO_CAPACITY 0x02 87 #define AMP_STATUS_LOW_CAPACITY 0x03 88 #define AMP_STATUS_MEDIUM_CAPACITY 0x04 89 #define AMP_STATUS_HIGH_CAPACITY 0x05 90 #define AMP_STATUS_FULL_CAPACITY 0x06 91 92 /* HCI device quirks */ 93 enum { 94 /* When this quirk is set, the HCI Reset command is send when 95 * closing the transport instead of when opening it. 96 * 97 * This quirk must be set before hci_register_dev is called. 98 */ 99 HCI_QUIRK_RESET_ON_CLOSE, 100 101 /* When this quirk is set, the device is turned into a raw-only 102 * device and it will stay in unconfigured state. 103 * 104 * This quirk must be set before hci_register_dev is called. 105 */ 106 HCI_QUIRK_RAW_DEVICE, 107 108 /* When this quirk is set, the buffer sizes reported by 109 * HCI Read Buffer Size command are corrected if invalid. 110 * 111 * This quirk must be set before hci_register_dev is called. 112 */ 113 HCI_QUIRK_FIXUP_BUFFER_SIZE, 114 115 /* When this quirk is set, then a controller that does not 116 * indicate support for Inquiry Result with RSSI is assumed to 117 * support it anyway. Some early Bluetooth 1.2 controllers had 118 * wrongly configured local features that will require forcing 119 * them to enable this mode. Getting RSSI information with the 120 * inquiry responses is preferred since it allows for a better 121 * user experience. 122 * 123 * This quirk must be set before hci_register_dev is called. 124 */ 125 HCI_QUIRK_FIXUP_INQUIRY_MODE, 126 127 /* When this quirk is set, then the HCI Read Local Supported 128 * Commands command is not supported. In general Bluetooth 1.2 129 * and later controllers should support this command. However 130 * some controllers indicate Bluetooth 1.2 support, but do 131 * not support this command. 132 * 133 * This quirk must be set before hci_register_dev is called. 134 */ 135 HCI_QUIRK_BROKEN_LOCAL_COMMANDS, 136 137 /* When this quirk is set, then no stored link key handling 138 * is performed. This is mainly due to the fact that the 139 * HCI Delete Stored Link Key command is advertised, but 140 * not supported. 141 * 142 * This quirk must be set before hci_register_dev is called. 143 */ 144 HCI_QUIRK_BROKEN_STORED_LINK_KEY, 145 146 /* When this quirk is set, an external configuration step 147 * is required and will be indicated with the controller 148 * configuration. 149 * 150 * This quirk can be set before hci_register_dev is called or 151 * during the hdev->setup vendor callback. 152 */ 153 HCI_QUIRK_EXTERNAL_CONFIG, 154 155 /* When this quirk is set, the public Bluetooth address 156 * initially reported by HCI Read BD Address command 157 * is considered invalid. Controller configuration is 158 * required before this device can be used. 159 * 160 * This quirk can be set before hci_register_dev is called or 161 * during the hdev->setup vendor callback. 162 */ 163 HCI_QUIRK_INVALID_BDADDR, 164 165 /* When this quirk is set, the public Bluetooth address 166 * initially reported by HCI Read BD Address command 167 * is considered invalid. The public BD Address can be 168 * specified in the fwnode property 'local-bd-address'. 169 * If this property does not exist or is invalid controller 170 * configuration is required before this device can be used. 171 * 172 * This quirk can be set before hci_register_dev is called or 173 * during the hdev->setup vendor callback. 174 */ 175 HCI_QUIRK_USE_BDADDR_PROPERTY, 176 177 /* When this quirk is set, the duplicate filtering during 178 * scanning is based on Bluetooth devices addresses. To allow 179 * RSSI based updates, restart scanning if needed. 180 * 181 * This quirk can be set before hci_register_dev is called or 182 * during the hdev->setup vendor callback. 183 */ 184 HCI_QUIRK_STRICT_DUPLICATE_FILTER, 185 186 /* When this quirk is set, LE scan and BR/EDR inquiry is done 187 * simultaneously, otherwise it's interleaved. 188 * 189 * This quirk can be set before hci_register_dev is called or 190 * during the hdev->setup vendor callback. 191 */ 192 HCI_QUIRK_SIMULTANEOUS_DISCOVERY, 193 194 /* When this quirk is set, the enabling of diagnostic mode is 195 * not persistent over HCI Reset. Every time the controller 196 * is brought up it needs to be reprogrammed. 197 * 198 * This quirk can be set before hci_register_dev is called or 199 * during the hdev->setup vendor callback. 200 */ 201 HCI_QUIRK_NON_PERSISTENT_DIAG, 202 203 /* When this quirk is set, setup() would be run after every 204 * open() and not just after the first open(). 205 * 206 * This quirk can be set before hci_register_dev is called or 207 * during the hdev->setup vendor callback. 208 * 209 */ 210 HCI_QUIRK_NON_PERSISTENT_SETUP, 211 212 /* When this quirk is set, wide band speech is supported by 213 * the driver since no reliable mechanism exist to report 214 * this from the hardware, a driver flag is use to convey 215 * this support 216 * 217 * This quirk must be set before hci_register_dev is called. 218 */ 219 HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, 220 }; 221 222 /* HCI device flags */ 223 enum { 224 HCI_UP, 225 HCI_INIT, 226 HCI_RUNNING, 227 228 HCI_PSCAN, 229 HCI_ISCAN, 230 HCI_AUTH, 231 HCI_ENCRYPT, 232 HCI_INQUIRY, 233 234 HCI_RAW, 235 236 HCI_RESET, 237 }; 238 239 /* HCI socket flags */ 240 enum { 241 HCI_SOCK_TRUSTED, 242 HCI_MGMT_INDEX_EVENTS, 243 HCI_MGMT_UNCONF_INDEX_EVENTS, 244 HCI_MGMT_EXT_INDEX_EVENTS, 245 HCI_MGMT_EXT_INFO_EVENTS, 246 HCI_MGMT_OPTION_EVENTS, 247 HCI_MGMT_SETTING_EVENTS, 248 HCI_MGMT_DEV_CLASS_EVENTS, 249 HCI_MGMT_LOCAL_NAME_EVENTS, 250 HCI_MGMT_OOB_DATA_EVENTS, 251 }; 252 253 /* 254 * BR/EDR and/or LE controller flags: the flags defined here should represent 255 * states from the controller. 256 */ 257 enum { 258 HCI_SETUP, 259 HCI_CONFIG, 260 HCI_AUTO_OFF, 261 HCI_RFKILLED, 262 HCI_MGMT, 263 HCI_BONDABLE, 264 HCI_SERVICE_CACHE, 265 HCI_KEEP_DEBUG_KEYS, 266 HCI_USE_DEBUG_KEYS, 267 HCI_UNREGISTER, 268 HCI_UNCONFIGURED, 269 HCI_USER_CHANNEL, 270 HCI_EXT_CONFIGURED, 271 HCI_LE_ADV, 272 HCI_LE_SCAN, 273 HCI_SSP_ENABLED, 274 HCI_SC_ENABLED, 275 HCI_SC_ONLY, 276 HCI_PRIVACY, 277 HCI_LIMITED_PRIVACY, 278 HCI_RPA_EXPIRED, 279 HCI_RPA_RESOLVING, 280 HCI_HS_ENABLED, 281 HCI_LE_ENABLED, 282 HCI_ADVERTISING, 283 HCI_ADVERTISING_CONNECTABLE, 284 HCI_CONNECTABLE, 285 HCI_DISCOVERABLE, 286 HCI_LIMITED_DISCOVERABLE, 287 HCI_LINK_SECURITY, 288 HCI_PERIODIC_INQ, 289 HCI_FAST_CONNECTABLE, 290 HCI_BREDR_ENABLED, 291 HCI_LE_SCAN_INTERRUPTED, 292 HCI_WIDEBAND_SPEECH_ENABLED, 293 294 HCI_DUT_MODE, 295 HCI_VENDOR_DIAG, 296 HCI_FORCE_BREDR_SMP, 297 HCI_FORCE_STATIC_ADDR, 298 HCI_LL_RPA_RESOLUTION, 299 HCI_CMD_PENDING, 300 301 __HCI_NUM_FLAGS, 302 }; 303 304 /* HCI timeouts */ 305 #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 306 #define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 307 #define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ 308 #define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 309 #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 310 #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 311 #define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ 312 #define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ 313 #define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(4000) /* 4 seconds */ 314 315 /* HCI data types */ 316 #define HCI_COMMAND_PKT 0x01 317 #define HCI_ACLDATA_PKT 0x02 318 #define HCI_SCODATA_PKT 0x03 319 #define HCI_EVENT_PKT 0x04 320 #define HCI_ISODATA_PKT 0x05 321 #define HCI_DIAG_PKT 0xf0 322 #define HCI_VENDOR_PKT 0xff 323 324 /* HCI packet types */ 325 #define HCI_DM1 0x0008 326 #define HCI_DM3 0x0400 327 #define HCI_DM5 0x4000 328 #define HCI_DH1 0x0010 329 #define HCI_DH3 0x0800 330 #define HCI_DH5 0x8000 331 332 /* HCI packet types inverted masks */ 333 #define HCI_2DH1 0x0002 334 #define HCI_3DH1 0x0004 335 #define HCI_2DH3 0x0100 336 #define HCI_3DH3 0x0200 337 #define HCI_2DH5 0x1000 338 #define HCI_3DH5 0x2000 339 340 #define HCI_HV1 0x0020 341 #define HCI_HV2 0x0040 342 #define HCI_HV3 0x0080 343 344 #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 345 #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 346 347 /* eSCO packet types */ 348 #define ESCO_HV1 0x0001 349 #define ESCO_HV2 0x0002 350 #define ESCO_HV3 0x0004 351 #define ESCO_EV3 0x0008 352 #define ESCO_EV4 0x0010 353 #define ESCO_EV5 0x0020 354 #define ESCO_2EV3 0x0040 355 #define ESCO_3EV3 0x0080 356 #define ESCO_2EV5 0x0100 357 #define ESCO_3EV5 0x0200 358 359 #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 360 #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 361 362 /* ACL flags */ 363 #define ACL_START_NO_FLUSH 0x00 364 #define ACL_CONT 0x01 365 #define ACL_START 0x02 366 #define ACL_COMPLETE 0x03 367 #define ACL_ACTIVE_BCAST 0x04 368 #define ACL_PICO_BCAST 0x08 369 370 /* ISO PB flags */ 371 #define ISO_START 0x00 372 #define ISO_CONT 0x01 373 #define ISO_SINGLE 0x02 374 #define ISO_END 0x03 375 376 /* ISO TS flags */ 377 #define ISO_TS 0x01 378 379 /* Baseband links */ 380 #define SCO_LINK 0x00 381 #define ACL_LINK 0x01 382 #define ESCO_LINK 0x02 383 /* Low Energy links do not have defined link type. Use invented one */ 384 #define LE_LINK 0x80 385 #define AMP_LINK 0x81 386 #define ISO_LINK 0x82 387 #define INVALID_LINK 0xff 388 389 /* LMP features */ 390 #define LMP_3SLOT 0x01 391 #define LMP_5SLOT 0x02 392 #define LMP_ENCRYPT 0x04 393 #define LMP_SOFFSET 0x08 394 #define LMP_TACCURACY 0x10 395 #define LMP_RSWITCH 0x20 396 #define LMP_HOLD 0x40 397 #define LMP_SNIFF 0x80 398 399 #define LMP_PARK 0x01 400 #define LMP_RSSI 0x02 401 #define LMP_QUALITY 0x04 402 #define LMP_SCO 0x08 403 #define LMP_HV2 0x10 404 #define LMP_HV3 0x20 405 #define LMP_ULAW 0x40 406 #define LMP_ALAW 0x80 407 408 #define LMP_CVSD 0x01 409 #define LMP_PSCHEME 0x02 410 #define LMP_PCONTROL 0x04 411 #define LMP_TRANSPARENT 0x08 412 413 #define LMP_EDR_2M 0x02 414 #define LMP_EDR_3M 0x04 415 #define LMP_RSSI_INQ 0x40 416 #define LMP_ESCO 0x80 417 418 #define LMP_EV4 0x01 419 #define LMP_EV5 0x02 420 #define LMP_NO_BREDR 0x20 421 #define LMP_LE 0x40 422 #define LMP_EDR_3SLOT 0x80 423 424 #define LMP_EDR_5SLOT 0x01 425 #define LMP_SNIFF_SUBR 0x02 426 #define LMP_PAUSE_ENC 0x04 427 #define LMP_EDR_ESCO_2M 0x20 428 #define LMP_EDR_ESCO_3M 0x40 429 #define LMP_EDR_3S_ESCO 0x80 430 431 #define LMP_EXT_INQ 0x01 432 #define LMP_SIMUL_LE_BR 0x02 433 #define LMP_SIMPLE_PAIR 0x08 434 #define LMP_NO_FLUSH 0x40 435 436 #define LMP_LSTO 0x01 437 #define LMP_INQ_TX_PWR 0x02 438 #define LMP_EXTFEATURES 0x80 439 440 /* Extended LMP features */ 441 #define LMP_CSB_MASTER 0x01 442 #define LMP_CSB_SLAVE 0x02 443 #define LMP_SYNC_TRAIN 0x04 444 #define LMP_SYNC_SCAN 0x08 445 446 #define LMP_SC 0x01 447 #define LMP_PING 0x02 448 449 /* Host features */ 450 #define LMP_HOST_SSP 0x01 451 #define LMP_HOST_LE 0x02 452 #define LMP_HOST_LE_BREDR 0x04 453 #define LMP_HOST_SC 0x08 454 455 /* LE features */ 456 #define HCI_LE_ENCRYPTION 0x01 457 #define HCI_LE_CONN_PARAM_REQ_PROC 0x02 458 #define HCI_LE_SLAVE_FEATURES 0x08 459 #define HCI_LE_PING 0x10 460 #define HCI_LE_DATA_LEN_EXT 0x20 461 #define HCI_LE_PHY_2M 0x01 462 #define HCI_LE_PHY_CODED 0x08 463 #define HCI_LE_EXT_ADV 0x10 464 #define HCI_LE_EXT_SCAN_POLICY 0x80 465 #define HCI_LE_PHY_2M 0x01 466 #define HCI_LE_PHY_CODED 0x08 467 #define HCI_LE_CHAN_SEL_ALG2 0x40 468 #define HCI_LE_CIS_MASTER 0x10 469 #define HCI_LE_CIS_SLAVE 0x20 470 471 /* Connection modes */ 472 #define HCI_CM_ACTIVE 0x0000 473 #define HCI_CM_HOLD 0x0001 474 #define HCI_CM_SNIFF 0x0002 475 #define HCI_CM_PARK 0x0003 476 477 /* Link policies */ 478 #define HCI_LP_RSWITCH 0x0001 479 #define HCI_LP_HOLD 0x0002 480 #define HCI_LP_SNIFF 0x0004 481 #define HCI_LP_PARK 0x0008 482 483 /* Link modes */ 484 #define HCI_LM_ACCEPT 0x8000 485 #define HCI_LM_MASTER 0x0001 486 #define HCI_LM_AUTH 0x0002 487 #define HCI_LM_ENCRYPT 0x0004 488 #define HCI_LM_TRUSTED 0x0008 489 #define HCI_LM_RELIABLE 0x0010 490 #define HCI_LM_SECURE 0x0020 491 #define HCI_LM_FIPS 0x0040 492 493 /* Authentication types */ 494 #define HCI_AT_NO_BONDING 0x00 495 #define HCI_AT_NO_BONDING_MITM 0x01 496 #define HCI_AT_DEDICATED_BONDING 0x02 497 #define HCI_AT_DEDICATED_BONDING_MITM 0x03 498 #define HCI_AT_GENERAL_BONDING 0x04 499 #define HCI_AT_GENERAL_BONDING_MITM 0x05 500 501 /* I/O capabilities */ 502 #define HCI_IO_DISPLAY_ONLY 0x00 503 #define HCI_IO_DISPLAY_YESNO 0x01 504 #define HCI_IO_KEYBOARD_ONLY 0x02 505 #define HCI_IO_NO_INPUT_OUTPUT 0x03 506 507 /* Link Key types */ 508 #define HCI_LK_COMBINATION 0x00 509 #define HCI_LK_LOCAL_UNIT 0x01 510 #define HCI_LK_REMOTE_UNIT 0x02 511 #define HCI_LK_DEBUG_COMBINATION 0x03 512 #define HCI_LK_UNAUTH_COMBINATION_P192 0x04 513 #define HCI_LK_AUTH_COMBINATION_P192 0x05 514 #define HCI_LK_CHANGED_COMBINATION 0x06 515 #define HCI_LK_UNAUTH_COMBINATION_P256 0x07 516 #define HCI_LK_AUTH_COMBINATION_P256 0x08 517 518 /* ---- HCI Error Codes ---- */ 519 #define HCI_ERROR_UNKNOWN_CONN_ID 0x02 520 #define HCI_ERROR_AUTH_FAILURE 0x05 521 #define HCI_ERROR_PIN_OR_KEY_MISSING 0x06 522 #define HCI_ERROR_MEMORY_EXCEEDED 0x07 523 #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 524 #define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d 525 #define HCI_ERROR_REJ_BAD_ADDR 0x0f 526 #define HCI_ERROR_REMOTE_USER_TERM 0x13 527 #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 528 #define HCI_ERROR_REMOTE_POWER_OFF 0x15 529 #define HCI_ERROR_LOCAL_HOST_TERM 0x16 530 #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 531 #define HCI_ERROR_INVALID_LL_PARAMS 0x1e 532 #define HCI_ERROR_UNSPECIFIED 0x1f 533 #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c 534 535 /* Flow control modes */ 536 #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 537 #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 538 539 /* The core spec defines 127 as the "not available" value */ 540 #define HCI_TX_POWER_INVALID 127 541 #define HCI_RSSI_INVALID 127 542 543 #define HCI_ROLE_MASTER 0x00 544 #define HCI_ROLE_SLAVE 0x01 545 546 /* Extended Inquiry Response field types */ 547 #define EIR_FLAGS 0x01 /* flags */ 548 #define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 549 #define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ 550 #define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ 551 #define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ 552 #define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ 553 #define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ 554 #define EIR_NAME_SHORT 0x08 /* shortened local name */ 555 #define EIR_NAME_COMPLETE 0x09 /* complete local name */ 556 #define EIR_TX_POWER 0x0A /* transmit power level */ 557 #define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ 558 #define EIR_SSP_HASH_C192 0x0E /* Simple Pairing Hash C-192 */ 559 #define EIR_SSP_RAND_R192 0x0F /* Simple Pairing Randomizer R-192 */ 560 #define EIR_DEVICE_ID 0x10 /* device ID */ 561 #define EIR_APPEARANCE 0x19 /* Device appearance */ 562 #define EIR_LE_BDADDR 0x1B /* LE Bluetooth device address */ 563 #define EIR_LE_ROLE 0x1C /* LE role */ 564 #define EIR_SSP_HASH_C256 0x1D /* Simple Pairing Hash C-256 */ 565 #define EIR_SSP_RAND_R256 0x1E /* Simple Pairing Rand R-256 */ 566 #define EIR_LE_SC_CONFIRM 0x22 /* LE SC Confirmation Value */ 567 #define EIR_LE_SC_RANDOM 0x23 /* LE SC Random Value */ 568 569 /* Low Energy Advertising Flags */ 570 #define LE_AD_LIMITED 0x01 /* Limited Discoverable */ 571 #define LE_AD_GENERAL 0x02 /* General Discoverable */ 572 #define LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */ 573 #define LE_AD_SIM_LE_BREDR_CTRL 0x08 /* Simultaneous LE & BR/EDR Controller */ 574 #define LE_AD_SIM_LE_BREDR_HOST 0x10 /* Simultaneous LE & BR/EDR Host */ 575 576 /* ----- HCI Commands ---- */ 577 #define HCI_OP_NOP 0x0000 578 579 #define HCI_OP_INQUIRY 0x0401 580 struct hci_cp_inquiry { 581 __u8 lap[3]; 582 __u8 length; 583 __u8 num_rsp; 584 } __packed; 585 586 #define HCI_OP_INQUIRY_CANCEL 0x0402 587 588 #define HCI_OP_PERIODIC_INQ 0x0403 589 590 #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 591 592 #define HCI_OP_CREATE_CONN 0x0405 593 struct hci_cp_create_conn { 594 bdaddr_t bdaddr; 595 __le16 pkt_type; 596 __u8 pscan_rep_mode; 597 __u8 pscan_mode; 598 __le16 clock_offset; 599 __u8 role_switch; 600 } __packed; 601 602 #define HCI_OP_DISCONNECT 0x0406 603 struct hci_cp_disconnect { 604 __le16 handle; 605 __u8 reason; 606 } __packed; 607 608 #define HCI_OP_ADD_SCO 0x0407 609 struct hci_cp_add_sco { 610 __le16 handle; 611 __le16 pkt_type; 612 } __packed; 613 614 #define HCI_OP_CREATE_CONN_CANCEL 0x0408 615 struct hci_cp_create_conn_cancel { 616 bdaddr_t bdaddr; 617 } __packed; 618 619 #define HCI_OP_ACCEPT_CONN_REQ 0x0409 620 struct hci_cp_accept_conn_req { 621 bdaddr_t bdaddr; 622 __u8 role; 623 } __packed; 624 625 #define HCI_OP_REJECT_CONN_REQ 0x040a 626 struct hci_cp_reject_conn_req { 627 bdaddr_t bdaddr; 628 __u8 reason; 629 } __packed; 630 631 #define HCI_OP_LINK_KEY_REPLY 0x040b 632 struct hci_cp_link_key_reply { 633 bdaddr_t bdaddr; 634 __u8 link_key[HCI_LINK_KEY_SIZE]; 635 } __packed; 636 637 #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 638 struct hci_cp_link_key_neg_reply { 639 bdaddr_t bdaddr; 640 } __packed; 641 642 #define HCI_OP_PIN_CODE_REPLY 0x040d 643 struct hci_cp_pin_code_reply { 644 bdaddr_t bdaddr; 645 __u8 pin_len; 646 __u8 pin_code[16]; 647 } __packed; 648 struct hci_rp_pin_code_reply { 649 __u8 status; 650 bdaddr_t bdaddr; 651 } __packed; 652 653 #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 654 struct hci_cp_pin_code_neg_reply { 655 bdaddr_t bdaddr; 656 } __packed; 657 struct hci_rp_pin_code_neg_reply { 658 __u8 status; 659 bdaddr_t bdaddr; 660 } __packed; 661 662 #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 663 struct hci_cp_change_conn_ptype { 664 __le16 handle; 665 __le16 pkt_type; 666 } __packed; 667 668 #define HCI_OP_AUTH_REQUESTED 0x0411 669 struct hci_cp_auth_requested { 670 __le16 handle; 671 } __packed; 672 673 #define HCI_OP_SET_CONN_ENCRYPT 0x0413 674 struct hci_cp_set_conn_encrypt { 675 __le16 handle; 676 __u8 encrypt; 677 } __packed; 678 679 #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 680 struct hci_cp_change_conn_link_key { 681 __le16 handle; 682 } __packed; 683 684 #define HCI_OP_REMOTE_NAME_REQ 0x0419 685 struct hci_cp_remote_name_req { 686 bdaddr_t bdaddr; 687 __u8 pscan_rep_mode; 688 __u8 pscan_mode; 689 __le16 clock_offset; 690 } __packed; 691 692 #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 693 struct hci_cp_remote_name_req_cancel { 694 bdaddr_t bdaddr; 695 } __packed; 696 697 #define HCI_OP_READ_REMOTE_FEATURES 0x041b 698 struct hci_cp_read_remote_features { 699 __le16 handle; 700 } __packed; 701 702 #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 703 struct hci_cp_read_remote_ext_features { 704 __le16 handle; 705 __u8 page; 706 } __packed; 707 708 #define HCI_OP_READ_REMOTE_VERSION 0x041d 709 struct hci_cp_read_remote_version { 710 __le16 handle; 711 } __packed; 712 713 #define HCI_OP_READ_CLOCK_OFFSET 0x041f 714 struct hci_cp_read_clock_offset { 715 __le16 handle; 716 } __packed; 717 718 #define HCI_OP_SETUP_SYNC_CONN 0x0428 719 struct hci_cp_setup_sync_conn { 720 __le16 handle; 721 __le32 tx_bandwidth; 722 __le32 rx_bandwidth; 723 __le16 max_latency; 724 __le16 voice_setting; 725 __u8 retrans_effort; 726 __le16 pkt_type; 727 } __packed; 728 729 #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 730 struct hci_cp_accept_sync_conn_req { 731 bdaddr_t bdaddr; 732 __le32 tx_bandwidth; 733 __le32 rx_bandwidth; 734 __le16 max_latency; 735 __le16 content_format; 736 __u8 retrans_effort; 737 __le16 pkt_type; 738 } __packed; 739 740 #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 741 struct hci_cp_reject_sync_conn_req { 742 bdaddr_t bdaddr; 743 __u8 reason; 744 } __packed; 745 746 #define HCI_OP_IO_CAPABILITY_REPLY 0x042b 747 struct hci_cp_io_capability_reply { 748 bdaddr_t bdaddr; 749 __u8 capability; 750 __u8 oob_data; 751 __u8 authentication; 752 } __packed; 753 754 #define HCI_OP_USER_CONFIRM_REPLY 0x042c 755 struct hci_cp_user_confirm_reply { 756 bdaddr_t bdaddr; 757 } __packed; 758 struct hci_rp_user_confirm_reply { 759 __u8 status; 760 bdaddr_t bdaddr; 761 } __packed; 762 763 #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 764 765 #define HCI_OP_USER_PASSKEY_REPLY 0x042e 766 struct hci_cp_user_passkey_reply { 767 bdaddr_t bdaddr; 768 __le32 passkey; 769 } __packed; 770 771 #define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f 772 773 #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 774 struct hci_cp_remote_oob_data_reply { 775 bdaddr_t bdaddr; 776 __u8 hash[16]; 777 __u8 rand[16]; 778 } __packed; 779 780 #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 781 struct hci_cp_remote_oob_data_neg_reply { 782 bdaddr_t bdaddr; 783 } __packed; 784 785 #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 786 struct hci_cp_io_capability_neg_reply { 787 bdaddr_t bdaddr; 788 __u8 reason; 789 } __packed; 790 791 #define HCI_OP_CREATE_PHY_LINK 0x0435 792 struct hci_cp_create_phy_link { 793 __u8 phy_handle; 794 __u8 key_len; 795 __u8 key_type; 796 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 797 } __packed; 798 799 #define HCI_OP_ACCEPT_PHY_LINK 0x0436 800 struct hci_cp_accept_phy_link { 801 __u8 phy_handle; 802 __u8 key_len; 803 __u8 key_type; 804 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 805 } __packed; 806 807 #define HCI_OP_DISCONN_PHY_LINK 0x0437 808 struct hci_cp_disconn_phy_link { 809 __u8 phy_handle; 810 __u8 reason; 811 } __packed; 812 813 struct ext_flow_spec { 814 __u8 id; 815 __u8 stype; 816 __le16 msdu; 817 __le32 sdu_itime; 818 __le32 acc_lat; 819 __le32 flush_to; 820 } __packed; 821 822 #define HCI_OP_CREATE_LOGICAL_LINK 0x0438 823 #define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439 824 struct hci_cp_create_accept_logical_link { 825 __u8 phy_handle; 826 struct ext_flow_spec tx_flow_spec; 827 struct ext_flow_spec rx_flow_spec; 828 } __packed; 829 830 #define HCI_OP_DISCONN_LOGICAL_LINK 0x043a 831 struct hci_cp_disconn_logical_link { 832 __le16 log_handle; 833 } __packed; 834 835 #define HCI_OP_LOGICAL_LINK_CANCEL 0x043b 836 struct hci_cp_logical_link_cancel { 837 __u8 phy_handle; 838 __u8 flow_spec_id; 839 } __packed; 840 841 struct hci_rp_logical_link_cancel { 842 __u8 status; 843 __u8 phy_handle; 844 __u8 flow_spec_id; 845 } __packed; 846 847 #define HCI_OP_SET_CSB 0x0441 848 struct hci_cp_set_csb { 849 __u8 enable; 850 __u8 lt_addr; 851 __u8 lpo_allowed; 852 __le16 packet_type; 853 __le16 interval_min; 854 __le16 interval_max; 855 __le16 csb_sv_tout; 856 } __packed; 857 struct hci_rp_set_csb { 858 __u8 status; 859 __u8 lt_addr; 860 __le16 interval; 861 } __packed; 862 863 #define HCI_OP_START_SYNC_TRAIN 0x0443 864 865 #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445 866 struct hci_cp_remote_oob_ext_data_reply { 867 bdaddr_t bdaddr; 868 __u8 hash192[16]; 869 __u8 rand192[16]; 870 __u8 hash256[16]; 871 __u8 rand256[16]; 872 } __packed; 873 874 #define HCI_OP_SNIFF_MODE 0x0803 875 struct hci_cp_sniff_mode { 876 __le16 handle; 877 __le16 max_interval; 878 __le16 min_interval; 879 __le16 attempt; 880 __le16 timeout; 881 } __packed; 882 883 #define HCI_OP_EXIT_SNIFF_MODE 0x0804 884 struct hci_cp_exit_sniff_mode { 885 __le16 handle; 886 } __packed; 887 888 #define HCI_OP_ROLE_DISCOVERY 0x0809 889 struct hci_cp_role_discovery { 890 __le16 handle; 891 } __packed; 892 struct hci_rp_role_discovery { 893 __u8 status; 894 __le16 handle; 895 __u8 role; 896 } __packed; 897 898 #define HCI_OP_SWITCH_ROLE 0x080b 899 struct hci_cp_switch_role { 900 bdaddr_t bdaddr; 901 __u8 role; 902 } __packed; 903 904 #define HCI_OP_READ_LINK_POLICY 0x080c 905 struct hci_cp_read_link_policy { 906 __le16 handle; 907 } __packed; 908 struct hci_rp_read_link_policy { 909 __u8 status; 910 __le16 handle; 911 __le16 policy; 912 } __packed; 913 914 #define HCI_OP_WRITE_LINK_POLICY 0x080d 915 struct hci_cp_write_link_policy { 916 __le16 handle; 917 __le16 policy; 918 } __packed; 919 struct hci_rp_write_link_policy { 920 __u8 status; 921 __le16 handle; 922 } __packed; 923 924 #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 925 struct hci_rp_read_def_link_policy { 926 __u8 status; 927 __le16 policy; 928 } __packed; 929 930 #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 931 struct hci_cp_write_def_link_policy { 932 __le16 policy; 933 } __packed; 934 935 #define HCI_OP_SNIFF_SUBRATE 0x0811 936 struct hci_cp_sniff_subrate { 937 __le16 handle; 938 __le16 max_latency; 939 __le16 min_remote_timeout; 940 __le16 min_local_timeout; 941 } __packed; 942 943 #define HCI_OP_SET_EVENT_MASK 0x0c01 944 945 #define HCI_OP_RESET 0x0c03 946 947 #define HCI_OP_SET_EVENT_FLT 0x0c05 948 #define HCI_SET_EVENT_FLT_SIZE 9 949 struct hci_cp_set_event_filter { 950 __u8 flt_type; 951 __u8 cond_type; 952 struct { 953 bdaddr_t bdaddr; 954 __u8 auto_accept; 955 } __packed addr_conn_flt; 956 } __packed; 957 958 /* Filter types */ 959 #define HCI_FLT_CLEAR_ALL 0x00 960 #define HCI_FLT_INQ_RESULT 0x01 961 #define HCI_FLT_CONN_SETUP 0x02 962 963 /* CONN_SETUP Condition types */ 964 #define HCI_CONN_SETUP_ALLOW_ALL 0x00 965 #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 966 #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 967 968 /* CONN_SETUP Conditions */ 969 #define HCI_CONN_SETUP_AUTO_OFF 0x01 970 #define HCI_CONN_SETUP_AUTO_ON 0x02 971 #define HCI_CONN_SETUP_AUTO_ON_WITH_RS 0x03 972 973 #define HCI_OP_READ_STORED_LINK_KEY 0x0c0d 974 struct hci_cp_read_stored_link_key { 975 bdaddr_t bdaddr; 976 __u8 read_all; 977 } __packed; 978 struct hci_rp_read_stored_link_key { 979 __u8 status; 980 __u8 max_keys; 981 __u8 num_keys; 982 } __packed; 983 984 #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 985 struct hci_cp_delete_stored_link_key { 986 bdaddr_t bdaddr; 987 __u8 delete_all; 988 } __packed; 989 struct hci_rp_delete_stored_link_key { 990 __u8 status; 991 __u8 num_keys; 992 } __packed; 993 994 #define HCI_MAX_NAME_LENGTH 248 995 996 #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 997 struct hci_cp_write_local_name { 998 __u8 name[HCI_MAX_NAME_LENGTH]; 999 } __packed; 1000 1001 #define HCI_OP_READ_LOCAL_NAME 0x0c14 1002 struct hci_rp_read_local_name { 1003 __u8 status; 1004 __u8 name[HCI_MAX_NAME_LENGTH]; 1005 } __packed; 1006 1007 #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 1008 1009 #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 1010 1011 #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 1012 #define SCAN_DISABLED 0x00 1013 #define SCAN_INQUIRY 0x01 1014 #define SCAN_PAGE 0x02 1015 1016 #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 1017 1018 #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 1019 #define AUTH_DISABLED 0x00 1020 #define AUTH_ENABLED 0x01 1021 1022 #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 1023 1024 #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 1025 #define ENCRYPT_DISABLED 0x00 1026 #define ENCRYPT_P2P 0x01 1027 #define ENCRYPT_BOTH 0x02 1028 1029 #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 1030 struct hci_rp_read_class_of_dev { 1031 __u8 status; 1032 __u8 dev_class[3]; 1033 } __packed; 1034 1035 #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 1036 struct hci_cp_write_class_of_dev { 1037 __u8 dev_class[3]; 1038 } __packed; 1039 1040 #define HCI_OP_READ_VOICE_SETTING 0x0c25 1041 struct hci_rp_read_voice_setting { 1042 __u8 status; 1043 __le16 voice_setting; 1044 } __packed; 1045 1046 #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 1047 struct hci_cp_write_voice_setting { 1048 __le16 voice_setting; 1049 } __packed; 1050 1051 #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 1052 struct hci_cp_host_buffer_size { 1053 __le16 acl_mtu; 1054 __u8 sco_mtu; 1055 __le16 acl_max_pkt; 1056 __le16 sco_max_pkt; 1057 } __packed; 1058 1059 #define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38 1060 struct hci_rp_read_num_supported_iac { 1061 __u8 status; 1062 __u8 num_iac; 1063 } __packed; 1064 1065 #define HCI_OP_READ_CURRENT_IAC_LAP 0x0c39 1066 1067 #define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a 1068 struct hci_cp_write_current_iac_lap { 1069 __u8 num_iac; 1070 __u8 iac_lap[6]; 1071 } __packed; 1072 1073 #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 1074 1075 #define HCI_MAX_EIR_LENGTH 240 1076 1077 #define HCI_OP_WRITE_EIR 0x0c52 1078 struct hci_cp_write_eir { 1079 __u8 fec; 1080 __u8 data[HCI_MAX_EIR_LENGTH]; 1081 } __packed; 1082 1083 #define HCI_OP_READ_SSP_MODE 0x0c55 1084 struct hci_rp_read_ssp_mode { 1085 __u8 status; 1086 __u8 mode; 1087 } __packed; 1088 1089 #define HCI_OP_WRITE_SSP_MODE 0x0c56 1090 struct hci_cp_write_ssp_mode { 1091 __u8 mode; 1092 } __packed; 1093 1094 #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 1095 struct hci_rp_read_local_oob_data { 1096 __u8 status; 1097 __u8 hash[16]; 1098 __u8 rand[16]; 1099 } __packed; 1100 1101 #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 1102 struct hci_rp_read_inq_rsp_tx_power { 1103 __u8 status; 1104 __s8 tx_power; 1105 } __packed; 1106 1107 #define HCI_OP_READ_DEF_ERR_DATA_REPORTING 0x0c5a 1108 #define ERR_DATA_REPORTING_DISABLED 0x00 1109 #define ERR_DATA_REPORTING_ENABLED 0x01 1110 struct hci_rp_read_def_err_data_reporting { 1111 __u8 status; 1112 __u8 err_data_reporting; 1113 } __packed; 1114 1115 #define HCI_OP_WRITE_DEF_ERR_DATA_REPORTING 0x0c5b 1116 struct hci_cp_write_def_err_data_reporting { 1117 __u8 err_data_reporting; 1118 } __packed; 1119 1120 #define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63 1121 1122 #define HCI_OP_READ_LOCATION_DATA 0x0c64 1123 1124 #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 1125 struct hci_rp_read_flow_control_mode { 1126 __u8 status; 1127 __u8 mode; 1128 } __packed; 1129 1130 #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 1131 struct hci_cp_write_le_host_supported { 1132 __u8 le; 1133 __u8 simul; 1134 } __packed; 1135 1136 #define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74 1137 struct hci_cp_set_reserved_lt_addr { 1138 __u8 lt_addr; 1139 } __packed; 1140 struct hci_rp_set_reserved_lt_addr { 1141 __u8 status; 1142 __u8 lt_addr; 1143 } __packed; 1144 1145 #define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75 1146 struct hci_cp_delete_reserved_lt_addr { 1147 __u8 lt_addr; 1148 } __packed; 1149 struct hci_rp_delete_reserved_lt_addr { 1150 __u8 status; 1151 __u8 lt_addr; 1152 } __packed; 1153 1154 #define HCI_OP_SET_CSB_DATA 0x0c76 1155 struct hci_cp_set_csb_data { 1156 __u8 lt_addr; 1157 __u8 fragment; 1158 __u8 data_length; 1159 __u8 data[HCI_MAX_CSB_DATA_SIZE]; 1160 } __packed; 1161 struct hci_rp_set_csb_data { 1162 __u8 status; 1163 __u8 lt_addr; 1164 } __packed; 1165 1166 #define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77 1167 1168 #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS 0x0c78 1169 struct hci_cp_write_sync_train_params { 1170 __le16 interval_min; 1171 __le16 interval_max; 1172 __le32 sync_train_tout; 1173 __u8 service_data; 1174 } __packed; 1175 struct hci_rp_write_sync_train_params { 1176 __u8 status; 1177 __le16 sync_train_int; 1178 } __packed; 1179 1180 #define HCI_OP_READ_SC_SUPPORT 0x0c79 1181 struct hci_rp_read_sc_support { 1182 __u8 status; 1183 __u8 support; 1184 } __packed; 1185 1186 #define HCI_OP_WRITE_SC_SUPPORT 0x0c7a 1187 struct hci_cp_write_sc_support { 1188 __u8 support; 1189 } __packed; 1190 1191 #define HCI_OP_READ_AUTH_PAYLOAD_TO 0x0c7b 1192 struct hci_cp_read_auth_payload_to { 1193 __le16 handle; 1194 } __packed; 1195 struct hci_rp_read_auth_payload_to { 1196 __u8 status; 1197 __le16 handle; 1198 __le16 timeout; 1199 } __packed; 1200 1201 #define HCI_OP_WRITE_AUTH_PAYLOAD_TO 0x0c7c 1202 struct hci_cp_write_auth_payload_to { 1203 __le16 handle; 1204 __le16 timeout; 1205 } __packed; 1206 struct hci_rp_write_auth_payload_to { 1207 __u8 status; 1208 __le16 handle; 1209 } __packed; 1210 1211 #define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d 1212 struct hci_rp_read_local_oob_ext_data { 1213 __u8 status; 1214 __u8 hash192[16]; 1215 __u8 rand192[16]; 1216 __u8 hash256[16]; 1217 __u8 rand256[16]; 1218 } __packed; 1219 1220 #define HCI_OP_READ_LOCAL_VERSION 0x1001 1221 struct hci_rp_read_local_version { 1222 __u8 status; 1223 __u8 hci_ver; 1224 __le16 hci_rev; 1225 __u8 lmp_ver; 1226 __le16 manufacturer; 1227 __le16 lmp_subver; 1228 } __packed; 1229 1230 #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 1231 struct hci_rp_read_local_commands { 1232 __u8 status; 1233 __u8 commands[64]; 1234 } __packed; 1235 1236 #define HCI_OP_READ_LOCAL_FEATURES 0x1003 1237 struct hci_rp_read_local_features { 1238 __u8 status; 1239 __u8 features[8]; 1240 } __packed; 1241 1242 #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 1243 struct hci_cp_read_local_ext_features { 1244 __u8 page; 1245 } __packed; 1246 struct hci_rp_read_local_ext_features { 1247 __u8 status; 1248 __u8 page; 1249 __u8 max_page; 1250 __u8 features[8]; 1251 } __packed; 1252 1253 #define HCI_OP_READ_BUFFER_SIZE 0x1005 1254 struct hci_rp_read_buffer_size { 1255 __u8 status; 1256 __le16 acl_mtu; 1257 __u8 sco_mtu; 1258 __le16 acl_max_pkt; 1259 __le16 sco_max_pkt; 1260 } __packed; 1261 1262 #define HCI_OP_READ_BD_ADDR 0x1009 1263 struct hci_rp_read_bd_addr { 1264 __u8 status; 1265 bdaddr_t bdaddr; 1266 } __packed; 1267 1268 #define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a 1269 struct hci_rp_read_data_block_size { 1270 __u8 status; 1271 __le16 max_acl_len; 1272 __le16 block_len; 1273 __le16 num_blocks; 1274 } __packed; 1275 1276 #define HCI_OP_READ_LOCAL_CODECS 0x100b 1277 1278 #define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b 1279 struct hci_rp_read_page_scan_activity { 1280 __u8 status; 1281 __le16 interval; 1282 __le16 window; 1283 } __packed; 1284 1285 #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 1286 struct hci_cp_write_page_scan_activity { 1287 __le16 interval; 1288 __le16 window; 1289 } __packed; 1290 1291 #define HCI_OP_READ_TX_POWER 0x0c2d 1292 struct hci_cp_read_tx_power { 1293 __le16 handle; 1294 __u8 type; 1295 } __packed; 1296 struct hci_rp_read_tx_power { 1297 __u8 status; 1298 __le16 handle; 1299 __s8 tx_power; 1300 } __packed; 1301 1302 #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 1303 struct hci_rp_read_page_scan_type { 1304 __u8 status; 1305 __u8 type; 1306 } __packed; 1307 1308 #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 1309 #define PAGE_SCAN_TYPE_STANDARD 0x00 1310 #define PAGE_SCAN_TYPE_INTERLACED 0x01 1311 1312 #define HCI_OP_READ_RSSI 0x1405 1313 struct hci_cp_read_rssi { 1314 __le16 handle; 1315 } __packed; 1316 struct hci_rp_read_rssi { 1317 __u8 status; 1318 __le16 handle; 1319 __s8 rssi; 1320 } __packed; 1321 1322 #define HCI_OP_READ_CLOCK 0x1407 1323 struct hci_cp_read_clock { 1324 __le16 handle; 1325 __u8 which; 1326 } __packed; 1327 struct hci_rp_read_clock { 1328 __u8 status; 1329 __le16 handle; 1330 __le32 clock; 1331 __le16 accuracy; 1332 } __packed; 1333 1334 #define HCI_OP_READ_ENC_KEY_SIZE 0x1408 1335 struct hci_cp_read_enc_key_size { 1336 __le16 handle; 1337 } __packed; 1338 struct hci_rp_read_enc_key_size { 1339 __u8 status; 1340 __le16 handle; 1341 __u8 key_size; 1342 } __packed; 1343 1344 #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1345 struct hci_rp_read_local_amp_info { 1346 __u8 status; 1347 __u8 amp_status; 1348 __le32 total_bw; 1349 __le32 max_bw; 1350 __le32 min_latency; 1351 __le32 max_pdu; 1352 __u8 amp_type; 1353 __le16 pal_cap; 1354 __le16 max_assoc_size; 1355 __le32 max_flush_to; 1356 __le32 be_flush_to; 1357 } __packed; 1358 1359 #define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a 1360 struct hci_cp_read_local_amp_assoc { 1361 __u8 phy_handle; 1362 __le16 len_so_far; 1363 __le16 max_len; 1364 } __packed; 1365 struct hci_rp_read_local_amp_assoc { 1366 __u8 status; 1367 __u8 phy_handle; 1368 __le16 rem_len; 1369 __u8 frag[]; 1370 } __packed; 1371 1372 #define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b 1373 struct hci_cp_write_remote_amp_assoc { 1374 __u8 phy_handle; 1375 __le16 len_so_far; 1376 __le16 rem_len; 1377 __u8 frag[]; 1378 } __packed; 1379 struct hci_rp_write_remote_amp_assoc { 1380 __u8 status; 1381 __u8 phy_handle; 1382 } __packed; 1383 1384 #define HCI_OP_GET_MWS_TRANSPORT_CONFIG 0x140c 1385 1386 #define HCI_OP_ENABLE_DUT_MODE 0x1803 1387 1388 #define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804 1389 1390 #define HCI_OP_LE_SET_EVENT_MASK 0x2001 1391 struct hci_cp_le_set_event_mask { 1392 __u8 mask[8]; 1393 } __packed; 1394 1395 #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 1396 struct hci_rp_le_read_buffer_size { 1397 __u8 status; 1398 __le16 le_mtu; 1399 __u8 le_max_pkt; 1400 } __packed; 1401 1402 #define HCI_OP_LE_READ_LOCAL_FEATURES 0x2003 1403 struct hci_rp_le_read_local_features { 1404 __u8 status; 1405 __u8 features[8]; 1406 } __packed; 1407 1408 #define HCI_OP_LE_SET_RANDOM_ADDR 0x2005 1409 1410 #define HCI_OP_LE_SET_ADV_PARAM 0x2006 1411 struct hci_cp_le_set_adv_param { 1412 __le16 min_interval; 1413 __le16 max_interval; 1414 __u8 type; 1415 __u8 own_address_type; 1416 __u8 direct_addr_type; 1417 bdaddr_t direct_addr; 1418 __u8 channel_map; 1419 __u8 filter_policy; 1420 } __packed; 1421 1422 #define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 1423 struct hci_rp_le_read_adv_tx_power { 1424 __u8 status; 1425 __s8 tx_power; 1426 } __packed; 1427 1428 #define HCI_MAX_AD_LENGTH 31 1429 1430 #define HCI_OP_LE_SET_ADV_DATA 0x2008 1431 struct hci_cp_le_set_adv_data { 1432 __u8 length; 1433 __u8 data[HCI_MAX_AD_LENGTH]; 1434 } __packed; 1435 1436 #define HCI_OP_LE_SET_SCAN_RSP_DATA 0x2009 1437 struct hci_cp_le_set_scan_rsp_data { 1438 __u8 length; 1439 __u8 data[HCI_MAX_AD_LENGTH]; 1440 } __packed; 1441 1442 #define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1443 1444 #define LE_SCAN_PASSIVE 0x00 1445 #define LE_SCAN_ACTIVE 0x01 1446 1447 #define HCI_OP_LE_SET_SCAN_PARAM 0x200b 1448 struct hci_cp_le_set_scan_param { 1449 __u8 type; 1450 __le16 interval; 1451 __le16 window; 1452 __u8 own_address_type; 1453 __u8 filter_policy; 1454 } __packed; 1455 1456 #define LE_SCAN_DISABLE 0x00 1457 #define LE_SCAN_ENABLE 0x01 1458 #define LE_SCAN_FILTER_DUP_DISABLE 0x00 1459 #define LE_SCAN_FILTER_DUP_ENABLE 0x01 1460 1461 #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 1462 struct hci_cp_le_set_scan_enable { 1463 __u8 enable; 1464 __u8 filter_dup; 1465 } __packed; 1466 1467 #define HCI_LE_USE_PEER_ADDR 0x00 1468 #define HCI_LE_USE_WHITELIST 0x01 1469 1470 #define HCI_OP_LE_CREATE_CONN 0x200d 1471 struct hci_cp_le_create_conn { 1472 __le16 scan_interval; 1473 __le16 scan_window; 1474 __u8 filter_policy; 1475 __u8 peer_addr_type; 1476 bdaddr_t peer_addr; 1477 __u8 own_address_type; 1478 __le16 conn_interval_min; 1479 __le16 conn_interval_max; 1480 __le16 conn_latency; 1481 __le16 supervision_timeout; 1482 __le16 min_ce_len; 1483 __le16 max_ce_len; 1484 } __packed; 1485 1486 #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 1487 1488 #define HCI_OP_LE_READ_WHITE_LIST_SIZE 0x200f 1489 struct hci_rp_le_read_white_list_size { 1490 __u8 status; 1491 __u8 size; 1492 } __packed; 1493 1494 #define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010 1495 1496 #define HCI_OP_LE_ADD_TO_WHITE_LIST 0x2011 1497 struct hci_cp_le_add_to_white_list { 1498 __u8 bdaddr_type; 1499 bdaddr_t bdaddr; 1500 } __packed; 1501 1502 #define HCI_OP_LE_DEL_FROM_WHITE_LIST 0x2012 1503 struct hci_cp_le_del_from_white_list { 1504 __u8 bdaddr_type; 1505 bdaddr_t bdaddr; 1506 } __packed; 1507 1508 #define HCI_OP_LE_CONN_UPDATE 0x2013 1509 struct hci_cp_le_conn_update { 1510 __le16 handle; 1511 __le16 conn_interval_min; 1512 __le16 conn_interval_max; 1513 __le16 conn_latency; 1514 __le16 supervision_timeout; 1515 __le16 min_ce_len; 1516 __le16 max_ce_len; 1517 } __packed; 1518 1519 #define HCI_OP_LE_READ_REMOTE_FEATURES 0x2016 1520 struct hci_cp_le_read_remote_features { 1521 __le16 handle; 1522 } __packed; 1523 1524 #define HCI_OP_LE_START_ENC 0x2019 1525 struct hci_cp_le_start_enc { 1526 __le16 handle; 1527 __le64 rand; 1528 __le16 ediv; 1529 __u8 ltk[16]; 1530 } __packed; 1531 1532 #define HCI_OP_LE_LTK_REPLY 0x201a 1533 struct hci_cp_le_ltk_reply { 1534 __le16 handle; 1535 __u8 ltk[16]; 1536 } __packed; 1537 struct hci_rp_le_ltk_reply { 1538 __u8 status; 1539 __le16 handle; 1540 } __packed; 1541 1542 #define HCI_OP_LE_LTK_NEG_REPLY 0x201b 1543 struct hci_cp_le_ltk_neg_reply { 1544 __le16 handle; 1545 } __packed; 1546 struct hci_rp_le_ltk_neg_reply { 1547 __u8 status; 1548 __le16 handle; 1549 } __packed; 1550 1551 #define HCI_OP_LE_READ_SUPPORTED_STATES 0x201c 1552 struct hci_rp_le_read_supported_states { 1553 __u8 status; 1554 __u8 le_states[8]; 1555 } __packed; 1556 1557 #define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020 1558 struct hci_cp_le_conn_param_req_reply { 1559 __le16 handle; 1560 __le16 interval_min; 1561 __le16 interval_max; 1562 __le16 latency; 1563 __le16 timeout; 1564 __le16 min_ce_len; 1565 __le16 max_ce_len; 1566 } __packed; 1567 1568 #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021 1569 struct hci_cp_le_conn_param_req_neg_reply { 1570 __le16 handle; 1571 __u8 reason; 1572 } __packed; 1573 1574 #define HCI_OP_LE_SET_DATA_LEN 0x2022 1575 struct hci_cp_le_set_data_len { 1576 __le16 handle; 1577 __le16 tx_len; 1578 __le16 tx_time; 1579 } __packed; 1580 struct hci_rp_le_set_data_len { 1581 __u8 status; 1582 __le16 handle; 1583 } __packed; 1584 1585 #define HCI_OP_LE_READ_DEF_DATA_LEN 0x2023 1586 struct hci_rp_le_read_def_data_len { 1587 __u8 status; 1588 __le16 tx_len; 1589 __le16 tx_time; 1590 } __packed; 1591 1592 #define HCI_OP_LE_WRITE_DEF_DATA_LEN 0x2024 1593 struct hci_cp_le_write_def_data_len { 1594 __le16 tx_len; 1595 __le16 tx_time; 1596 } __packed; 1597 1598 #define HCI_OP_LE_ADD_TO_RESOLV_LIST 0x2027 1599 struct hci_cp_le_add_to_resolv_list { 1600 __u8 bdaddr_type; 1601 bdaddr_t bdaddr; 1602 __u8 peer_irk[16]; 1603 __u8 local_irk[16]; 1604 } __packed; 1605 1606 #define HCI_OP_LE_DEL_FROM_RESOLV_LIST 0x2028 1607 struct hci_cp_le_del_from_resolv_list { 1608 __u8 bdaddr_type; 1609 bdaddr_t bdaddr; 1610 } __packed; 1611 1612 #define HCI_OP_LE_CLEAR_RESOLV_LIST 0x2029 1613 1614 #define HCI_OP_LE_READ_RESOLV_LIST_SIZE 0x202a 1615 struct hci_rp_le_read_resolv_list_size { 1616 __u8 status; 1617 __u8 size; 1618 } __packed; 1619 1620 #define HCI_OP_LE_SET_ADDR_RESOLV_ENABLE 0x202d 1621 1622 #define HCI_OP_LE_READ_MAX_DATA_LEN 0x202f 1623 struct hci_rp_le_read_max_data_len { 1624 __u8 status; 1625 __le16 tx_len; 1626 __le16 tx_time; 1627 __le16 rx_len; 1628 __le16 rx_time; 1629 } __packed; 1630 1631 #define HCI_OP_LE_SET_DEFAULT_PHY 0x2031 1632 struct hci_cp_le_set_default_phy { 1633 __u8 all_phys; 1634 __u8 tx_phys; 1635 __u8 rx_phys; 1636 } __packed; 1637 1638 #define HCI_LE_SET_PHY_1M 0x01 1639 #define HCI_LE_SET_PHY_2M 0x02 1640 #define HCI_LE_SET_PHY_CODED 0x04 1641 1642 #define HCI_OP_LE_SET_EXT_SCAN_PARAMS 0x2041 1643 struct hci_cp_le_set_ext_scan_params { 1644 __u8 own_addr_type; 1645 __u8 filter_policy; 1646 __u8 scanning_phys; 1647 __u8 data[]; 1648 } __packed; 1649 1650 #define LE_SCAN_PHY_1M 0x01 1651 #define LE_SCAN_PHY_2M 0x02 1652 #define LE_SCAN_PHY_CODED 0x04 1653 1654 struct hci_cp_le_scan_phy_params { 1655 __u8 type; 1656 __le16 interval; 1657 __le16 window; 1658 } __packed; 1659 1660 #define HCI_OP_LE_SET_EXT_SCAN_ENABLE 0x2042 1661 struct hci_cp_le_set_ext_scan_enable { 1662 __u8 enable; 1663 __u8 filter_dup; 1664 __le16 duration; 1665 __le16 period; 1666 } __packed; 1667 1668 #define HCI_OP_LE_EXT_CREATE_CONN 0x2043 1669 struct hci_cp_le_ext_create_conn { 1670 __u8 filter_policy; 1671 __u8 own_addr_type; 1672 __u8 peer_addr_type; 1673 bdaddr_t peer_addr; 1674 __u8 phys; 1675 __u8 data[]; 1676 } __packed; 1677 1678 struct hci_cp_le_ext_conn_param { 1679 __le16 scan_interval; 1680 __le16 scan_window; 1681 __le16 conn_interval_min; 1682 __le16 conn_interval_max; 1683 __le16 conn_latency; 1684 __le16 supervision_timeout; 1685 __le16 min_ce_len; 1686 __le16 max_ce_len; 1687 } __packed; 1688 1689 #define HCI_OP_LE_READ_NUM_SUPPORTED_ADV_SETS 0x203b 1690 struct hci_rp_le_read_num_supported_adv_sets { 1691 __u8 status; 1692 __u8 num_of_sets; 1693 } __packed; 1694 1695 #define HCI_OP_LE_SET_EXT_ADV_PARAMS 0x2036 1696 struct hci_cp_le_set_ext_adv_params { 1697 __u8 handle; 1698 __le16 evt_properties; 1699 __u8 min_interval[3]; 1700 __u8 max_interval[3]; 1701 __u8 channel_map; 1702 __u8 own_addr_type; 1703 __u8 peer_addr_type; 1704 bdaddr_t peer_addr; 1705 __u8 filter_policy; 1706 __u8 tx_power; 1707 __u8 primary_phy; 1708 __u8 secondary_max_skip; 1709 __u8 secondary_phy; 1710 __u8 sid; 1711 __u8 notif_enable; 1712 } __packed; 1713 1714 #define HCI_ADV_PHY_1M 0X01 1715 #define HCI_ADV_PHY_2M 0x02 1716 #define HCI_ADV_PHY_CODED 0x03 1717 1718 struct hci_rp_le_set_ext_adv_params { 1719 __u8 status; 1720 __u8 tx_power; 1721 } __packed; 1722 1723 #define HCI_OP_LE_SET_EXT_ADV_ENABLE 0x2039 1724 struct hci_cp_le_set_ext_adv_enable { 1725 __u8 enable; 1726 __u8 num_of_sets; 1727 __u8 data[]; 1728 } __packed; 1729 1730 struct hci_cp_ext_adv_set { 1731 __u8 handle; 1732 __le16 duration; 1733 __u8 max_events; 1734 } __packed; 1735 1736 #define HCI_OP_LE_SET_EXT_ADV_DATA 0x2037 1737 struct hci_cp_le_set_ext_adv_data { 1738 __u8 handle; 1739 __u8 operation; 1740 __u8 frag_pref; 1741 __u8 length; 1742 __u8 data[HCI_MAX_AD_LENGTH]; 1743 } __packed; 1744 1745 #define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038 1746 struct hci_cp_le_set_ext_scan_rsp_data { 1747 __u8 handle; 1748 __u8 operation; 1749 __u8 frag_pref; 1750 __u8 length; 1751 __u8 data[HCI_MAX_AD_LENGTH]; 1752 } __packed; 1753 1754 #define LE_SET_ADV_DATA_OP_COMPLETE 0x03 1755 1756 #define LE_SET_ADV_DATA_NO_FRAG 0x01 1757 1758 #define HCI_OP_LE_REMOVE_ADV_SET 0x203c 1759 1760 #define HCI_OP_LE_CLEAR_ADV_SETS 0x203d 1761 1762 #define HCI_OP_LE_SET_ADV_SET_RAND_ADDR 0x2035 1763 struct hci_cp_le_set_adv_set_rand_addr { 1764 __u8 handle; 1765 bdaddr_t bdaddr; 1766 } __packed; 1767 1768 #define HCI_OP_LE_READ_BUFFER_SIZE_V2 0x2060 1769 struct hci_rp_le_read_buffer_size_v2 { 1770 __u8 status; 1771 __le16 acl_mtu; 1772 __u8 acl_max_pkt; 1773 __le16 iso_mtu; 1774 __u8 iso_max_pkt; 1775 } __packed; 1776 1777 #define HCI_OP_LE_READ_ISO_TX_SYNC 0x2061 1778 struct hci_cp_le_read_iso_tx_sync { 1779 __le16 handle; 1780 } __packed; 1781 1782 struct hci_rp_le_read_iso_tx_sync { 1783 __u8 status; 1784 __le16 handle; 1785 __le16 seq; 1786 __le32 imestamp; 1787 __u8 offset[3]; 1788 } __packed; 1789 1790 #define HCI_OP_LE_SET_CIG_PARAMS 0x2062 1791 struct hci_cis_params { 1792 __u8 cis_id; 1793 __le16 m_sdu; 1794 __le16 s_sdu; 1795 __u8 m_phy; 1796 __u8 s_phy; 1797 __u8 m_rtn; 1798 __u8 s_rtn; 1799 } __packed; 1800 1801 struct hci_cp_le_set_cig_params { 1802 __u8 cig_id; 1803 __u8 m_interval[3]; 1804 __u8 s_interval[3]; 1805 __u8 sca; 1806 __u8 packing; 1807 __u8 framing; 1808 __le16 m_latency; 1809 __le16 s_latency; 1810 __u8 num_cis; 1811 struct hci_cis_params cis[]; 1812 } __packed; 1813 1814 struct hci_rp_le_set_cig_params { 1815 __u8 status; 1816 __u8 cig_id; 1817 __u8 num_handles; 1818 __le16 handle[]; 1819 } __packed; 1820 1821 #define HCI_OP_LE_CREATE_CIS 0x2064 1822 struct hci_cis { 1823 __le16 cis_handle; 1824 __le16 acl_handle; 1825 } __packed; 1826 1827 struct hci_cp_le_create_cis { 1828 __u8 num_cis; 1829 struct hci_cis cis[]; 1830 } __packed; 1831 1832 #define HCI_OP_LE_REMOVE_CIG 0x2065 1833 struct hci_cp_le_remove_cig { 1834 __u8 cig_id; 1835 } __packed; 1836 1837 #define HCI_OP_LE_ACCEPT_CIS 0x2066 1838 struct hci_cp_le_accept_cis { 1839 __le16 handle; 1840 } __packed; 1841 1842 #define HCI_OP_LE_REJECT_CIS 0x2067 1843 struct hci_cp_le_reject_cis { 1844 __le16 handle; 1845 __u8 reason; 1846 } __packed; 1847 1848 /* ---- HCI Events ---- */ 1849 #define HCI_EV_INQUIRY_COMPLETE 0x01 1850 1851 #define HCI_EV_INQUIRY_RESULT 0x02 1852 struct inquiry_info { 1853 bdaddr_t bdaddr; 1854 __u8 pscan_rep_mode; 1855 __u8 pscan_period_mode; 1856 __u8 pscan_mode; 1857 __u8 dev_class[3]; 1858 __le16 clock_offset; 1859 } __packed; 1860 1861 #define HCI_EV_CONN_COMPLETE 0x03 1862 struct hci_ev_conn_complete { 1863 __u8 status; 1864 __le16 handle; 1865 bdaddr_t bdaddr; 1866 __u8 link_type; 1867 __u8 encr_mode; 1868 } __packed; 1869 1870 #define HCI_EV_CONN_REQUEST 0x04 1871 struct hci_ev_conn_request { 1872 bdaddr_t bdaddr; 1873 __u8 dev_class[3]; 1874 __u8 link_type; 1875 } __packed; 1876 1877 #define HCI_EV_DISCONN_COMPLETE 0x05 1878 struct hci_ev_disconn_complete { 1879 __u8 status; 1880 __le16 handle; 1881 __u8 reason; 1882 } __packed; 1883 1884 #define HCI_EV_AUTH_COMPLETE 0x06 1885 struct hci_ev_auth_complete { 1886 __u8 status; 1887 __le16 handle; 1888 } __packed; 1889 1890 #define HCI_EV_REMOTE_NAME 0x07 1891 struct hci_ev_remote_name { 1892 __u8 status; 1893 bdaddr_t bdaddr; 1894 __u8 name[HCI_MAX_NAME_LENGTH]; 1895 } __packed; 1896 1897 #define HCI_EV_ENCRYPT_CHANGE 0x08 1898 struct hci_ev_encrypt_change { 1899 __u8 status; 1900 __le16 handle; 1901 __u8 encrypt; 1902 } __packed; 1903 1904 #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 1905 struct hci_ev_change_link_key_complete { 1906 __u8 status; 1907 __le16 handle; 1908 } __packed; 1909 1910 #define HCI_EV_REMOTE_FEATURES 0x0b 1911 struct hci_ev_remote_features { 1912 __u8 status; 1913 __le16 handle; 1914 __u8 features[8]; 1915 } __packed; 1916 1917 #define HCI_EV_REMOTE_VERSION 0x0c 1918 struct hci_ev_remote_version { 1919 __u8 status; 1920 __le16 handle; 1921 __u8 lmp_ver; 1922 __le16 manufacturer; 1923 __le16 lmp_subver; 1924 } __packed; 1925 1926 #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 1927 struct hci_qos { 1928 __u8 service_type; 1929 __u32 token_rate; 1930 __u32 peak_bandwidth; 1931 __u32 latency; 1932 __u32 delay_variation; 1933 } __packed; 1934 struct hci_ev_qos_setup_complete { 1935 __u8 status; 1936 __le16 handle; 1937 struct hci_qos qos; 1938 } __packed; 1939 1940 #define HCI_EV_CMD_COMPLETE 0x0e 1941 struct hci_ev_cmd_complete { 1942 __u8 ncmd; 1943 __le16 opcode; 1944 } __packed; 1945 1946 #define HCI_EV_CMD_STATUS 0x0f 1947 struct hci_ev_cmd_status { 1948 __u8 status; 1949 __u8 ncmd; 1950 __le16 opcode; 1951 } __packed; 1952 1953 #define HCI_EV_HARDWARE_ERROR 0x10 1954 struct hci_ev_hardware_error { 1955 __u8 code; 1956 } __packed; 1957 1958 #define HCI_EV_ROLE_CHANGE 0x12 1959 struct hci_ev_role_change { 1960 __u8 status; 1961 bdaddr_t bdaddr; 1962 __u8 role; 1963 } __packed; 1964 1965 #define HCI_EV_NUM_COMP_PKTS 0x13 1966 struct hci_comp_pkts_info { 1967 __le16 handle; 1968 __le16 count; 1969 } __packed; 1970 1971 struct hci_ev_num_comp_pkts { 1972 __u8 num_hndl; 1973 struct hci_comp_pkts_info handles[]; 1974 } __packed; 1975 1976 #define HCI_EV_MODE_CHANGE 0x14 1977 struct hci_ev_mode_change { 1978 __u8 status; 1979 __le16 handle; 1980 __u8 mode; 1981 __le16 interval; 1982 } __packed; 1983 1984 #define HCI_EV_PIN_CODE_REQ 0x16 1985 struct hci_ev_pin_code_req { 1986 bdaddr_t bdaddr; 1987 } __packed; 1988 1989 #define HCI_EV_LINK_KEY_REQ 0x17 1990 struct hci_ev_link_key_req { 1991 bdaddr_t bdaddr; 1992 } __packed; 1993 1994 #define HCI_EV_LINK_KEY_NOTIFY 0x18 1995 struct hci_ev_link_key_notify { 1996 bdaddr_t bdaddr; 1997 __u8 link_key[HCI_LINK_KEY_SIZE]; 1998 __u8 key_type; 1999 } __packed; 2000 2001 #define HCI_EV_CLOCK_OFFSET 0x1c 2002 struct hci_ev_clock_offset { 2003 __u8 status; 2004 __le16 handle; 2005 __le16 clock_offset; 2006 } __packed; 2007 2008 #define HCI_EV_PKT_TYPE_CHANGE 0x1d 2009 struct hci_ev_pkt_type_change { 2010 __u8 status; 2011 __le16 handle; 2012 __le16 pkt_type; 2013 } __packed; 2014 2015 #define HCI_EV_PSCAN_REP_MODE 0x20 2016 struct hci_ev_pscan_rep_mode { 2017 bdaddr_t bdaddr; 2018 __u8 pscan_rep_mode; 2019 } __packed; 2020 2021 #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 2022 struct inquiry_info_with_rssi { 2023 bdaddr_t bdaddr; 2024 __u8 pscan_rep_mode; 2025 __u8 pscan_period_mode; 2026 __u8 dev_class[3]; 2027 __le16 clock_offset; 2028 __s8 rssi; 2029 } __packed; 2030 struct inquiry_info_with_rssi_and_pscan_mode { 2031 bdaddr_t bdaddr; 2032 __u8 pscan_rep_mode; 2033 __u8 pscan_period_mode; 2034 __u8 pscan_mode; 2035 __u8 dev_class[3]; 2036 __le16 clock_offset; 2037 __s8 rssi; 2038 } __packed; 2039 2040 #define HCI_EV_REMOTE_EXT_FEATURES 0x23 2041 struct hci_ev_remote_ext_features { 2042 __u8 status; 2043 __le16 handle; 2044 __u8 page; 2045 __u8 max_page; 2046 __u8 features[8]; 2047 } __packed; 2048 2049 #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 2050 struct hci_ev_sync_conn_complete { 2051 __u8 status; 2052 __le16 handle; 2053 bdaddr_t bdaddr; 2054 __u8 link_type; 2055 __u8 tx_interval; 2056 __u8 retrans_window; 2057 __le16 rx_pkt_len; 2058 __le16 tx_pkt_len; 2059 __u8 air_mode; 2060 } __packed; 2061 2062 #define HCI_EV_SYNC_CONN_CHANGED 0x2d 2063 struct hci_ev_sync_conn_changed { 2064 __u8 status; 2065 __le16 handle; 2066 __u8 tx_interval; 2067 __u8 retrans_window; 2068 __le16 rx_pkt_len; 2069 __le16 tx_pkt_len; 2070 } __packed; 2071 2072 #define HCI_EV_SNIFF_SUBRATE 0x2e 2073 struct hci_ev_sniff_subrate { 2074 __u8 status; 2075 __le16 handle; 2076 __le16 max_tx_latency; 2077 __le16 max_rx_latency; 2078 __le16 max_remote_timeout; 2079 __le16 max_local_timeout; 2080 } __packed; 2081 2082 #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 2083 struct extended_inquiry_info { 2084 bdaddr_t bdaddr; 2085 __u8 pscan_rep_mode; 2086 __u8 pscan_period_mode; 2087 __u8 dev_class[3]; 2088 __le16 clock_offset; 2089 __s8 rssi; 2090 __u8 data[240]; 2091 } __packed; 2092 2093 #define HCI_EV_KEY_REFRESH_COMPLETE 0x30 2094 struct hci_ev_key_refresh_complete { 2095 __u8 status; 2096 __le16 handle; 2097 } __packed; 2098 2099 #define HCI_EV_IO_CAPA_REQUEST 0x31 2100 struct hci_ev_io_capa_request { 2101 bdaddr_t bdaddr; 2102 } __packed; 2103 2104 #define HCI_EV_IO_CAPA_REPLY 0x32 2105 struct hci_ev_io_capa_reply { 2106 bdaddr_t bdaddr; 2107 __u8 capability; 2108 __u8 oob_data; 2109 __u8 authentication; 2110 } __packed; 2111 2112 #define HCI_EV_USER_CONFIRM_REQUEST 0x33 2113 struct hci_ev_user_confirm_req { 2114 bdaddr_t bdaddr; 2115 __le32 passkey; 2116 } __packed; 2117 2118 #define HCI_EV_USER_PASSKEY_REQUEST 0x34 2119 struct hci_ev_user_passkey_req { 2120 bdaddr_t bdaddr; 2121 } __packed; 2122 2123 #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 2124 struct hci_ev_remote_oob_data_request { 2125 bdaddr_t bdaddr; 2126 } __packed; 2127 2128 #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 2129 struct hci_ev_simple_pair_complete { 2130 __u8 status; 2131 bdaddr_t bdaddr; 2132 } __packed; 2133 2134 #define HCI_EV_USER_PASSKEY_NOTIFY 0x3b 2135 struct hci_ev_user_passkey_notify { 2136 bdaddr_t bdaddr; 2137 __le32 passkey; 2138 } __packed; 2139 2140 #define HCI_KEYPRESS_STARTED 0 2141 #define HCI_KEYPRESS_ENTERED 1 2142 #define HCI_KEYPRESS_ERASED 2 2143 #define HCI_KEYPRESS_CLEARED 3 2144 #define HCI_KEYPRESS_COMPLETED 4 2145 2146 #define HCI_EV_KEYPRESS_NOTIFY 0x3c 2147 struct hci_ev_keypress_notify { 2148 bdaddr_t bdaddr; 2149 __u8 type; 2150 } __packed; 2151 2152 #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 2153 struct hci_ev_remote_host_features { 2154 bdaddr_t bdaddr; 2155 __u8 features[8]; 2156 } __packed; 2157 2158 #define HCI_EV_LE_META 0x3e 2159 struct hci_ev_le_meta { 2160 __u8 subevent; 2161 } __packed; 2162 2163 #define HCI_EV_PHY_LINK_COMPLETE 0x40 2164 struct hci_ev_phy_link_complete { 2165 __u8 status; 2166 __u8 phy_handle; 2167 } __packed; 2168 2169 #define HCI_EV_CHANNEL_SELECTED 0x41 2170 struct hci_ev_channel_selected { 2171 __u8 phy_handle; 2172 } __packed; 2173 2174 #define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42 2175 struct hci_ev_disconn_phy_link_complete { 2176 __u8 status; 2177 __u8 phy_handle; 2178 __u8 reason; 2179 } __packed; 2180 2181 #define HCI_EV_LOGICAL_LINK_COMPLETE 0x45 2182 struct hci_ev_logical_link_complete { 2183 __u8 status; 2184 __le16 handle; 2185 __u8 phy_handle; 2186 __u8 flow_spec_id; 2187 } __packed; 2188 2189 #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46 2190 struct hci_ev_disconn_logical_link_complete { 2191 __u8 status; 2192 __le16 handle; 2193 __u8 reason; 2194 } __packed; 2195 2196 #define HCI_EV_NUM_COMP_BLOCKS 0x48 2197 struct hci_comp_blocks_info { 2198 __le16 handle; 2199 __le16 pkts; 2200 __le16 blocks; 2201 } __packed; 2202 2203 struct hci_ev_num_comp_blocks { 2204 __le16 num_blocks; 2205 __u8 num_hndl; 2206 struct hci_comp_blocks_info handles[]; 2207 } __packed; 2208 2209 #define HCI_EV_SYNC_TRAIN_COMPLETE 0x4F 2210 struct hci_ev_sync_train_complete { 2211 __u8 status; 2212 } __packed; 2213 2214 #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54 2215 2216 #define HCI_EV_LE_CONN_COMPLETE 0x01 2217 struct hci_ev_le_conn_complete { 2218 __u8 status; 2219 __le16 handle; 2220 __u8 role; 2221 __u8 bdaddr_type; 2222 bdaddr_t bdaddr; 2223 __le16 interval; 2224 __le16 latency; 2225 __le16 supervision_timeout; 2226 __u8 clk_accurancy; 2227 } __packed; 2228 2229 /* Advertising report event types */ 2230 #define LE_ADV_IND 0x00 2231 #define LE_ADV_DIRECT_IND 0x01 2232 #define LE_ADV_SCAN_IND 0x02 2233 #define LE_ADV_NONCONN_IND 0x03 2234 #define LE_ADV_SCAN_RSP 0x04 2235 #define LE_ADV_INVALID 0x05 2236 2237 /* Legacy event types in extended adv report */ 2238 #define LE_LEGACY_ADV_IND 0x0013 2239 #define LE_LEGACY_ADV_DIRECT_IND 0x0015 2240 #define LE_LEGACY_ADV_SCAN_IND 0x0012 2241 #define LE_LEGACY_NONCONN_IND 0x0010 2242 #define LE_LEGACY_SCAN_RSP_ADV 0x001b 2243 #define LE_LEGACY_SCAN_RSP_ADV_SCAN 0x001a 2244 2245 /* Extended Advertising event types */ 2246 #define LE_EXT_ADV_NON_CONN_IND 0x0000 2247 #define LE_EXT_ADV_CONN_IND 0x0001 2248 #define LE_EXT_ADV_SCAN_IND 0x0002 2249 #define LE_EXT_ADV_DIRECT_IND 0x0004 2250 #define LE_EXT_ADV_SCAN_RSP 0x0008 2251 #define LE_EXT_ADV_LEGACY_PDU 0x0010 2252 2253 #define ADDR_LE_DEV_PUBLIC 0x00 2254 #define ADDR_LE_DEV_RANDOM 0x01 2255 2256 #define HCI_EV_LE_ADVERTISING_REPORT 0x02 2257 struct hci_ev_le_advertising_info { 2258 __u8 evt_type; 2259 __u8 bdaddr_type; 2260 bdaddr_t bdaddr; 2261 __u8 length; 2262 __u8 data[]; 2263 } __packed; 2264 2265 #define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03 2266 struct hci_ev_le_conn_update_complete { 2267 __u8 status; 2268 __le16 handle; 2269 __le16 interval; 2270 __le16 latency; 2271 __le16 supervision_timeout; 2272 } __packed; 2273 2274 #define HCI_EV_LE_REMOTE_FEAT_COMPLETE 0x04 2275 struct hci_ev_le_remote_feat_complete { 2276 __u8 status; 2277 __le16 handle; 2278 __u8 features[8]; 2279 } __packed; 2280 2281 #define HCI_EV_LE_LTK_REQ 0x05 2282 struct hci_ev_le_ltk_req { 2283 __le16 handle; 2284 __le64 rand; 2285 __le16 ediv; 2286 } __packed; 2287 2288 #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06 2289 struct hci_ev_le_remote_conn_param_req { 2290 __le16 handle; 2291 __le16 interval_min; 2292 __le16 interval_max; 2293 __le16 latency; 2294 __le16 timeout; 2295 } __packed; 2296 2297 #define HCI_EV_LE_DATA_LEN_CHANGE 0x07 2298 struct hci_ev_le_data_len_change { 2299 __le16 handle; 2300 __le16 tx_len; 2301 __le16 tx_time; 2302 __le16 rx_len; 2303 __le16 rx_time; 2304 } __packed; 2305 2306 #define HCI_EV_LE_DIRECT_ADV_REPORT 0x0B 2307 struct hci_ev_le_direct_adv_info { 2308 __u8 evt_type; 2309 __u8 bdaddr_type; 2310 bdaddr_t bdaddr; 2311 __u8 direct_addr_type; 2312 bdaddr_t direct_addr; 2313 __s8 rssi; 2314 } __packed; 2315 2316 #define HCI_EV_LE_PHY_UPDATE_COMPLETE 0x0c 2317 struct hci_ev_le_phy_update_complete { 2318 __u8 status; 2319 __le16 handle; 2320 __u8 tx_phy; 2321 __u8 rx_phy; 2322 } __packed; 2323 2324 #define HCI_EV_LE_EXT_ADV_REPORT 0x0d 2325 struct hci_ev_le_ext_adv_report { 2326 __le16 evt_type; 2327 __u8 bdaddr_type; 2328 bdaddr_t bdaddr; 2329 __u8 primary_phy; 2330 __u8 secondary_phy; 2331 __u8 sid; 2332 __u8 tx_power; 2333 __s8 rssi; 2334 __le16 interval; 2335 __u8 direct_addr_type; 2336 bdaddr_t direct_addr; 2337 __u8 length; 2338 __u8 data[]; 2339 } __packed; 2340 2341 #define HCI_EV_LE_ENHANCED_CONN_COMPLETE 0x0a 2342 struct hci_ev_le_enh_conn_complete { 2343 __u8 status; 2344 __le16 handle; 2345 __u8 role; 2346 __u8 bdaddr_type; 2347 bdaddr_t bdaddr; 2348 bdaddr_t local_rpa; 2349 bdaddr_t peer_rpa; 2350 __le16 interval; 2351 __le16 latency; 2352 __le16 supervision_timeout; 2353 __u8 clk_accurancy; 2354 } __packed; 2355 2356 #define HCI_EV_LE_EXT_ADV_SET_TERM 0x12 2357 struct hci_evt_le_ext_adv_set_term { 2358 __u8 status; 2359 __u8 handle; 2360 __le16 conn_handle; 2361 __u8 num_evts; 2362 } __packed; 2363 2364 #define HCI_EVT_LE_CIS_ESTABLISHED 0x19 2365 struct hci_evt_le_cis_established { 2366 __u8 status; 2367 __le16 handle; 2368 __u8 cig_sync_delay[3]; 2369 __u8 cis_sync_delay[3]; 2370 __u8 m_latency[3]; 2371 __u8 s_latency[3]; 2372 __u8 m_phy; 2373 __u8 s_phy; 2374 __u8 nse; 2375 __u8 m_bn; 2376 __u8 s_bn; 2377 __u8 m_ft; 2378 __u8 s_ft; 2379 __le16 m_mtu; 2380 __le16 s_mtu; 2381 __le16 interval; 2382 } __packed; 2383 2384 #define HCI_EVT_LE_CIS_REQ 0x1a 2385 struct hci_evt_le_cis_req { 2386 __le16 acl_handle; 2387 __le16 cis_handle; 2388 __u8 cig_id; 2389 __u8 cis_id; 2390 } __packed; 2391 2392 #define HCI_EV_VENDOR 0xff 2393 2394 /* Internal events generated by Bluetooth stack */ 2395 #define HCI_EV_STACK_INTERNAL 0xfd 2396 struct hci_ev_stack_internal { 2397 __u16 type; 2398 __u8 data[]; 2399 } __packed; 2400 2401 #define HCI_EV_SI_DEVICE 0x01 2402 struct hci_ev_si_device { 2403 __u16 event; 2404 __u16 dev_id; 2405 } __packed; 2406 2407 #define HCI_EV_SI_SECURITY 0x02 2408 struct hci_ev_si_security { 2409 __u16 event; 2410 __u16 proto; 2411 __u16 subproto; 2412 __u8 incoming; 2413 } __packed; 2414 2415 /* ---- HCI Packet structures ---- */ 2416 #define HCI_COMMAND_HDR_SIZE 3 2417 #define HCI_EVENT_HDR_SIZE 2 2418 #define HCI_ACL_HDR_SIZE 4 2419 #define HCI_SCO_HDR_SIZE 3 2420 #define HCI_ISO_HDR_SIZE 4 2421 2422 struct hci_command_hdr { 2423 __le16 opcode; /* OCF & OGF */ 2424 __u8 plen; 2425 } __packed; 2426 2427 struct hci_event_hdr { 2428 __u8 evt; 2429 __u8 plen; 2430 } __packed; 2431 2432 struct hci_acl_hdr { 2433 __le16 handle; /* Handle & Flags(PB, BC) */ 2434 __le16 dlen; 2435 } __packed; 2436 2437 struct hci_sco_hdr { 2438 __le16 handle; 2439 __u8 dlen; 2440 } __packed; 2441 2442 struct hci_iso_hdr { 2443 __le16 handle; 2444 __le16 dlen; 2445 __u8 data[]; 2446 } __packed; 2447 2448 /* ISO data packet status flags */ 2449 #define HCI_ISO_STATUS_VALID 0x00 2450 #define HCI_ISO_STATUS_INVALID 0x01 2451 #define HCI_ISO_STATUS_NOP 0x02 2452 2453 #define HCI_ISO_DATA_HDR_SIZE 4 2454 struct hci_iso_data_hdr { 2455 __le16 sn; 2456 __le16 slen; 2457 }; 2458 2459 #define HCI_ISO_TS_DATA_HDR_SIZE 8 2460 struct hci_iso_ts_data_hdr { 2461 __le32 ts; 2462 __le16 sn; 2463 __le16 slen; 2464 }; 2465 2466 static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 2467 { 2468 return (struct hci_event_hdr *) skb->data; 2469 } 2470 2471 static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 2472 { 2473 return (struct hci_acl_hdr *) skb->data; 2474 } 2475 2476 static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 2477 { 2478 return (struct hci_sco_hdr *) skb->data; 2479 } 2480 2481 /* Command opcode pack/unpack */ 2482 #define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10))) 2483 #define hci_opcode_ogf(op) (op >> 10) 2484 #define hci_opcode_ocf(op) (op & 0x03ff) 2485 2486 /* ACL handle and flags pack/unpack */ 2487 #define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12))) 2488 #define hci_handle(h) (h & 0x0fff) 2489 #define hci_flags(h) (h >> 12) 2490 2491 /* ISO handle and flags pack/unpack */ 2492 #define hci_iso_flags_pb(f) (f & 0x0003) 2493 #define hci_iso_flags_ts(f) ((f >> 2) & 0x0001) 2494 #define hci_iso_flags_pack(pb, ts) ((pb & 0x03) | ((ts & 0x01) << 2)) 2495 2496 /* ISO data length and flags pack/unpack */ 2497 #define hci_iso_data_len_pack(h, f) ((__u16) ((h) | ((f) << 14))) 2498 #define hci_iso_data_len(h) ((h) & 0x3fff) 2499 #define hci_iso_data_flags(h) ((h) >> 14) 2500 2501 #endif /* __HCI_H */ 2502