BTM services: Difference between revisions
No edit summary |
|||
(29 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
This has max_sessions 6. IPC is handled by 2 threads shared with all services. | This has max_sessions 6. IPC is handled by 2 threads shared with all services. | ||
With BLE connections, the remote device may receive ATT_READ_BY_GROUP_TYPE_REQ before the BLE connection-complete HCI event. One workaround for this is manually sending the response with HCI, after the connection is ready. | |||
The output bool from all of these btm* service get-event cmds indicates whether the Event was successfully returned, user-processes will Abort when this is 0. | The output bool from all of these btm* service get-event cmds indicates whether the Event was successfully returned, user-processes will Abort when this is 0. | ||
Line 143: | Line 143: | ||
|- | |- | ||
| 64 || [10.0.0+] | | 64 || [10.0.0+] | ||
|- | |||
| 65 || [13.0.0+] | |||
|- | |||
| 66 || [13.0.0+] | |||
|- | |||
| 67 || [13.0.0+] | |||
|- | |||
| 68 || [13.0.0+] | |||
|- | |||
| 69 || [13.0.0+] | |||
|- | |||
| 70 || [13.0.0+] | |||
|- | |||
| 71 || [13.0.0+] | |||
|- | |||
| 72 || [13.0.0+] | |||
|- | |||
| 73 || [13.0.0+] | |||
|- | |||
| 74 || [13.0.0+] | |||
|- | |||
| 75 || [13.0.0+] | |||
|- | |||
| 76 || [13.1.0+] | |||
|- | |||
| 100 || [13.0.0+] | |||
|- | |||
| 101 || [13.0.0+] | |||
|- | |||
| 110 || [13.0.0+] | |||
|- | |||
| 111 || [13.0.0+] | |||
|- | |||
| 112 || [14.0.0-14.1.2] | |||
|- | |||
| 113 || [14.0.0-14.1.2] | |||
|- | |||
| 114 || [14.0.0+] | |||
|- | |||
| 115 || [14.0.0+] | |||
|- | |||
| 116 || [15.0.0+] | |||
|- | |||
| 117 || [15.0.0+] | |||
|} | |} | ||
Line 150: | Line 194: | ||
== GetHostDeviceProperty == | == GetHostDeviceProperty == | ||
No input, returns an output [[#HostDeviceProperty]]. | No input, returns an output [[#HostDeviceProperty]]. | ||
[13.0.0+] Takes a type-0x1A output buffer containing a [[#HostDeviceProperty]], no output. | |||
This gets the previously initialized [[#HostDeviceProperty]]. | This gets the previously initialized [[#HostDeviceProperty]]. | ||
Line 160: | Line 206: | ||
== GetDeviceCondition == | == GetDeviceCondition == | ||
Takes a type-0x1A output buffer containing a 0x368-byte struct. | Takes a type-0x1A output buffer containing a 0x368-byte struct. | ||
[13.0.0+] Takes an input u32 [[#Profile]], a type-0xA output buffer containing an array of a 0x148-byte struct, returns a s32 for total output entries. When [[#Profile]] is non-zero, entries are only returned with a matching [[#Profile]]. | |||
== SetBurstMode == | == SetBurstMode == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and a bool, no output. | ||
== SetSlotMode == | == SetSlotMode == | ||
Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], no output. | Takes a type-0x19 input buffer containing a [[#DeviceSlotModeList]], no output. | ||
Sends a request which is then handled as follows: | |||
* Calls a func for getting the data from [[#DeviceSlotModeList]] etc for passing to another func, that func then does the following: | |||
* Goes through multiple arrays of [[#BdAddress|BdAddress]]. | |||
** First array: | |||
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found. | |||
*** Calls the SetTsi wrapper func described below, with the above [[#BdAddress|BdAddress]] and tsi=0xFF (Exit). If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]]. | |||
** Second array: | |||
*** Validates the [[#BdAddress|BdAddress]] with state, skipping it if not found. | |||
*** Uses [[Bluetooth_Driver_services#SetBleConnectionParameter|SetBleConnectionParameter]] with bool=true. Then the required EventInfo is loaded, {...}. | |||
** Then it goes through the first array again, except here it does the following: | |||
*** Calls the same func for validating the [[#BdAddress|BdAddress]] with state, skipping it if not found. It is also skipped if the u32 at Address+0x8 is value 0x3. | |||
*** Determines what Tsi value to use, on failure [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used and the loop is continued. | |||
*** Calls the SetTsi wrapper func described below, with the [[#BdAddress|BdAddress]] and the above Tsi value. If this returns false, [[Bluetooth_Driver_services#CloseHidConnection|CloseHidConnection]] is used with the [[#BdAddress|BdAddress]]. | |||
** It then goes through various arrays again for updating state. | |||
** {...} | |||
Note that the above func is also called from various other funcs as well. An [[Bluetooth_Driver_services#HidEventType|event]] for opening a hid connection also triggers it in some cases. | |||
The SetTsi wrapper func is implemented as follows: | |||
* Uses [[Bluetooth_Driver_services#SetTsi|SetTsi]], on failure true is returned. | |||
* Gets the required EventInfo, returning false if a match wasn't found / EventInfo status indicates failure. True is returned for success. | |||
== SetBluetoothMode == | == SetBluetoothMode == | ||
Line 180: | Line 250: | ||
== GetDeviceInfo == | == GetDeviceInfo == | ||
Takes a type-0x1A output buffer containing a [[#DeviceInfoList]]. | Takes a type-0x1A output buffer containing a [[#DeviceInfoList]]. | ||
[13.0.0+] Takes an input u32 [[#Profile]], a type-0xA output buffer containing an array of [[#DeviceInfo]], returns a s32 for total output entries. When [[#Profile]] is non-zero, entries are only returned with a matching [[#Profile]]. | |||
== AddDeviceInfo == | == AddDeviceInfo == | ||
Takes an input [[#DeviceInfo]], no output. | Takes an input [[#DeviceInfo]], no output. | ||
[13.0.0+] Takes a type-0x19 input buffer containing a [[#DeviceInfo]], no output. | |||
== RemoveDeviceInfo == | == RemoveDeviceInfo == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
== IncreaseDeviceInfoOrder == | == IncreaseDeviceInfoOrder == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
== LlrNotify == | == LlrNotify == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
[9.0.0+] Takes an input [[ | [9.0.0+] Takes an input [[#BdAddress|BdAddress]] and a s32, no output. | ||
== EnableRadio == | == EnableRadio == | ||
Line 202: | Line 276: | ||
== HidDisconnect == | == HidDisconnect == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
== HidSetRetransmissionMode == | == HidSetRetransmissionMode == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and a type-0x19 input buffer containing a [[#ZeroRetransmissionList]], no output. | ||
== AcquireAwakeReqEvent == | == AcquireAwakeReqEvent == | ||
Line 222: | Line 296: | ||
== ProtectDeviceInfo == | == ProtectDeviceInfo == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and a bool, no output. | ||
== AcquireBleScanEvent == | == AcquireBleScanEvent == | ||
Line 231: | Line 305: | ||
The u16 must be value 0x1 or 0xFFFF. | The u16 must be value 0x1 or 0xFFFF. | ||
[[HID_services|hid]] uses value 0x1 for Palma. | |||
The output BleAdvertisePacketParameter starting at +0x2 contains (CompanyId is 0x0553 for Nintendo for both of these): | |||
* ParameterId 0x1: <code>000100000100</code> | |||
* ParameterId 0xFFFF: <code>ADDE00EFBE00</code> | |||
== GetBleScanParameterSmartDevice == | == GetBleScanParameterSmartDevice == | ||
Line 239: | Line 319: | ||
== StartBleScanForGeneral == | == StartBleScanForGeneral == | ||
Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output. | Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output. | ||
This eventually uses [[Bluetooth_Driver_services#AddBleScanFilterCondition|AddBleScanFilterCondition]], where the the passed BleAdvertiseFilter is generated from the input BleAdvertisePacketParameter. | |||
This also uses [[Bluetooth_Driver_services#SetBleScanParameter|SetBleScanParameter]]. | |||
== StopBleScanForGeneral == | == StopBleScanForGeneral == | ||
Line 250: | Line 334: | ||
== StartBleScanForPaired == | == StartBleScanForPaired == | ||
Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output. | Takes a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output. | ||
This eventually uses [[Bluetooth_Driver_services#AddBleScanFilterCondition|AddBleScanFilterCondition]], where the the passed BleAdvertiseFilter is generated from the input BleAdvertisePacketParameter. | |||
This also uses [[Bluetooth_Driver_services#SetBleScanParameter|SetBleScanParameter]]. | |||
== StopBleScanForPaired == | == StopBleScanForPaired == | ||
Line 256: | Line 344: | ||
== StartBleScanForSmartDevice == | == StartBleScanForSmartDevice == | ||
Takes a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], no output. | Takes a [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]], no output. | ||
This eventually uses [[Bluetooth_Driver_services#AddBleScanFilterCondition|AddBleScanFilterCondition]], where the the passed BleAdvertiseFilter is generated from the input GattAttributeUuid. | |||
This also uses [[Bluetooth_Driver_services#SetBleScanParameter|SetBleScanParameter]]. | |||
The [[Bluetooth_Driver_services#BleAdvertiseFilter|BleAdvertiseFilter]] is generated as follows: CondType = 7(ServiceUuid128), CondDataSize = 0x11. CondData: {128bit UUID copied from the [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] (size field ignored), then an u8 with value 0x0 (unused)}. MaskSize = 0x10, Mask = {all 0xFF}. | |||
== StopBleScanForSmartDevice == | == StopBleScanForSmartDevice == | ||
Line 269: | Line 363: | ||
== BleConnect == | == BleConnect == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
An error is thrown if the [[ | An error is thrown if the [[#BdAddress|BdAddress]] is already connected (listed in the [[Bluetooth_Driver_services#BleConnectionInfo|BleConnectionInfo]] from [[#BleGetConnectionState]]). An error is thrown if 4 [[#BleGetConnectionState|devices]] are already connected. | ||
== BleOverrideConnection == | == BleOverrideConnection == | ||
Line 305: | Line 399: | ||
== BleUnpairDevice == | == BleUnpairDevice == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output. | ||
== BleGetPairedAddresses == | == BleGetPairedAddresses == | ||
Takes a type-0xA output buffer containing an array of [[ | Takes a type-0xA output buffer containing an array of [[#BdAddress|BdAddress]], a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], returns an output u8 total_out. | ||
The max array entries is 10. | The max array entries is 10. | ||
Line 390: | Line 484: | ||
== Cmd61 == | == Cmd61 == | ||
Takes a 0x44-byte input struct, no output. | Takes a 0x44-byte input struct, no output. | ||
Sends a request which is then handled as follows: | |||
* Calls a func for getting the data from the input struct etc for passing to another func, that func is the same one called by [[#SetSlotMode]]. | |||
The input struct has the following structure: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x10 * 4 || Array of the below struct. | |||
|- | |||
| 0x40 || 0x4 || s32 count, for the array at +0. | |||
|} | |||
Struct for the above array: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x6 || [[#BdAddress|BdAddress]] | |||
|- | |||
| 0x6 || 0x6 || Unused | |||
|- | |||
| 0xC || 0x1 || Used to determine data which is then used for [[Bluetooth_Driver_services#BleConnectionParameter|BleConnectionParameter]]. | |||
|- | |||
| 0xD || 0x3 || Padding | |||
|} | |||
== Cmd62 == | == Cmd62 == | ||
Takes an input bool, no output. | Takes an input bool, no output. | ||
Sends a request which is handled as follows: writes the flag into state if needed. | |||
== Cmd63 == | == Cmd63 == | ||
No input, returns an output bool. | No input, returns an output bool. | ||
This gets the flag used by [[#Cmd62]]. | |||
== Cmd64 == | == Cmd64 == | ||
No input/output. | No input/output. | ||
Sends a request which is handled as follows: if a state field is set, another state field is set to value 1. | |||
= btm:dbg = | = btm:dbg = | ||
Line 404: | Line 537: | ||
This has max_sessions 6. IPC is handled by 2 threads shared with all services. | This has max_sessions 6. IPC is handled by 2 threads shared with all services. | ||
[12.0.0+] Cmds input/output were changed / cmdids were moved around. | |||
[13.0.0+] Cmd4 now takes a type-0xA output buffer, returns a total of 4-bytes of output. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 434: | Line 571: | ||
|- | |- | ||
| 12 || [5.1.0+] [[#GetBleConnectionParameterRequest]] | | 12 || [5.1.0+] [[#GetBleConnectionParameterRequest]] | ||
|- | |||
| 13 || [12.0.0+] | |||
|- | |||
| 14 || [15.0.0+] | |||
|- | |||
| 15 || [15.0.0+] | |||
|- | |||
| 16 || [15.0.0+] | |||
|- | |||
| 17 || [15.0.0+] | |||
|} | |} | ||
Line 451: | Line 598: | ||
== CreateBond == | == CreateBond == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
== CancelBond == | == CancelBond == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
== SetTsiMode == | == SetTsiMode == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and a [[#TsiMode]], no output. | ||
Sends a request which is handled as follows: uses [[Bluetooth_Driver_services#SetTsi|SetTsi]] directly with the specified params. | |||
== GeneralTest == | == GeneralTest == | ||
Line 463: | Line 612: | ||
== HidConnect == | == HidConnect == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]], no output. | ||
== GeneralGet == | == GeneralGet == | ||
Line 469: | Line 618: | ||
== GetGattClientDisconnectionReason == | == GetGattClientDisconnectionReason == | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and an u32, returns an output bool and u16. | ||
The bool indicates whether the cmd is successful. | The bool indicates whether the cmd is successful. | ||
Line 517: | Line 666: | ||
| 5 || [[#DisableRadio]] | | 5 || [[#DisableRadio]] | ||
|- | |- | ||
| 6 || [[# | | 6 || [[#IsRadioEnabled]] | ||
|- | |- | ||
| 7 || [3.0.0+] [[#AcquireRadioEvent]] | | 7 || [3.0.0+] [[#AcquireRadioEvent]] | ||
Line 524: | Line 673: | ||
|- | |- | ||
| 9 || [3.0.0+] [[#IsGamepadPairingStarted]] | | 9 || [3.0.0+] [[#IsGamepadPairingStarted]] | ||
|- | |||
| 10 || [13.0.0+] StartAudioDeviceDiscovery | |||
|- | |||
| 11 || [13.0.0+] StopAudioDeviceDiscovery | |||
|- | |||
| 12 || [13.0.0+] IsDiscoveryingAudioDevice | |||
|- | |||
| 13 || [13.0.0+] GetDiscoveredAudioDevice | |||
|- | |||
| 14 || [13.0.0+] AcquireAudioDeviceConnectionEvent | |||
|- | |||
| 15 || [13.0.0+] ConnectAudioDevice | |||
|- | |||
| 16 || [13.0.0+] IsConnectingAudioDevice | |||
|- | |||
| 17 || [13.0.0+] GetConnectedAudioDevices | |||
|- | |||
| 18 || [13.0.0+] DisconnectAudioDevice | |||
|- | |||
| 19 || [13.0.0+] AcquirePairedAudioDeviceInfoChangedEvent | |||
|- | |||
| 20 || [13.0.0+] GetPairedAudioDevices | |||
|- | |||
| 21 || [13.0.0+] RemoveAudioDevicePairing | |||
|- | |||
| 22 || [13.0.0+] RequestAudioDeviceConnectionRejection | |||
|- | |||
| 23 || [13.0.0+] CancelAudioDeviceConnectionRejection | |||
|} | |} | ||
Line 544: | Line 721: | ||
No input/output. | No input/output. | ||
=== | === IsRadioEnabled === | ||
No input, returns an output bool. | No input, returns an output bool. | ||
Line 706: | Line 883: | ||
=== BleConnect === | === BleConnect === | ||
Takes a PID, an [[ | Takes a PID, an [[#BdAddress|BdAddress]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], no output. | ||
This is similar to the [[#BleConnect|btm]] cmd. | This is similar to the [[#BleConnect|btm]] cmd. | ||
Line 736: | Line 913: | ||
=== BleUnPairDevice2 === | === BleUnPairDevice2 === | ||
Takes an input [[ | Takes an input [[#BdAddress|BdAddress]] and a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], no output. | ||
This is similar to the [[#BleUnPairDevice|btm]] cmd. | This is similar to the [[#BleUnPairDevice|btm]] cmd. | ||
=== BleGetPairedDevices === | === BleGetPairedDevices === | ||
Takes a type-0xA output buffer containing an array of [[ | Takes a type-0xA output buffer containing an array of [[#BdAddress|BdAddress]], a [[Bluetooth_Driver_services#BleAdvertisePacketParameter|BleAdvertisePacketParameter]], returns an output u8 total_out. | ||
This is the same as the [[#BleGetPairedAddresses|btm]] cmd. | This is the same as the [[#BleGetPairedAddresses|btm]] cmd. | ||
Line 810: | Line 987: | ||
This is similar to the [[#UnregisterBleGattDataPath|btm]] cmd. | This is similar to the [[#UnregisterBleGattDataPath|btm]] cmd. | ||
= BdAddress = | |||
This is "nn::btm::BdAddress". This is a 0x6-byte struct with 1-byte alignment. | |||
= BdName = | |||
This is "nn::btm::BdName". This is a 0x20-byte struct with 1-byte alignment. | |||
= ClassOfDevice = | |||
This is "nn::btm::ClassOfDevice". This is a 0x3-byte struct with 1-byte alignment. | |||
= LinkKey = | |||
This is "nn::btm::LinkKey". This is a 0x10-byte struct with 1-byte alignment. | |||
= BtmState = | = BtmState = | ||
This is "nn::btm::BtmState". | This is "nn::btm::BtmState". | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Description | |||
|- | |||
| 0 || NotInitialized | |||
|- | |||
| 1 || RadioOff | |||
|- | |||
| 2 || MinorSlept | |||
|- | |||
| 3 || RadioOffMinorSlept | |||
|- | |||
| 4 || Slept | |||
|- | |||
| 5 || RadioOffSlept | |||
|- | |||
| 6 || Initialized | |||
|- | |||
| 7 || Working | |||
|} | |||
= BluetoothMode = | = BluetoothMode = | ||
This is "nn::btm::BluetoothMode". | This is "nn::btm::BluetoothMode". | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Description | |||
|- | |||
| 0 || Dynamic2Slot | |||
|- | |||
| 1 || StaticJoy | |||
|} | |||
= WlanMode = | = WlanMode = | ||
This is "nn::btm::WlanMode". | This is "nn::btm::WlanMode". | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Description | |||
|- | |||
| 0 || Local4 | |||
|- | |||
| 1 || Local8 | |||
|- | |||
| 2 || None | |||
|} | |||
= TsiMode = | = TsiMode = | ||
This is "nn::btm::TsiMode". This is | This is "nn::btm::TsiMode". | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Description | |||
|- | |||
| 0 || 0Fd3Td3Si10 | |||
|- | |||
| 1 || 1Fd1Td1Si5 | |||
|- | |||
| 2 || 2Fd1Td3Si10 | |||
|- | |||
| 3 || 3Fd1Td5Si15 | |||
|- | |||
| 4 || 4Fd3Td1Si10 | |||
|- | |||
| 5 || 5Fd3Td3Si15 | |||
|- | |||
| 6 || 6Fd5Td1Si15 | |||
|- | |||
| 7 || 7Fd1Td3Si15 | |||
|- | |||
| 8 || 8Fd3Td1Si15 | |||
|- | |||
| 9 || 9Fd1Td1Si10 | |||
|- | |||
| 10 || 10Fd1Td1Si15 | |||
|- | |||
| 255 || Active | |||
|} | |||
= SlotMode = | |||
This is "nn::btm::SlotMode". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Description | |||
|- | |||
| 0 || 2 | |||
|- | |||
| 1 || 4 | |||
|- | |||
| 2 || 6 | |||
|- | |||
| 3 || Active | |||
|} | |||
= Profile = | |||
This is "nn::btm::Profile". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Description | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || Hid | |||
|} | |||
= HidDeviceInfo = | |||
This is "nn::btm::HidDeviceInfo". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x2 || Vid | |||
|- | |||
| 0x2 || 0x2 || Pid | |||
|} | |||
= HostDeviceProperty = | = HostDeviceProperty = | ||
This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct. | This is "nn::btm::HostDeviceProperty". This is a 0x2A-byte struct. | ||
[13.0.0+] This is a 0x103-byte struct. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 832: | Line 1,135: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x6 || [[#BdAddress|BdAddress]] | ||
|- | |- | ||
| | | 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]] | ||
|- | |- | ||
| | | 0x9 || 0x20 || [[#BdName|BdName]] | ||
|- | |- | ||
| 0x29 || 0x1 || | | 0x29 || 0x1 || FeatureSet | ||
|} | |||
= DeviceSlotMode = | |||
This is "nn::btm::DeviceSlotMode". This is a 0xC-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x6 || [[#BdAddress|BdAddress]] | |||
|- | |||
| 0x6 || 0x2 || Reserved | |||
|- | |||
| 0x8 || 0x4 || [[#SlotMode|SlotMode]] | |||
|} | |} | ||
= DeviceSlotModeList = | = DeviceSlotModeList = | ||
This is "nn::btm::DeviceSlotModeList". This is a 0x64-byte struct. | This is "nn::btm::DeviceSlotModeList". This is a 0x64-byte struct. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || DeviceCount | |||
|- | |||
| 0x1 || 0x3 || Reserved | |||
|- | |||
| 0x4 || 0xC * 8 || Array of [[#DeviceSlotMode|DeviceSlotMode]] | |||
|} | |||
= DeviceInfo = | |||
This is "nn::btm::DeviceInfo". This is a 0x60-byte struct. | |||
[13.0.0+] This is a 0x13C-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x6 || [[#BdAddress|BdAddress]] | |||
|- | |||
| 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]] | |||
|- | |||
| 0x9 || 0x20 || [[#BdName|BdName]] | |||
|- | |||
| 0x29 || 0x10 || [[#LinkKey|LinkKey]] | |||
|- | |||
| 0x39 || 0x3 || Reserved | |||
|- | |||
| 0x3C || 0x4 || [[#Profile|Profile]] | |||
|- | |||
| 0x40 || 0x4 || Empty (Profile = None) or [[#HidDeviceInfo|HidDeviceInfo]] (Profile = Hid) | |||
|- | |||
| 0x44 || 0x1C || Reserved | |||
|} | |||
= DeviceInfoList = | = DeviceInfoList = | ||
Line 853: | Line 1,213: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x1 || | | 0x0 || 0x1 || DeviceCount | ||
|- | |- | ||
| 0x1 || 0x3 || | | 0x1 || 0x3 || Reserved | ||
|- | |- | ||
| 0x4 || 0xA* | | 0x4 || 0xA * 0x60 || Array of [[#DeviceInfo|DeviceInfo]] | ||
|} | |} | ||
= | = DeviceProperty = | ||
This is "nn::btm:: | This is "nn::btm::DeviceProperty". This is a 0x29-byte struct. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x6 || [[#BdAddress|BdAddress]] | |||
|- | |||
| 0x6 || 0x3 || [[#ClassOfDevice|ClassOfDevice]] | |||
|- | |||
| 0x9 || 0x20 || [[#BdName|BdName]] | |||
|} | |||
= DevicePropertyList = | = DevicePropertyList = | ||
This is "nn::btm::DevicePropertyList". This is a 0x268-byte struct. | This is "nn::btm::DevicePropertyList". This is a 0x268-byte struct. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || DeviceCount | |||
|- | |||
| 0x1 || 0x29 * 15 || Array of [[#DeviceProperty|DeviceProperty]] | |||
|} | |||
= ZeroRetransmissionList = | = ZeroRetransmissionList = | ||
This is "nn::btm::ZeroRetransmissionList". This is a 0x11-byte struct. | This is "nn::btm::ZeroRetransmissionList". This is a 0x11-byte struct. | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || EnabledReportIdCount | |||
|- | |||
| 0x1 || 0x1 * 16 || Array of EnabledReportId | |||
|} | |||
= GattService = | = GattService = | ||
Line 952: | Line 1,347: | ||
| 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | | 0x4 || 0x14 || [[Bluetooth_Driver_services#GattAttributeUuid|GattAttributeUuid]] | ||
|} | |} | ||
= Logging = | |||
A func which uses [[PSC_services|srepo]] is called in certain conditions (access to srepo:u was added to btm with [7.0.0+]). This is implemented as follows (as of 11.0.0): | |||
* Loads the data for the below fields. | |||
* Creates the report with EventId "bluetooth_crash". The ApplicationId is set to {btm ProgramId}. | |||
* The following fields are added to the report: | |||
** "reason": Set to an input param for this func. | |||
** "radio" | |||
** "gamepad_pairing" | |||
** "llr_notify" | |||
** "ble_scan" | |||
** "bluetooth_mode": Set to hard-coded value 0. | |||
** "wlan_mode" | |||
** "classic_device_count" | |||
** "slot_mode_active_count" | |||
** "slot_mode_4_count" | |||
** "slot_mode_6_count" | |||
** "sniff_mode" | |||
** "ble_device_count" | |||
** "ce_length_2_count" | |||
** "ce_length_4_count" | |||
** "ce_length_8_count" | |||
* Saves the report and returns. | |||
[[Category:Services]] | [[Category:Services]] |