Difference between revisions of "Bluetooth Driver services"

From Nintendo Switch Brew
Jump to navigation Jump to search
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
= btdrv =
 
= btdrv =
 +
This is "nn::bluetooth::IBluetoothDriver".
 +
 
The bluetooth driver implements the bluetooth protocol over h4/uart.
 
The bluetooth driver implements the bluetooth protocol over h4/uart.
  
Line 10: Line 12:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||  
+
| 0 || InitializeBluetoothDriver
 
|-
 
|-
| 1 || Init
+
| 1 || InitializeBluetooth
 
|-
 
|-
| 2 || Enable
+
| 2 || EnableBluetooth
 
|-
 
|-
| 3 || Disable
+
| 3 || DisableBluetooth
 
|-
 
|-
| 4 || CleanupAndShutdown
+
| 4 || CleanupBluetooth
 
|-
 
|-
 
| 5 || GetAdapterProperties
 
| 5 || GetAdapterProperties
Line 40: Line 42:
 
| 14 || SspReply
 
| 14 || SspReply
 
|-
 
|-
| 15 ||
+
| 15 || GetEventInfo
 +
|-
 +
| 16 || InitializeHid
 +
|-
 +
| 17 || HidConnect
 +
|-
 +
| 18 || HidDisconnect
 +
|-
 +
| 19 || HidSendData
 +
|-
 +
| 20 || HidSendData2
 +
|-
 +
| 21 || HidSetReport
 +
|-
 +
| 22 || HidGetReport
 +
|-
 +
| 23 || HidWakeController
 +
|-
 +
| 24 || HidAddPairedDevice
 +
|-
 +
| 25 || HidGetPairedDevice
 +
|-
 +
| 26 || CleanupHid
 +
|-
 +
| 27 || HidGetEventInfo
 +
|-
 +
| 28 || ExtSetTsi
 +
|-
 +
| 29 || ExtSetBurstMode
 +
|-
 +
| 30 || ExtSetZeroRetran
 +
|-
 +
| 31 || ExtSetMcMode
 +
|-
 +
| 32 || ExtStartLlrMode
 +
|-
 +
| 33 || ExtExitLlrMode
 +
|-
 +
| 34 || ExtSetRadio
 +
|-
 +
| 35 || ExtSetVisibility
 +
|-
 +
| 36 || ExtSetTbfcScan
 +
|-
 +
| 37 || RegisterHidReportEvent
 +
|-
 +
