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