hci.h 67 KB

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