Changes

3,940 bytes added ,  19:57, 15 October 2022
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.
   −
These btm services with BLE only allow connecting to devices which have a [[#GattService]] with a certain custom UUID present.
+
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 ==
Line 182: Line 230:  
** It then goes through various arrays again for updating state.
 
** 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:
 
The SetTsi wrapper func is implemented as follows:
Line 200: 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 ==
Line 251: 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 259: 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 270: 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 276: 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 463: 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 493: 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 578: Line 666:  
| 5 || [[#DisableRadio]]
 
| 5 || [[#DisableRadio]]
 
|-
 
|-
| 6 || [[#GetRadioOnOff]]
+
| 6 || [[#IsRadioEnabled]]
 
|-
 
|-
 
| 7 || [3.0.0+] [[#AcquireRadioEvent]]
 
| 7 || [3.0.0+] [[#AcquireRadioEvent]]
Line 585: 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 605: Line 721:  
No input/output.
 
No input/output.
   −
=== GetRadioOnOff ===
+
=== IsRadioEnabled ===
 
No input, returns an output bool.
 
No input, returns an output bool.
   Line 1,010: Line 1,126:  
= 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 1,060: Line 1,178:  
= DeviceInfo =
 
= DeviceInfo =
 
This is "nn::btm::DeviceInfo". This is a 0x60-byte struct.
 
This is "nn::btm::DeviceInfo". This is a 0x60-byte struct.
 +
 +
[13.0.0+] This is a 0x13C-byte struct.
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,097: Line 1,217:  
| 0x1 || 0x3 || Reserved
 
| 0x1 || 0x3 || Reserved
 
|-
 
|-
| 0x4 || 0xA * 60 || Array of [[#DeviceInfo|DeviceInfo]]
+
| 0x4 || 0xA * 0x60 || Array of [[#DeviceInfo|DeviceInfo]]
 
|}
 
|}