| 38 || [[#HidGetReportEventInfo]]
 +
|-
 +
| 39 || GetLatestPlr
 +
|-
 +
| 40 || [3.0.0+] ExtGetPendingConnections
 +
|-
 +
| 41 || [3.0.0+] GetChannelMap
 +
|-
 +
| 42 || [3.0.0+] EnableBluetoothBoostSetting
 +
|-
 +
| 43 || [3.0.0+] IsBluetoothBoostSettingEnabled
 +
|-
 +
| 44 || [3.0.0+] EnableBluetoothAfhSetting
 +
|-
 +
| 45 || IsBluetoothAfhSettingEnabled
 +
|-
 +
| 46 || [5.0.0+] InitializeBluetoothLe
 +
|-
 +
| 47 || [5.0.0+] EnableBluetoothLe
 +
|-
 +
| 48 || [5.0.0+] DisableBluetoothLe
 +
|-
 +
| 49 || [5.0.0+] CleanupBluetoothLe
 +
|-
 +
| 50 || [5.0.0+] SetLeVisibility
 +
|-
 +
| 51 || [5.0.0+] SetLeConnectionParameter
 +
|-
 +
| 52 || [5.0.0+] SetLeDefaultConnectionParameter
 +
|-
 +
| 53 || [5.0.0+] SetLeAdvertiseData
 +
|-
 +
| 54 || [5.0.0+] SetLeAdvertiseParameter
 +
|-
 +
| 55 || [5.0.0+] StartLeScan
 +
|-
 +
| 56 || [5.0.0+] StopLeScan
 +
|-
 +
| 57 || [5.0.0+] AddLeScanFilterCondition
 +
|-
 +
| 58 || [5.0.0+] DeleteLeScanFilterCondition
 +
|-
 +
| 59 || [5.0.0+] DeleteLeScanFilter
 +
|-
 +
| 60 || [5.0.0+] ClearLeScanFilters
 +
|-
 +
| 61 || [5.0.0+] EnableLeScanFilter
 +
|-
 +
| 62 || [5.0.0+] RegisterLeClient
 +
|-
 +
| 63 || [5.0.0+] UnregisterLeClient
 +
|-
 +
| 64 || [5.0.0+] UnregisterLeClientAll
 +
|-
 +
| 65 || [5.0.0+] LeClientConnect
 +
|-
 +
| 66 || [5.1.0+] ?
 +
|-
 +
| 67 ([5.0.0-5.0.2] 66) || LeClientCancelConnection
 +
|-
 +
| 68 ([5.0.0-5.0.2] 67) || [5.0.0+] LeClientDisconnect
 +
|-
 +
| 69 ([5.0.0-5.0.2] 68) || [5.0.0+] LeClientGetAttributes
 
|-
 
|-
| 16 || InitInterfaces
+
| 70 ([5.0.0-5.0.2] 69) || [5.0.0+] LeClientDiscoverService
 
|-
 
|-
| 17 || HidHostInterface_Connect
+
| 71 ([5.0.0-5.0.2] 70) || [5.0.0+] LeClientConfigureMtu
 
|-
 
|-
| 18 || HidHostInterface_Disconnect
+
| 72 ([5.0.0-5.0.2] 71) || [5.0.0+] RegisterLeServer
 
|-
 
|-
| 19 || HidHostInterface_SendData
+
| 73 ([5.0.0-5.0.2] 72) || [5.0.0+] UnregisterLeServer
 
|-
 
|-
| 20 || HidHostInterface_SendData2
+
| 74 ([5.0.0-5.0.2] 73) || [5.0.0+] LeServerConnect
 
|-
 
|-
| 21 || HidHostInterface_SetReport
+
| 75 || [5.0.0+] CreateLeService
 
|-
 
|-
| 22 || HidHostInterface_GetReport
+
| 76 ([5.0.0-5.0.2] 74) || [5.0.0+] LeServerDisconnect
 
|-
 
|-
| 23 || HidHostInterface_WakeController
+
| 77 || [5.0.0+] AddLeCharacteristic
 
|-
 
|-
| 24 || HidHostInterface_AddPairedDevice
+
| 78 ([5.0.0-5.0.2] 76) || [5.0.0+] StartLeService
 
|-
 
|-
| 25 || HidHostInterface_GetPairedDevice
+
| 79 ([5.0.0-5.0.2] 78) || [5.0.0+] AddLeDescriptor
 
|-
 
|-
| 26 || HidHostInterface_CleanupAndShutdown
+
| 80 ([5.0.0-5.0.2] 79) || [5.0.0+] GetLeCoreEventInfo
 
|-
 
|-
| 27 ||  
+
| 81 ([5.0.0-5.0.2] 80) || [5.0.0+] LeGetFirstCharacteristic
 
|-
 
|-
| 28 || ExtInterface_SetTSI
+
| 82 ([5.0.0-5.0.2] 81) || [5.0.0+] LeGetNextCharacteristic
 
|-
 
|-
| 29 || ExtInterface_SetBurstMode
+
| 83 ([5.0.0-5.0.2] 82) || [5.0.0+] LeGetFirstDescriptor
 
|-
 
|-
| 30 || ExtInterface_SetZeroRetran
+
| 84 || [5.0.0+] RegisterLeCoreDataPath
 
|-
 
|-
| 31 || ExtInterface_SetMcMode
+
| 85 || [5.0.0+] UnregisterLeCoreDataPath
 
|-
 
|-
| 32 || ExtInterface_StartLlrMode
+
| 86 || [5.0.0+] RegisterLeHidDataPath
 
|-
 
|-
| 33 || ExtInterface_ExitLlrMode
+
| 87 || [5.0.0+] UnregisterLeHidDataPath
 
|-
 
|-
| 34 || ExtInterface_SetRadio
+
| 88 || [5.0.0+] RegisterLeDataPath
 
|-
 
|-
| 35 || ExtInterface_SetVisibility
+
| 89 ([5.0.0-5.0.2] 83) || [5.0.0+] LeGetNextDescriptor
 
|-
 
|-
| 36 ||  
+
| 90 ([5.0.0-5.0.2] 89) || [5.0.0+] UnregisterLeDataPath
 
|-
 
|-
| 37 ||  
+
| 91 ([5.0.0-5.0.2] 90) || [5.0.0+] LeClientReadCharacteristic
 
|-
 
|-
| 38 || HidHostInterface_GetLatestPlr
+
| 92 ([5.0.0-5.0.2] 91) || [5.0.0+] LeClientReadDescriptor
 
|-
 
|-
| 39 || ExtInterface_GetPendingConnections
+
| 93 ([5.0.0-5.0.2] 92) || [5.0.0+] LeClientWriteCharacteristic
 
|-
 
|-
| 40 || HidHostInterface_GetChannelMap
+
| 94 || [5.0.0+] LeClientRegisterNotification
 
|-
 
|-
| 41 || SetIsBluetoothBoostEnabled
+
| 95 ([5.0.0-5.0.2] 93) || [5.0.0+] LeClientWriteDescriptor
 
|-
 
|-
| 42 || GetIsBluetoothBoostEnabled
+
| 96 ([5.0.0-5.0.2] 95) || [5.0.0+] LeClientDeregisterNotification
 
|-
 
|-
| 43 || SetIsBluetoothAfhEnabled
+
| 97 ([5.0.0-5.0.2] 96) || [5.0.0+] GetLeHidEventInfo
 
|-
 
|-
| 44 || GetIsBluetoothAfhEnabled
+
| 97 || [5.0.0-5.0.2] RegisterBleHidEvent
 +
|-
 +
| 98 || [5.1.0+] SetLeScanParameter
 +
|-
 +
| 256 || [5.0.0+] GetIsManufacturingMode
 +
|-
 +
| 257 || [7.0.0+] EmulateBluetoothCrash
 
|}
 
|}
 +
 +
