hci.h 79 KB

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