11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds BlueZ - Bluetooth protocol stack for Linux 31da177e4SLinus Torvalds Copyright (C) 2000-2001 Qualcomm Incorporated 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 61da177e4SLinus Torvalds 71da177e4SLinus Torvalds This program is free software; you can redistribute it and/or modify 81da177e4SLinus Torvalds it under the terms of the GNU General Public License version 2 as 91da177e4SLinus Torvalds published by the Free Software Foundation; 101da177e4SLinus Torvalds 111da177e4SLinus Torvalds THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 121da177e4SLinus Torvalds OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 131da177e4SLinus Torvalds FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 141da177e4SLinus Torvalds IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 151da177e4SLinus Torvalds CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 161da177e4SLinus Torvalds WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 171da177e4SLinus Torvalds ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 181da177e4SLinus Torvalds OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 191da177e4SLinus Torvalds 201da177e4SLinus Torvalds ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 211da177e4SLinus Torvalds COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 221da177e4SLinus Torvalds SOFTWARE IS DISCLAIMED. 231da177e4SLinus Torvalds */ 241da177e4SLinus Torvalds 251da177e4SLinus Torvalds #ifndef __HCI_H 261da177e4SLinus Torvalds #define __HCI_H 271da177e4SLinus Torvalds 281da177e4SLinus Torvalds #define HCI_MAX_ACL_SIZE 1024 291da177e4SLinus Torvalds #define HCI_MAX_SCO_SIZE 255 301da177e4SLinus Torvalds #define HCI_MAX_EVENT_SIZE 260 311da177e4SLinus Torvalds #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 321da177e4SLinus Torvalds 331da177e4SLinus Torvalds /* HCI dev events */ 341da177e4SLinus Torvalds #define HCI_DEV_REG 1 351da177e4SLinus Torvalds #define HCI_DEV_UNREG 2 361da177e4SLinus Torvalds #define HCI_DEV_UP 3 371da177e4SLinus Torvalds #define HCI_DEV_DOWN 4 381da177e4SLinus Torvalds #define HCI_DEV_SUSPEND 5 391da177e4SLinus Torvalds #define HCI_DEV_RESUME 6 401da177e4SLinus Torvalds 411da177e4SLinus Torvalds /* HCI notify events */ 421da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD 1 431da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL 2 441da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING 3 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds /* HCI device types */ 470ac53939SMarcel Holtmann #define HCI_VIRTUAL 0 481da177e4SLinus Torvalds #define HCI_USB 1 491da177e4SLinus Torvalds #define HCI_PCCARD 2 501da177e4SLinus Torvalds #define HCI_UART 3 511da177e4SLinus Torvalds #define HCI_RS232 4 521da177e4SLinus Torvalds #define HCI_PCI 5 530ac53939SMarcel Holtmann #define HCI_SDIO 6 541da177e4SLinus Torvalds 551da177e4SLinus Torvalds /* HCI device quirks */ 561da177e4SLinus Torvalds enum { 571da177e4SLinus Torvalds HCI_QUIRK_RESET_ON_INIT, 58da1f5198SMarcel Holtmann HCI_QUIRK_RAW_DEVICE, 59da1f5198SMarcel Holtmann HCI_QUIRK_FIXUP_BUFFER_SIZE 601da177e4SLinus Torvalds }; 611da177e4SLinus Torvalds 621da177e4SLinus Torvalds /* HCI device flags */ 631da177e4SLinus Torvalds enum { 641da177e4SLinus Torvalds HCI_UP, 651da177e4SLinus Torvalds HCI_INIT, 661da177e4SLinus Torvalds HCI_RUNNING, 671da177e4SLinus Torvalds 681da177e4SLinus Torvalds HCI_PSCAN, 691da177e4SLinus Torvalds HCI_ISCAN, 701da177e4SLinus Torvalds HCI_AUTH, 711da177e4SLinus Torvalds HCI_ENCRYPT, 721da177e4SLinus Torvalds HCI_INQUIRY, 731da177e4SLinus Torvalds 741da177e4SLinus Torvalds HCI_RAW, 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds HCI_SECMGR 771da177e4SLinus Torvalds }; 781da177e4SLinus Torvalds 791da177e4SLinus Torvalds /* HCI ioctl defines */ 801da177e4SLinus Torvalds #define HCIDEVUP _IOW('H', 201, int) 811da177e4SLinus Torvalds #define HCIDEVDOWN _IOW('H', 202, int) 821da177e4SLinus Torvalds #define HCIDEVRESET _IOW('H', 203, int) 831da177e4SLinus Torvalds #define HCIDEVRESTAT _IOW('H', 204, int) 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds #define HCIGETDEVLIST _IOR('H', 210, int) 861da177e4SLinus Torvalds #define HCIGETDEVINFO _IOR('H', 211, int) 871da177e4SLinus Torvalds #define HCIGETCONNLIST _IOR('H', 212, int) 881da177e4SLinus Torvalds #define HCIGETCONNINFO _IOR('H', 213, int) 891da177e4SLinus Torvalds 901da177e4SLinus Torvalds #define HCISETRAW _IOW('H', 220, int) 911da177e4SLinus Torvalds #define HCISETSCAN _IOW('H', 221, int) 921da177e4SLinus Torvalds #define HCISETAUTH _IOW('H', 222, int) 931da177e4SLinus Torvalds #define HCISETENCRYPT _IOW('H', 223, int) 941da177e4SLinus Torvalds #define HCISETPTYPE _IOW('H', 224, int) 951da177e4SLinus Torvalds #define HCISETLINKPOL _IOW('H', 225, int) 961da177e4SLinus Torvalds #define HCISETLINKMODE _IOW('H', 226, int) 971da177e4SLinus Torvalds #define HCISETACLMTU _IOW('H', 227, int) 981da177e4SLinus Torvalds #define HCISETSCOMTU _IOW('H', 228, int) 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds #define HCISETSECMGR _IOW('H', 230, int) 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds #define HCIINQUIRY _IOR('H', 240, int) 1031da177e4SLinus Torvalds 1041da177e4SLinus Torvalds /* HCI timeouts */ 10504837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 10604837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 10704837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 10804837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 1091da177e4SLinus Torvalds 1105b7f9909SMarcel Holtmann /* HCI data types */ 1111da177e4SLinus Torvalds #define HCI_COMMAND_PKT 0x01 1121da177e4SLinus Torvalds #define HCI_ACLDATA_PKT 0x02 1131da177e4SLinus Torvalds #define HCI_SCODATA_PKT 0x03 1141da177e4SLinus Torvalds #define HCI_EVENT_PKT 0x04 1151da177e4SLinus Torvalds #define HCI_VENDOR_PKT 0xff 1161da177e4SLinus Torvalds 1175b7f9909SMarcel Holtmann /* HCI packet types */ 1181da177e4SLinus Torvalds #define HCI_DM1 0x0008 1191da177e4SLinus Torvalds #define HCI_DM3 0x0400 1201da177e4SLinus Torvalds #define HCI_DM5 0x4000 1211da177e4SLinus Torvalds #define HCI_DH1 0x0010 1221da177e4SLinus Torvalds #define HCI_DH3 0x0800 1231da177e4SLinus Torvalds #define HCI_DH5 0x8000 1241da177e4SLinus Torvalds 1251da177e4SLinus Torvalds #define HCI_HV1 0x0020 1261da177e4SLinus Torvalds #define HCI_HV2 0x0040 1271da177e4SLinus Torvalds #define HCI_HV3 0x0080 1281da177e4SLinus Torvalds 1291da177e4SLinus Torvalds #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 1301da177e4SLinus Torvalds #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 1311da177e4SLinus Torvalds 1325b7f9909SMarcel Holtmann /* eSCO packet types */ 1335b7f9909SMarcel Holtmann #define ESCO_HV1 0x0001 1345b7f9909SMarcel Holtmann #define ESCO_HV2 0x0002 1355b7f9909SMarcel Holtmann #define ESCO_HV3 0x0004 1365b7f9909SMarcel Holtmann #define ESCO_EV3 0x0008 1375b7f9909SMarcel Holtmann #define ESCO_EV4 0x0010 1385b7f9909SMarcel Holtmann #define ESCO_EV5 0x0020 1395b7f9909SMarcel Holtmann 1401da177e4SLinus Torvalds /* ACL flags */ 1411da177e4SLinus Torvalds #define ACL_CONT 0x01 1421da177e4SLinus Torvalds #define ACL_START 0x02 1431da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST 0x04 1441da177e4SLinus Torvalds #define ACL_PICO_BCAST 0x08 1451da177e4SLinus Torvalds 1461da177e4SLinus Torvalds /* Baseband links */ 1471da177e4SLinus Torvalds #define SCO_LINK 0x00 1481da177e4SLinus Torvalds #define ACL_LINK 0x01 1495b7f9909SMarcel Holtmann #define ESCO_LINK 0x02 1501da177e4SLinus Torvalds 1511da177e4SLinus Torvalds /* LMP features */ 1521da177e4SLinus Torvalds #define LMP_3SLOT 0x01 1531da177e4SLinus Torvalds #define LMP_5SLOT 0x02 1541da177e4SLinus Torvalds #define LMP_ENCRYPT 0x04 1551da177e4SLinus Torvalds #define LMP_SOFFSET 0x08 1561da177e4SLinus Torvalds #define LMP_TACCURACY 0x10 1571da177e4SLinus Torvalds #define LMP_RSWITCH 0x20 1581da177e4SLinus Torvalds #define LMP_HOLD 0x40 15904837f64SMarcel Holtmann #define LMP_SNIFF 0x80 1601da177e4SLinus Torvalds 1611da177e4SLinus Torvalds #define LMP_PARK 0x01 1621da177e4SLinus Torvalds #define LMP_RSSI 0x02 1631da177e4SLinus Torvalds #define LMP_QUALITY 0x04 1641da177e4SLinus Torvalds #define LMP_SCO 0x08 1651da177e4SLinus Torvalds #define LMP_HV2 0x10 1661da177e4SLinus Torvalds #define LMP_HV3 0x20 1671da177e4SLinus Torvalds #define LMP_ULAW 0x40 1681da177e4SLinus Torvalds #define LMP_ALAW 0x80 1691da177e4SLinus Torvalds 1701da177e4SLinus Torvalds #define LMP_CVSD 0x01 1711da177e4SLinus Torvalds #define LMP_PSCHEME 0x02 1721da177e4SLinus Torvalds #define LMP_PCONTROL 0x04 1731da177e4SLinus Torvalds 1745b7f9909SMarcel Holtmann #define LMP_ESCO 0x80 1755b7f9909SMarcel Holtmann 1765b7f9909SMarcel Holtmann #define LMP_EV4 0x01 1775b7f9909SMarcel Holtmann #define LMP_EV5 0x02 1785b7f9909SMarcel Holtmann 17904837f64SMarcel Holtmann #define LMP_SNIFF_SUBR 0x02 18004837f64SMarcel Holtmann 18104837f64SMarcel Holtmann /* Connection modes */ 18204837f64SMarcel Holtmann #define HCI_CM_ACTIVE 0x0000 18304837f64SMarcel Holtmann #define HCI_CM_HOLD 0x0001 18404837f64SMarcel Holtmann #define HCI_CM_SNIFF 0x0002 18504837f64SMarcel Holtmann #define HCI_CM_PARK 0x0003 18604837f64SMarcel Holtmann 1871da177e4SLinus Torvalds /* Link policies */ 1881da177e4SLinus Torvalds #define HCI_LP_RSWITCH 0x0001 1891da177e4SLinus Torvalds #define HCI_LP_HOLD 0x0002 1901da177e4SLinus Torvalds #define HCI_LP_SNIFF 0x0004 1911da177e4SLinus Torvalds #define HCI_LP_PARK 0x0008 1921da177e4SLinus Torvalds 19304837f64SMarcel Holtmann /* Link modes */ 1941da177e4SLinus Torvalds #define HCI_LM_ACCEPT 0x8000 1951da177e4SLinus Torvalds #define HCI_LM_MASTER 0x0001 1961da177e4SLinus Torvalds #define HCI_LM_AUTH 0x0002 1971da177e4SLinus Torvalds #define HCI_LM_ENCRYPT 0x0004 1981da177e4SLinus Torvalds #define HCI_LM_TRUSTED 0x0008 1991da177e4SLinus Torvalds #define HCI_LM_RELIABLE 0x0010 2001da177e4SLinus Torvalds #define HCI_LM_SECURE 0x0020 2011da177e4SLinus Torvalds 2021da177e4SLinus Torvalds /* ----- HCI Commands ---- */ 203*a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY 0x0401 204*a9de9248SMarcel Holtmann struct hci_cp_inquiry { 205*a9de9248SMarcel Holtmann __u8 lap[3]; 206*a9de9248SMarcel Holtmann __u8 length; 207*a9de9248SMarcel Holtmann __u8 num_rsp; 2081da177e4SLinus Torvalds } __attribute__ ((packed)); 2091da177e4SLinus Torvalds 210*a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL 0x0402 211*a9de9248SMarcel Holtmann 212*a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 213*a9de9248SMarcel Holtmann 214*a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN 0x0405 215*a9de9248SMarcel Holtmann struct hci_cp_create_conn { 216*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 217*a9de9248SMarcel Holtmann __le16 pkt_type; 218*a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 219*a9de9248SMarcel Holtmann __u8 pscan_mode; 220*a9de9248SMarcel Holtmann __le16 clock_offset; 221*a9de9248SMarcel Holtmann __u8 role_switch; 2221da177e4SLinus Torvalds } __attribute__ ((packed)); 2231da177e4SLinus Torvalds 224*a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT 0x0406 225*a9de9248SMarcel Holtmann struct hci_cp_disconnect { 226*a9de9248SMarcel Holtmann __le16 handle; 227*a9de9248SMarcel Holtmann __u8 reason; 2281da177e4SLinus Torvalds } __attribute__ ((packed)); 2291da177e4SLinus Torvalds 230*a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO 0x0407 231*a9de9248SMarcel Holtmann struct hci_cp_add_sco { 232*a9de9248SMarcel Holtmann __le16 handle; 233*a9de9248SMarcel Holtmann __le16 pkt_type; 234*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 235*a9de9248SMarcel Holtmann 236*a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL 0x0408 237*a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel { 2381da177e4SLinus Torvalds bdaddr_t bdaddr; 2391da177e4SLinus Torvalds } __attribute__ ((packed)); 2401da177e4SLinus Torvalds 241*a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ 0x0409 242*a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req { 243*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 244*a9de9248SMarcel Holtmann __u8 role; 245*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2461da177e4SLinus Torvalds 247*a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ 0x040a 248*a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req { 249*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 250*a9de9248SMarcel Holtmann __u8 reason; 251*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2521da177e4SLinus Torvalds 253*a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY 0x040b 254*a9de9248SMarcel Holtmann struct hci_cp_link_key_reply { 255*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 256*a9de9248SMarcel Holtmann __u8 link_key[16]; 257*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2581da177e4SLinus Torvalds 259*a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 260*a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply { 261*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 262*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 2631da177e4SLinus Torvalds 264*a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY 0x040d 265*a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply { 266*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 267*a9de9248SMarcel Holtmann __u8 pin_len; 268*a9de9248SMarcel Holtmann __u8 pin_code[16]; 269*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 270*a9de9248SMarcel Holtmann 271*a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 272*a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply { 273*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 274*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 275*a9de9248SMarcel Holtmann 276*a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 277*a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype { 278*a9de9248SMarcel Holtmann __le16 handle; 279*a9de9248SMarcel Holtmann __le16 pkt_type; 280*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 281*a9de9248SMarcel Holtmann 282*a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED 0x0411 283*a9de9248SMarcel Holtmann struct hci_cp_auth_requested { 284*a9de9248SMarcel Holtmann __le16 handle; 285*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 286*a9de9248SMarcel Holtmann 287*a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT 0x0413 288*a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt { 289*a9de9248SMarcel Holtmann __le16 handle; 290*a9de9248SMarcel Holtmann __u8 encrypt; 291*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 292*a9de9248SMarcel Holtmann 293*a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 294*a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key { 295*a9de9248SMarcel Holtmann __le16 handle; 296*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 297*a9de9248SMarcel Holtmann 298*a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ 0x0419 299*a9de9248SMarcel Holtmann struct hci_cp_remote_name_req { 300*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 301*a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 302*a9de9248SMarcel Holtmann __u8 pscan_mode; 303*a9de9248SMarcel Holtmann __le16 clock_offset; 304*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 305*a9de9248SMarcel Holtmann 306*a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 307*a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel { 308*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 309*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 310*a9de9248SMarcel Holtmann 311*a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES 0x041b 312*a9de9248SMarcel Holtmann struct hci_cp_read_remote_features { 313*a9de9248SMarcel Holtmann __le16 handle; 314*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 315*a9de9248SMarcel Holtmann 316*a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 317*a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features { 318*a9de9248SMarcel Holtmann __le16 handle; 319*a9de9248SMarcel Holtmann __u8 page; 320*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 321*a9de9248SMarcel Holtmann 322*a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION 0x041d 323*a9de9248SMarcel Holtmann struct hci_cp_read_remote_version { 324*a9de9248SMarcel Holtmann __le16 handle; 325*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 326*a9de9248SMarcel Holtmann 327*a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN 0x0428 328*a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn { 329*a9de9248SMarcel Holtmann __le16 handle; 330*a9de9248SMarcel Holtmann __le32 tx_bandwidth; 331*a9de9248SMarcel Holtmann __le32 rx_bandwidth; 332*a9de9248SMarcel Holtmann __le16 max_latency; 333*a9de9248SMarcel Holtmann __le16 voice_setting; 334*a9de9248SMarcel Holtmann __u8 retrans_effort; 335*a9de9248SMarcel Holtmann __le16 pkt_type; 336*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 337*a9de9248SMarcel Holtmann 338*a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 339*a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req { 340*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 341*a9de9248SMarcel Holtmann __le32 tx_bandwidth; 342*a9de9248SMarcel Holtmann __le32 rx_bandwidth; 343*a9de9248SMarcel Holtmann __le16 max_latency; 344*a9de9248SMarcel Holtmann __le16 content_format; 345*a9de9248SMarcel Holtmann __u8 retrans_effort; 346*a9de9248SMarcel Holtmann __le16 pkt_type; 347*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 348*a9de9248SMarcel Holtmann 349*a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 350*a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req { 351*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 352*a9de9248SMarcel Holtmann __u8 reason; 353*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 354*a9de9248SMarcel Holtmann 355*a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE 0x0803 356*a9de9248SMarcel Holtmann struct hci_cp_sniff_mode { 357*a9de9248SMarcel Holtmann __le16 handle; 358*a9de9248SMarcel Holtmann __le16 max_interval; 359*a9de9248SMarcel Holtmann __le16 min_interval; 360*a9de9248SMarcel Holtmann __le16 attempt; 361*a9de9248SMarcel Holtmann __le16 timeout; 362*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 363*a9de9248SMarcel Holtmann 364*a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE 0x0804 365*a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode { 366*a9de9248SMarcel Holtmann __le16 handle; 367*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 368*a9de9248SMarcel Holtmann 369*a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY 0x0809 370*a9de9248SMarcel Holtmann struct hci_cp_role_discovery { 371*a9de9248SMarcel Holtmann __le16 handle; 372*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 373*a9de9248SMarcel Holtmann struct hci_rp_role_discovery { 374*a9de9248SMarcel Holtmann __u8 status; 375*a9de9248SMarcel Holtmann __le16 handle; 376*a9de9248SMarcel Holtmann __u8 role; 377*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 378*a9de9248SMarcel Holtmann 379*a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE 0x080b 380*a9de9248SMarcel Holtmann struct hci_cp_switch_role { 381*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 382*a9de9248SMarcel Holtmann __u8 role; 383*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 384*a9de9248SMarcel Holtmann 385*a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY 0x080c 386*a9de9248SMarcel Holtmann struct hci_cp_read_link_policy { 387*a9de9248SMarcel Holtmann __le16 handle; 388*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 389*a9de9248SMarcel Holtmann struct hci_rp_read_link_policy { 390*a9de9248SMarcel Holtmann __u8 status; 391*a9de9248SMarcel Holtmann __le16 handle; 392*a9de9248SMarcel Holtmann __le16 policy; 393*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 394*a9de9248SMarcel Holtmann 395*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY 0x080d 396*a9de9248SMarcel Holtmann struct hci_cp_write_link_policy { 397*a9de9248SMarcel Holtmann __le16 handle; 398*a9de9248SMarcel Holtmann __le16 policy; 399*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 400*a9de9248SMarcel Holtmann struct hci_rp_write_link_policy { 401*a9de9248SMarcel Holtmann __u8 status; 402*a9de9248SMarcel Holtmann __le16 handle; 403*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 404*a9de9248SMarcel Holtmann 405*a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE 0x0811 406*a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate { 407*a9de9248SMarcel Holtmann __le16 handle; 408*a9de9248SMarcel Holtmann __le16 max_latency; 409*a9de9248SMarcel Holtmann __le16 min_remote_timeout; 410*a9de9248SMarcel Holtmann __le16 min_local_timeout; 411*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 412*a9de9248SMarcel Holtmann 413*a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK 0x0c01 414*a9de9248SMarcel Holtmann struct hci_cp_set_event_mask { 415*a9de9248SMarcel Holtmann __u8 mask[8]; 416*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 417*a9de9248SMarcel Holtmann 418*a9de9248SMarcel Holtmann #define HCI_OP_RESET 0x0c03 419*a9de9248SMarcel Holtmann 420*a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT 0x0c05 4211da177e4SLinus Torvalds struct hci_cp_set_event_flt { 4221da177e4SLinus Torvalds __u8 flt_type; 4231da177e4SLinus Torvalds __u8 cond_type; 4241da177e4SLinus Torvalds __u8 condition[0]; 4251da177e4SLinus Torvalds } __attribute__ ((packed)); 4261da177e4SLinus Torvalds 4271da177e4SLinus Torvalds /* Filter types */ 4281da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL 0x00 4291da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT 0x01 4301da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP 0x02 4311da177e4SLinus Torvalds 4321da177e4SLinus Torvalds /* CONN_SETUP Condition types */ 4331da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL 0x00 4341da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 4351da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 4361da177e4SLinus Torvalds 4371da177e4SLinus Torvalds /* CONN_SETUP Conditions */ 4381da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF 0x01 4391da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON 0x02 4401da177e4SLinus Torvalds 441*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 442*a9de9248SMarcel Holtmann struct hci_cp_write_local_name { 443*a9de9248SMarcel Holtmann __u8 name[248]; 444*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 445*a9de9248SMarcel Holtmann 446*a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME 0x0c14 447*a9de9248SMarcel Holtmann struct hci_rp_read_local_name { 448*a9de9248SMarcel Holtmann __u8 status; 449*a9de9248SMarcel Holtmann __u8 name[248]; 450*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 451*a9de9248SMarcel Holtmann 452*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 453*a9de9248SMarcel Holtmann 454*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 455*a9de9248SMarcel Holtmann 456*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 457*a9de9248SMarcel Holtmann #define SCAN_DISABLED 0x00 458*a9de9248SMarcel Holtmann #define SCAN_INQUIRY 0x01 459*a9de9248SMarcel Holtmann #define SCAN_PAGE 0x02 460*a9de9248SMarcel Holtmann 461*a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 462*a9de9248SMarcel Holtmann 463*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 464*a9de9248SMarcel Holtmann #define AUTH_DISABLED 0x00 465*a9de9248SMarcel Holtmann #define AUTH_ENABLED 0x01 466*a9de9248SMarcel Holtmann 467*a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 468*a9de9248SMarcel Holtmann 469*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 470*a9de9248SMarcel Holtmann #define ENCRYPT_DISABLED 0x00 471*a9de9248SMarcel Holtmann #define ENCRYPT_P2P 0x01 472*a9de9248SMarcel Holtmann #define ENCRYPT_BOTH 0x02 473*a9de9248SMarcel Holtmann 474*a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 475*a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev { 4761da177e4SLinus Torvalds __u8 status; 4771da177e4SLinus Torvalds __u8 dev_class[3]; 4781da177e4SLinus Torvalds } __attribute__ ((packed)); 4791da177e4SLinus Torvalds 480*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 481*a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev { 4821da177e4SLinus Torvalds __u8 dev_class[3]; 4831da177e4SLinus Torvalds } __attribute__ ((packed)); 4841da177e4SLinus Torvalds 485*a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING 0x0c25 4861da177e4SLinus Torvalds struct hci_rp_read_voice_setting { 4871da177e4SLinus Torvalds __u8 status; 4881ebb9252SMarcel Holtmann __le16 voice_setting; 4891da177e4SLinus Torvalds } __attribute__ ((packed)); 4901da177e4SLinus Torvalds 491*a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 4921da177e4SLinus Torvalds struct hci_cp_write_voice_setting { 4931ebb9252SMarcel Holtmann __le16 voice_setting; 4941da177e4SLinus Torvalds } __attribute__ ((packed)); 4951da177e4SLinus Torvalds 496*a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 4971da177e4SLinus Torvalds struct hci_cp_host_buffer_size { 4981ebb9252SMarcel Holtmann __le16 acl_mtu; 4991da177e4SLinus Torvalds __u8 sco_mtu; 5001ebb9252SMarcel Holtmann __le16 acl_max_pkt; 5011ebb9252SMarcel Holtmann __le16 sco_max_pkt; 5021da177e4SLinus Torvalds } __attribute__ ((packed)); 5031da177e4SLinus Torvalds 504*a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION 0x1001 505*a9de9248SMarcel Holtmann struct hci_rp_read_local_version { 5061da177e4SLinus Torvalds __u8 status; 507*a9de9248SMarcel Holtmann __u8 hci_ver; 508*a9de9248SMarcel Holtmann __le16 hci_rev; 509*a9de9248SMarcel Holtmann __u8 lmp_ver; 510*a9de9248SMarcel Holtmann __le16 manufacturer; 511*a9de9248SMarcel Holtmann __le16 lmp_subver; 5121da177e4SLinus Torvalds } __attribute__ ((packed)); 5131da177e4SLinus Torvalds 514*a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 515*a9de9248SMarcel Holtmann struct hci_rp_read_local_commands { 5161da177e4SLinus Torvalds __u8 status; 517*a9de9248SMarcel Holtmann __u8 commands[64]; 5181da177e4SLinus Torvalds } __attribute__ ((packed)); 5191da177e4SLinus Torvalds 520*a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES 0x1003 521*a9de9248SMarcel Holtmann struct hci_rp_read_local_features { 522*a9de9248SMarcel Holtmann __u8 status; 523*a9de9248SMarcel Holtmann __u8 features[8]; 524*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 525*a9de9248SMarcel Holtmann 526*a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 527*a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features { 528*a9de9248SMarcel Holtmann __u8 status; 529*a9de9248SMarcel Holtmann __u8 page; 530*a9de9248SMarcel Holtmann __u8 max_page; 531*a9de9248SMarcel Holtmann __u8 features[8]; 532*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 533*a9de9248SMarcel Holtmann 534*a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE 0x1005 535*a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size { 536*a9de9248SMarcel Holtmann __u8 status; 537*a9de9248SMarcel Holtmann __le16 acl_mtu; 538*a9de9248SMarcel Holtmann __u8 sco_mtu; 539*a9de9248SMarcel Holtmann __le16 acl_max_pkt; 540*a9de9248SMarcel Holtmann __le16 sco_max_pkt; 541*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 542*a9de9248SMarcel Holtmann 543*a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR 0x1009 544*a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr { 545*a9de9248SMarcel Holtmann __u8 status; 5461da177e4SLinus Torvalds bdaddr_t bdaddr; 5471da177e4SLinus Torvalds } __attribute__ ((packed)); 5481da177e4SLinus Torvalds 5491da177e4SLinus Torvalds /* ---- HCI Events ---- */ 5501da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE 0x01 5511da177e4SLinus Torvalds 5521da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT 0x02 5531da177e4SLinus Torvalds struct inquiry_info { 5541da177e4SLinus Torvalds bdaddr_t bdaddr; 5551da177e4SLinus Torvalds __u8 pscan_rep_mode; 5561da177e4SLinus Torvalds __u8 pscan_period_mode; 5571da177e4SLinus Torvalds __u8 pscan_mode; 5581da177e4SLinus Torvalds __u8 dev_class[3]; 5591ebb9252SMarcel Holtmann __le16 clock_offset; 5601da177e4SLinus Torvalds } __attribute__ ((packed)); 5611da177e4SLinus Torvalds 5621da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE 0x03 5631da177e4SLinus Torvalds struct hci_ev_conn_complete { 5641da177e4SLinus Torvalds __u8 status; 5651ebb9252SMarcel Holtmann __le16 handle; 5661da177e4SLinus Torvalds bdaddr_t bdaddr; 5671da177e4SLinus Torvalds __u8 link_type; 5681da177e4SLinus Torvalds __u8 encr_mode; 5691da177e4SLinus Torvalds } __attribute__ ((packed)); 5701da177e4SLinus Torvalds 5711da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST 0x04 5721da177e4SLinus Torvalds struct hci_ev_conn_request { 5731da177e4SLinus Torvalds bdaddr_t bdaddr; 5741da177e4SLinus Torvalds __u8 dev_class[3]; 5751da177e4SLinus Torvalds __u8 link_type; 5761da177e4SLinus Torvalds } __attribute__ ((packed)); 5771da177e4SLinus Torvalds 5781da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE 0x05 5791da177e4SLinus Torvalds struct hci_ev_disconn_complete { 5801da177e4SLinus Torvalds __u8 status; 5811ebb9252SMarcel Holtmann __le16 handle; 5821da177e4SLinus Torvalds __u8 reason; 5831da177e4SLinus Torvalds } __attribute__ ((packed)); 5841da177e4SLinus Torvalds 5851da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE 0x06 5861da177e4SLinus Torvalds struct hci_ev_auth_complete { 5871da177e4SLinus Torvalds __u8 status; 5881ebb9252SMarcel Holtmann __le16 handle; 5891da177e4SLinus Torvalds } __attribute__ ((packed)); 5901da177e4SLinus Torvalds 591*a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME 0x07 592*a9de9248SMarcel Holtmann struct hci_ev_remote_name { 593*a9de9248SMarcel Holtmann __u8 status; 594*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 595*a9de9248SMarcel Holtmann __u8 name[248]; 596*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 597*a9de9248SMarcel Holtmann 5981da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE 0x08 5991da177e4SLinus Torvalds struct hci_ev_encrypt_change { 6001da177e4SLinus Torvalds __u8 status; 6011ebb9252SMarcel Holtmann __le16 handle; 6021da177e4SLinus Torvalds __u8 encrypt; 6031da177e4SLinus Torvalds } __attribute__ ((packed)); 6041da177e4SLinus Torvalds 605*a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 606*a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete { 6071da177e4SLinus Torvalds __u8 status; 6081ebb9252SMarcel Holtmann __le16 handle; 6091da177e4SLinus Torvalds } __attribute__ ((packed)); 6101da177e4SLinus Torvalds 611*a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES 0x0b 612*a9de9248SMarcel Holtmann struct hci_ev_remote_features { 613*a9de9248SMarcel Holtmann __u8 status; 614*a9de9248SMarcel Holtmann __le16 handle; 615*a9de9248SMarcel Holtmann __u8 features[8]; 616*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 617*a9de9248SMarcel Holtmann 618*a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION 0x0c 619*a9de9248SMarcel Holtmann struct hci_ev_remote_version { 620*a9de9248SMarcel Holtmann __u8 status; 621*a9de9248SMarcel Holtmann __le16 handle; 622*a9de9248SMarcel Holtmann __u8 lmp_ver; 623*a9de9248SMarcel Holtmann __le16 manufacturer; 624*a9de9248SMarcel Holtmann __le16 lmp_subver; 625*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 626*a9de9248SMarcel Holtmann 627*a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 6281da177e4SLinus Torvalds struct hci_qos { 6291da177e4SLinus Torvalds __u8 service_type; 6301da177e4SLinus Torvalds __u32 token_rate; 6311da177e4SLinus Torvalds __u32 peak_bandwidth; 6321da177e4SLinus Torvalds __u32 latency; 6331da177e4SLinus Torvalds __u32 delay_variation; 6341da177e4SLinus Torvalds } __attribute__ ((packed)); 6351da177e4SLinus Torvalds struct hci_ev_qos_setup_complete { 6361da177e4SLinus Torvalds __u8 status; 6371ebb9252SMarcel Holtmann __le16 handle; 6381da177e4SLinus Torvalds struct hci_qos qos; 6391da177e4SLinus Torvalds } __attribute__ ((packed)); 6401da177e4SLinus Torvalds 641*a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE 0x0e 6421da177e4SLinus Torvalds struct hci_ev_cmd_complete { 6431da177e4SLinus Torvalds __u8 ncmd; 6441ebb9252SMarcel Holtmann __le16 opcode; 6451da177e4SLinus Torvalds } __attribute__ ((packed)); 6461da177e4SLinus Torvalds 647*a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS 0x0f 6481da177e4SLinus Torvalds struct hci_ev_cmd_status { 6491da177e4SLinus Torvalds __u8 status; 6501da177e4SLinus Torvalds __u8 ncmd; 6511ebb9252SMarcel Holtmann __le16 opcode; 6521da177e4SLinus Torvalds } __attribute__ ((packed)); 6531da177e4SLinus Torvalds 6541da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE 0x12 6551da177e4SLinus Torvalds struct hci_ev_role_change { 6561da177e4SLinus Torvalds __u8 status; 6571da177e4SLinus Torvalds bdaddr_t bdaddr; 6581da177e4SLinus Torvalds __u8 role; 6591da177e4SLinus Torvalds } __attribute__ ((packed)); 6601da177e4SLinus Torvalds 661*a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS 0x13 662*a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts { 663*a9de9248SMarcel Holtmann __u8 num_hndl; 664*a9de9248SMarcel Holtmann /* variable length part */ 665*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 666*a9de9248SMarcel Holtmann 6671da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE 0x14 6681da177e4SLinus Torvalds struct hci_ev_mode_change { 6691da177e4SLinus Torvalds __u8 status; 6701ebb9252SMarcel Holtmann __le16 handle; 6711da177e4SLinus Torvalds __u8 mode; 6721ebb9252SMarcel Holtmann __le16 interval; 6731da177e4SLinus Torvalds } __attribute__ ((packed)); 6741da177e4SLinus Torvalds 6751da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ 0x16 6761da177e4SLinus Torvalds struct hci_ev_pin_code_req { 6771da177e4SLinus Torvalds bdaddr_t bdaddr; 6781da177e4SLinus Torvalds } __attribute__ ((packed)); 6791da177e4SLinus Torvalds 6801da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ 0x17 6811da177e4SLinus Torvalds struct hci_ev_link_key_req { 6821da177e4SLinus Torvalds bdaddr_t bdaddr; 6831da177e4SLinus Torvalds } __attribute__ ((packed)); 6841da177e4SLinus Torvalds 6851da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY 0x18 6861da177e4SLinus Torvalds struct hci_ev_link_key_notify { 6871da177e4SLinus Torvalds bdaddr_t bdaddr; 6881da177e4SLinus Torvalds __u8 link_key[16]; 6891da177e4SLinus Torvalds __u8 key_type; 6901da177e4SLinus Torvalds } __attribute__ ((packed)); 6911da177e4SLinus Torvalds 692*a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET 0x1c 6931da177e4SLinus Torvalds struct hci_ev_clock_offset { 6941da177e4SLinus Torvalds __u8 status; 6951ebb9252SMarcel Holtmann __le16 handle; 6961ebb9252SMarcel Holtmann __le16 clock_offset; 6971da177e4SLinus Torvalds } __attribute__ ((packed)); 6981da177e4SLinus Torvalds 69985a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE 0x20 70085a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode { 70185a1e930SMarcel Holtmann bdaddr_t bdaddr; 70285a1e930SMarcel Holtmann __u8 pscan_rep_mode; 70385a1e930SMarcel Holtmann } __attribute__ ((packed)); 70485a1e930SMarcel Holtmann 705*a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 706*a9de9248SMarcel Holtmann struct inquiry_info_with_rssi { 707*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 708*a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 709*a9de9248SMarcel Holtmann __u8 pscan_period_mode; 710*a9de9248SMarcel Holtmann __u8 dev_class[3]; 711*a9de9248SMarcel Holtmann __le16 clock_offset; 712*a9de9248SMarcel Holtmann __s8 rssi; 713*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 714*a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode { 715*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 716*a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 717*a9de9248SMarcel Holtmann __u8 pscan_period_mode; 718*a9de9248SMarcel Holtmann __u8 pscan_mode; 719*a9de9248SMarcel Holtmann __u8 dev_class[3]; 720*a9de9248SMarcel Holtmann __le16 clock_offset; 721*a9de9248SMarcel Holtmann __s8 rssi; 722*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 723*a9de9248SMarcel Holtmann 724*a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES 0x23 725*a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features { 726*a9de9248SMarcel Holtmann __u8 status; 727*a9de9248SMarcel Holtmann __le16 handle; 728*a9de9248SMarcel Holtmann __u8 page; 729*a9de9248SMarcel Holtmann __u8 max_page; 730*a9de9248SMarcel Holtmann __u8 features[8]; 731*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 732*a9de9248SMarcel Holtmann 733*a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 734*a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete { 735*a9de9248SMarcel Holtmann __u8 status; 736*a9de9248SMarcel Holtmann __le16 handle; 737*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 738*a9de9248SMarcel Holtmann __u8 link_type; 739*a9de9248SMarcel Holtmann __u8 tx_interval; 740*a9de9248SMarcel Holtmann __u8 retrans_window; 741*a9de9248SMarcel Holtmann __le16 rx_pkt_len; 742*a9de9248SMarcel Holtmann __le16 tx_pkt_len; 743*a9de9248SMarcel Holtmann __u8 air_mode; 744*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 745*a9de9248SMarcel Holtmann 746*a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED 0x2d 747*a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed { 748*a9de9248SMarcel Holtmann __u8 status; 749*a9de9248SMarcel Holtmann __le16 handle; 750*a9de9248SMarcel Holtmann __u8 tx_interval; 751*a9de9248SMarcel Holtmann __u8 retrans_window; 752*a9de9248SMarcel Holtmann __le16 rx_pkt_len; 753*a9de9248SMarcel Holtmann __le16 tx_pkt_len; 754*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 755*a9de9248SMarcel Holtmann 756*a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE 0x2e 75704837f64SMarcel Holtmann struct hci_ev_sniff_subrate { 75804837f64SMarcel Holtmann __u8 status; 75904837f64SMarcel Holtmann __le16 handle; 76004837f64SMarcel Holtmann __le16 max_tx_latency; 76104837f64SMarcel Holtmann __le16 max_rx_latency; 76204837f64SMarcel Holtmann __le16 max_remote_timeout; 76304837f64SMarcel Holtmann __le16 max_local_timeout; 76404837f64SMarcel Holtmann } __attribute__ ((packed)); 76504837f64SMarcel Holtmann 766*a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 767*a9de9248SMarcel Holtmann struct extended_inquiry_info { 768*a9de9248SMarcel Holtmann bdaddr_t bdaddr; 769*a9de9248SMarcel Holtmann __u8 pscan_rep_mode; 770*a9de9248SMarcel Holtmann __u8 pscan_period_mode; 771*a9de9248SMarcel Holtmann __u8 dev_class[3]; 772*a9de9248SMarcel Holtmann __le16 clock_offset; 773*a9de9248SMarcel Holtmann __s8 rssi; 774*a9de9248SMarcel Holtmann __u8 data[240]; 775*a9de9248SMarcel Holtmann } __attribute__ ((packed)); 776*a9de9248SMarcel Holtmann 7771da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */ 778*a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL 0xfd 7791da177e4SLinus Torvalds struct hci_ev_stack_internal { 7801da177e4SLinus Torvalds __u16 type; 7811da177e4SLinus Torvalds __u8 data[0]; 7821da177e4SLinus Torvalds } __attribute__ ((packed)); 7831da177e4SLinus Torvalds 7841da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE 0x01 7851da177e4SLinus Torvalds struct hci_ev_si_device { 7861da177e4SLinus Torvalds __u16 event; 7871da177e4SLinus Torvalds __u16 dev_id; 7881da177e4SLinus Torvalds } __attribute__ ((packed)); 7891da177e4SLinus Torvalds 7901da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY 0x02 7911da177e4SLinus Torvalds struct hci_ev_si_security { 7921da177e4SLinus Torvalds __u16 event; 7931da177e4SLinus Torvalds __u16 proto; 7941da177e4SLinus Torvalds __u16 subproto; 7951da177e4SLinus Torvalds __u8 incoming; 7961da177e4SLinus Torvalds } __attribute__ ((packed)); 7971da177e4SLinus Torvalds 7981da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */ 7991da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3 8001da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE 2 8011da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE 4 8021da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE 3 8031da177e4SLinus Torvalds 8041da177e4SLinus Torvalds struct hci_command_hdr { 8051ebb9252SMarcel Holtmann __le16 opcode; /* OCF & OGF */ 8061da177e4SLinus Torvalds __u8 plen; 8071da177e4SLinus Torvalds } __attribute__ ((packed)); 8081da177e4SLinus Torvalds 8091da177e4SLinus Torvalds struct hci_event_hdr { 8101da177e4SLinus Torvalds __u8 evt; 8111da177e4SLinus Torvalds __u8 plen; 8121da177e4SLinus Torvalds } __attribute__ ((packed)); 8131da177e4SLinus Torvalds 8141da177e4SLinus Torvalds struct hci_acl_hdr { 8151ebb9252SMarcel Holtmann __le16 handle; /* Handle & Flags(PB, BC) */ 8161ebb9252SMarcel Holtmann __le16 dlen; 8171da177e4SLinus Torvalds } __attribute__ ((packed)); 8181da177e4SLinus Torvalds 8191da177e4SLinus Torvalds struct hci_sco_hdr { 8201ebb9252SMarcel Holtmann __le16 handle; 8211da177e4SLinus Torvalds __u8 dlen; 8221da177e4SLinus Torvalds } __attribute__ ((packed)); 8231da177e4SLinus Torvalds 8242a123b86SArnaldo Carvalho de Melo #ifdef __KERNEL__ 8252a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h> 8262a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 8272a123b86SArnaldo Carvalho de Melo { 8282a123b86SArnaldo Carvalho de Melo return (struct hci_event_hdr *) skb->data; 8292a123b86SArnaldo Carvalho de Melo } 8302a123b86SArnaldo Carvalho de Melo 8312a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 8322a123b86SArnaldo Carvalho de Melo { 8332a123b86SArnaldo Carvalho de Melo return (struct hci_acl_hdr *) skb->data; 8342a123b86SArnaldo Carvalho de Melo } 8352a123b86SArnaldo Carvalho de Melo 8362a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 8372a123b86SArnaldo Carvalho de Melo { 8382a123b86SArnaldo Carvalho de Melo return (struct hci_sco_hdr *) skb->data; 8392a123b86SArnaldo Carvalho de Melo } 8402a123b86SArnaldo Carvalho de Melo #endif 8412a123b86SArnaldo Carvalho de Melo 8421da177e4SLinus Torvalds /* Command opcode pack/unpack */ 8431da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 8441da177e4SLinus Torvalds #define hci_opcode_ogf(op) (op >> 10) 8451da177e4SLinus Torvalds #define hci_opcode_ocf(op) (op & 0x03ff) 8461da177e4SLinus Torvalds 8471da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */ 8481da177e4SLinus Torvalds #define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) 8491da177e4SLinus Torvalds #define hci_handle(h) (h & 0x0fff) 8501da177e4SLinus Torvalds #define hci_flags(h) (h >> 12) 8511da177e4SLinus Torvalds 8521da177e4SLinus Torvalds /* ---- HCI Sockets ---- */ 8531da177e4SLinus Torvalds 8541da177e4SLinus Torvalds /* Socket options */ 8551da177e4SLinus Torvalds #define HCI_DATA_DIR 1 8561da177e4SLinus Torvalds #define HCI_FILTER 2 8571da177e4SLinus Torvalds #define HCI_TIME_STAMP 3 8581da177e4SLinus Torvalds 8591da177e4SLinus Torvalds /* CMSG flags */ 8601da177e4SLinus Torvalds #define HCI_CMSG_DIR 0x0001 8611da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP 0x0002 8621da177e4SLinus Torvalds 8631da177e4SLinus Torvalds struct sockaddr_hci { 8641da177e4SLinus Torvalds sa_family_t hci_family; 8651da177e4SLinus Torvalds unsigned short hci_dev; 8661da177e4SLinus Torvalds }; 8671da177e4SLinus Torvalds #define HCI_DEV_NONE 0xffff 8681da177e4SLinus Torvalds 8691da177e4SLinus Torvalds struct hci_filter { 8701da177e4SLinus Torvalds unsigned long type_mask; 8711da177e4SLinus Torvalds unsigned long event_mask[2]; 872905f3ed6SAl Viro __le16 opcode; 8731da177e4SLinus Torvalds }; 8741da177e4SLinus Torvalds 8751da177e4SLinus Torvalds struct hci_ufilter { 8761da177e4SLinus Torvalds __u32 type_mask; 8771da177e4SLinus Torvalds __u32 event_mask[2]; 878905f3ed6SAl Viro __le16 opcode; 8791da177e4SLinus Torvalds }; 8801da177e4SLinus Torvalds 8811da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS 31 8821da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS 63 8831da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS 63 8841da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS 127 8851da177e4SLinus Torvalds 8861da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */ 8871da177e4SLinus Torvalds struct hci_dev_stats { 8881da177e4SLinus Torvalds __u32 err_rx; 8891da177e4SLinus Torvalds __u32 err_tx; 8901da177e4SLinus Torvalds __u32 cmd_tx; 8911da177e4SLinus Torvalds __u32 evt_rx; 8921da177e4SLinus Torvalds __u32 acl_tx; 8931da177e4SLinus Torvalds __u32 acl_rx; 8941da177e4SLinus Torvalds __u32 sco_tx; 8951da177e4SLinus Torvalds __u32 sco_rx; 8961da177e4SLinus Torvalds __u32 byte_rx; 8971da177e4SLinus Torvalds __u32 byte_tx; 8981da177e4SLinus Torvalds }; 8991da177e4SLinus Torvalds 9001da177e4SLinus Torvalds struct hci_dev_info { 9011da177e4SLinus Torvalds __u16 dev_id; 9021da177e4SLinus Torvalds char name[8]; 9031da177e4SLinus Torvalds 9041da177e4SLinus Torvalds bdaddr_t bdaddr; 9051da177e4SLinus Torvalds 9061da177e4SLinus Torvalds __u32 flags; 9071da177e4SLinus Torvalds __u8 type; 9081da177e4SLinus Torvalds 9091da177e4SLinus Torvalds __u8 features[8]; 9101da177e4SLinus Torvalds 9111da177e4SLinus Torvalds __u32 pkt_type; 9121da177e4SLinus Torvalds __u32 link_policy; 9131da177e4SLinus Torvalds __u32 link_mode; 9141da177e4SLinus Torvalds 9151da177e4SLinus Torvalds __u16 acl_mtu; 9161da177e4SLinus Torvalds __u16 acl_pkts; 9171da177e4SLinus Torvalds __u16 sco_mtu; 9181da177e4SLinus Torvalds __u16 sco_pkts; 9191da177e4SLinus Torvalds 9201da177e4SLinus Torvalds struct hci_dev_stats stat; 9211da177e4SLinus Torvalds }; 9221da177e4SLinus Torvalds 9231da177e4SLinus Torvalds struct hci_conn_info { 9241da177e4SLinus Torvalds __u16 handle; 9251da177e4SLinus Torvalds bdaddr_t bdaddr; 9261da177e4SLinus Torvalds __u8 type; 9271da177e4SLinus Torvalds __u8 out; 9281da177e4SLinus Torvalds __u16 state; 9291da177e4SLinus Torvalds __u32 link_mode; 9301da177e4SLinus Torvalds }; 9311da177e4SLinus Torvalds 9321da177e4SLinus Torvalds struct hci_dev_req { 9331da177e4SLinus Torvalds __u16 dev_id; 9341da177e4SLinus Torvalds __u32 dev_opt; 9351da177e4SLinus Torvalds }; 9361da177e4SLinus Torvalds 9371da177e4SLinus Torvalds struct hci_dev_list_req { 9381da177e4SLinus Torvalds __u16 dev_num; 9391da177e4SLinus Torvalds struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ 9401da177e4SLinus Torvalds }; 9411da177e4SLinus Torvalds 9421da177e4SLinus Torvalds struct hci_conn_list_req { 9431da177e4SLinus Torvalds __u16 dev_id; 9441da177e4SLinus Torvalds __u16 conn_num; 9451da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 9461da177e4SLinus Torvalds }; 9471da177e4SLinus Torvalds 9481da177e4SLinus Torvalds struct hci_conn_info_req { 9491da177e4SLinus Torvalds bdaddr_t bdaddr; 9501da177e4SLinus Torvalds __u8 type; 9511da177e4SLinus Torvalds struct hci_conn_info conn_info[0]; 9521da177e4SLinus Torvalds }; 9531da177e4SLinus Torvalds 9541da177e4SLinus Torvalds struct hci_inquiry_req { 9551da177e4SLinus Torvalds __u16 dev_id; 9561da177e4SLinus Torvalds __u16 flags; 9571da177e4SLinus Torvalds __u8 lap[3]; 9581da177e4SLinus Torvalds __u8 length; 9591da177e4SLinus Torvalds __u8 num_rsp; 9601da177e4SLinus Torvalds }; 9611da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001 9621da177e4SLinus Torvalds 9631da177e4SLinus Torvalds #endif /* __HCI_H */ 964