Various cmdids were moved with [4.0.0+] and [5.0.0+].
 +
 +
== HidGetReportEventInfo ==
 +
No input, takes a type-0xA output buffer and returns 4-bytes of output.
 +
 +
[7.0.0+] No longer takes a buffer or returns output, now returns an output handle.
 +
 +
= bt =
 +
This is "nn::bluetooth::IBluetoothUser".
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || LeClientReadCharacteristic
 +
|-
 +
| 1 || LeClientReadDescriptor
 +
|-
 +
| 2 || LeClientWriteCharacteristic
 +
|-
 +
| 3 || LeClientWriteDescriptor
 +
|-
 +
| 4 || LeClientRegisterNotification
 +
|-
 +
| 5 || LeClientDeregisterNotification
 +
|-
 +
| 6 || SetLeResponse
 +
|-
 +
| 7 || LeSendIndication
 +
|-
 +
| 8 || GetLeEventInfo
 +
|-
 +
| 9 || RegisterBleEvent
 +
|}
 +
 +
[[Category:Services]]

Revision as of 23:17, 15 May 2019

btdrv

This is "nn::bluetooth::IBluetoothDriver".

The bluetooth driver implements the bluetooth protocol over h4/uart.

It interfaces with the uart service to actually talk with the bluetooth hardware.

The code seems to be derived from a broadcom stack. A good starting point for similar source code can be found in the MICO project: https://github.com/yinhongxing/mico/tree/ea67ff3659f12d730d4dc3b8d547b093bd2ee2ee/MICO/bluetooth_bte Note that the library files contain many (symbolized) functions which match btdrv.

Cmd Name
0 InitializeBluetoothDriver
1 InitializeBluetooth
2 EnableBluetooth
3 DisableBluetooth
4 CleanupBluetooth
5 GetAdapterProperties
6 GetAdapterProperty
7 SetAdapterProperty
8 StartDiscovery
9 CancelDiscovery
10 CreateBond
11 RemoveBond
12 CancelBond
13 PinReply
14 SspReply
15 GetEventInfo
16 InitializeHid
17 HidConnect
18 HidDisconnect
19 HidSendData
20 HidSendData2
21 HidSetReport
22 HidGetReport
23 HidWakeController
24 HidAddPairedDevice
25 HidGetPairedDevice
26 CleanupHid
27 HidGetEventInfo
28 ExtSetTsi
29 ExtSetBurstMode
30 ExtSetZeroRetran
31 ExtSetMcMode
32 ExtStartLlrMode
33 ExtExitLlrMode
34 ExtSetRadio
35 ExtSetVisibility
36 ExtSetTbfcScan
37 RegisterHidReportEvent
38 #HidGetReportEventInfo
39 GetLatestPlr
40 [3.0.0+] ExtGetPendingConnections
41 [3.0.0+] GetChannelMap
42 [3.0.0+] EnableBluetoothBoostSetting
43 [3.0.0+] IsBluetoothBoostSettingEnabled
44 [3.0.0+] EnableBluetoothAfhSetting
45 IsBluetoothAfhSettingEnabled
46 [5.0.0+] InitializeBluetoothLe
47 [5.0.0+] EnableBluetoothLe
48 [5.0.0+] DisableBluetoothLe
49 [5.0.0+] CleanupBluetoothLe
50 [5.0.0+] SetLeVisibility
51 [5.0.0+] SetLeConnectionParameter
52 [5.0.0+] SetLeDefaultConnectionParameter
53 [5.0.0+] SetLeAdvertiseData
54 [5.0.0+] SetLeAdvertiseParameter
55 [5.0.0+] StartLeScan
56 [5.0.0+] StopLeScan
57 [5.0.0+] AddLeScanFilterCondition
58 [5.0.0+] DeleteLeScanFilterCondition
59 [5.0.0+] DeleteLeScanFilter
60 [5.0.0+] ClearLeScanFilters
61 [5.0.0+] EnableLeScanFilter
62 [5.0.0+] RegisterLeClient
63 [5.0.0+] UnregisterLeClient
64 [5.0.0+] UnregisterLeClientAll
65 [5.0.0+] LeClientConnect
66 [5.1.0+] ?
67 ([5.0.0-5.0.2] 66) LeClientCancelConnection
68 ([5.0.0-5.0.2] 67) [5.0.0+] LeClientDisconnect
69 ([5.0.0-5.0.2] 68) [5.0.0+] LeClientGetAttributes
70 ([5.0.0-5.0.2] 69) [5.0.0+] LeClientDiscoverService
71 ([5.0.0-5.0.2] 70) [5.0.0+] LeClientConfigureMtu
72 ([5.0.0-5.0.2] 71) [5.0.0+] RegisterLeServer
73 ([5.0.0-5.0.2] 72) [5.0.0+] UnregisterLeServer
74 ([5.0.0-5.0.2] 73) [5.0.0+] LeServerConnect
75 [5.0.0+] CreateLeService
76 ([5.0.0-5.0.2] 74) [5.0.0+] LeServerDisconnect
77 [5.0.0+] AddLeCharacteristic
78 ([5.0.0-5.0.2] 76) [5.0.0+] StartLeService
79 ([5.0.0-5.0.2] 78) [5.0.0+] AddLeDescriptor
80 ([5.0.0-5.0.2] 79) [5.0.0+] GetLeCoreEventInfo
81 ([5.0.0-5.0.2] 80) [5.0.0+] LeGetFirstCharacteristic
82 ([5.0.0-5.0.2] 81) [5.0.0+] LeGetNextCharacteristic
83 ([5.0.0-5.0.2] 82) [5.0.0+] LeGetFirstDescriptor
84 [5.0.0+] RegisterLeCoreDataPath
85 [5.0.0+] UnregisterLeCoreDataPath
86 [5.0.0+] RegisterLeHidDataPath
87 [5.0.0+] UnregisterLeHidDataPath
88 [5.0.0+] RegisterLeDataPath
89 ([5.0.0-5.0.2] 83) [5.0.0+] LeGetNextDescriptor
90 ([5.0.0-5.0.2] 89) [5.0.0+] UnregisterLeDataPath
91 ([5.0.0-5.0.2] 90) [5.0.0+] LeClientReadCharacteristic
92 ([5.0.0-5.0.2] 91) [5.0.0+] LeClientReadDescriptor
93 ([5.0.0-5.0.2] 92) [5.0.0+] LeClientWriteCharacteristic
94 [5.0.0+] LeClientRegisterNotification
95 ([5.0.0-5.0.2] 93) [5.0.0+] LeClientWriteDescriptor
96 ([5.0.0-5.0.2] 95) [5.0.0+] LeClientDeregisterNotification
97 ([5.0.0-5.0.2] 96) [5.0.0+] GetLeHidEventInfo
97 [5.0.0-5.0.2] RegisterBleHidEvent
98 [5.1.0+] SetLeScanParameter
256 [5.0.0+] GetIsManufacturingMode
257 [7.0.0+] EmulateBluetoothCrash

Various cmdids were moved with [4.0.0+] and [5.0.0+].

HidGetReportEventInfo

No input, takes a type-0xA output buffer and returns 4-bytes of output.

[7.0.0+] No longer takes a buffer or returns output, now returns an output handle.

bt

This is "nn::bluetooth::IBluetoothUser".

Cmd Name
0 LeClientReadCharacteristic
1 LeClientReadDescriptor
2 LeClientWriteCharacteristic
3 LeClientWriteDescriptor
4 LeClientRegisterNotification
5 LeClientDeregisterNotification
6 SetLeResponse
7 LeSendIndication
8 GetLeEventInfo
9 RegisterBleEvent