Changes

Jump to navigation Jump to search
4,841 bytes added ,  19:53, 14 January 2020
no edit summary
Line 54: Line 54:  
| 69 || EnableSixAxisSensorFusion
 
| 69 || EnableSixAxisSensorFusion
 
|-
 
|-
| 70 || SetSixAxisSensorFusionParameters
+
| 70 || [[#SetSixAxisSensorFusionParameters]]
 
|-
 
|-
| 71 || GetSixAxisSensorFusionParameters
+
| 71 || [[#GetSixAxisSensorFusionParameters]]
 
|-
 
|-
| 72 || ResetSixAxisSensorFusionParameters
+
| 72 || [[#ResetSixAxisSensorFusionParameters]]
 
|-
 
|-
 
| 73 || SetAccelerometerParameters
 
| 73 || SetAccelerometerParameters
Line 72: Line 72:  
| 78 || ResetAccelerometerPlayMode
 
| 78 || ResetAccelerometerPlayMode
 
|-
 
|-
| 79 || SetGyroscopeZeroDriftMode
+
| 79 || [[#SetGyroscopeZeroDriftMode]]
 
|-
 
|-
| 80 || GetGyroscopeZeroDriftMode
+
| 80 || [[#GetGyroscopeZeroDriftMode]]
 
|-
 
|-
| 81 || ResetGyroscopeZeroDriftMode
+
| 81 || [[#ResetGyroscopeZeroDriftMode]]
 
|-
 
|-
 
| 82 || IsSixAxisSensorAtRest
 
| 82 || IsSixAxisSensorAtRest
Line 90: Line 90:  
| 102 || [[#SetSupportedNpadIdType]]
 
| 102 || [[#SetSupportedNpadIdType]]
 
|-
 
|-
| 103 || ActivateNpad
+
| 103 || [[#ActivateNpad]]
 
|-
 
|-
| 104 || DeactivateNpad
+
| 104 || [[#DeactivateNpad]]
 
|-
 
|-
 
| 106 || [[#AcquireNpadStyleSetUpdateEventHandle]]
 
| 106 || [[#AcquireNpadStyleSetUpdateEventHandle]]
Line 100: Line 100:  
| 108 || GetPlayerLedPattern
 
| 108 || GetPlayerLedPattern
 
|-
 
|-
| 109 || [5.0.0+] ActivateNpadWithRevision
+
| 109 || [5.0.0+] [[#ActivateNpadWithRevision]]
 
|-
 
|-
| 120 || SetNpadJoyHoldType
+
| 120 || [[#SetNpadJoyHoldType]]
 
|-
 
|-
| 121 || GetNpadJoyHoldType
+
| 121 || [[#GetNpadJoyHoldType]]
 
|-
 
|-
 
| 122 || [[#SetNpadJoyAssignmentModeSingleByDefault]]
 
| 122 || [[#SetNpadJoyAssignmentModeSingleByDefault]]
Line 160: Line 160:  
| 211 || [7.0.0+] [[#IsVibrationDeviceMounted]]
 
| 211 || [7.0.0+] [[#IsVibrationDeviceMounted]]
 
|-
 
|-
| 300 || [3.0.0+] ActivateConsoleSixAxisSensor
+
| 300 || [3.0.0+] [[#ActivateConsoleSixAxisSensor]]
 
|-
 
|-
 
| 301 || [3.0.0+] StartConsoleSixAxisSensor
 
| 301 || [3.0.0+] StartConsoleSixAxisSensor
Line 271: Line 271:  
== CreateAppletResource ==
 
== CreateAppletResource ==
 
Takes a PID and an u64 [[AM_services|AppletResourceUserId]]. Returns an [[#IAppletResource]].
 
Takes a PID and an u64 [[AM_services|AppletResourceUserId]]. Returns an [[#IAppletResource]].
 +
 +
== SetSixAxisSensorFusionParameters ==
 +
Takes a PID-descriptor, an u32 [[#SixAxisSensorHandle]], two floats, and an u64 [[AM_services|AppletResourceUserId]], no output.
 +
 +
Official sw will throw an error before using this cmd, if the first float is outside of the bounds of 0.0f-1.0f.
 +
 +
== GetSixAxisSensorFusionParameters ==
 +
Takes a PID-descriptor, an u32 [[#SixAxisSensorHandle]], and an u64 [[AM_services|AppletResourceUserId]], returns two output floats.
 +
 +
== ResetSixAxisSensorFusionParameters ==
 +
Takes a PID-descriptor, an u32 [[#SixAxisSensorHandle]], and an u64 [[AM_services|AppletResourceUserId]], no output.
 +
 +
== SetGyroscopeZeroDriftMode ==
 +
Takes a PID-descriptor, an u32 [[#SixAxisSensorHandle]], an u32 [[#GyroscopeZeroDriftMode]], and an u64 [[AM_services|AppletResourceUserId]], no output.
 +
 +
== GetGyroscopeZeroDriftMode ==
 +
Takes a PID-descriptor, an u32 [[#SixAxisSensorHandle]], and an u64 [[AM_services|AppletResourceUserId]], returns an output u32 [[#GyroscopeZeroDriftMode]].
 +
 +
Gets the value written by [[#SetGyroscopeZeroDriftMode]].
 +
 +
== ResetGyroscopeZeroDriftMode ==
 +
Takes a PID-descriptor, an u32 [[#SixAxisSensorHandle]], and an u64 [[AM_services|AppletResourceUserId]], no output.
 +
 +
Same as [[#SetGyroscopeZeroDriftMode]] except the [[#GyroscopeZeroDriftMode]] is hard-coded to value 1 (Standard).
    
== SetSupportedNpadStyleSet ==
 
== SetSupportedNpadStyleSet ==
Line 282: Line 306:     
The input buffer contains an array of u32 [[#NpadIdType]].
 
The input buffer contains an array of u32 [[#NpadIdType]].
 +
 +
== ActivateNpad ==
 +
Takes a PID-descriptor and an [[AM_services|AppletResourceUserId]]. No output.
 +
 +
On newer sysvers this runs the same code as [[#ActivateNpadWithRevision]], with revision=0.
 +
 +
== DeactivateNpad ==
 +
Takes a PID-descriptor and an [[AM_services|AppletResourceUserId]]. No output.
 +
 +
This just returns 0.
    
== AcquireNpadStyleSetUpdateEventHandle ==
 
== AcquireNpadStyleSetUpdateEventHandle ==
Takes an input u32, an u64 [[AM_services|AppletResourceUserId]], and an u64. Returns an output event handle, autoclear for this is user-specified.
+
Takes a PID, an input u32, an u64 [[AM_services|AppletResourceUserId]], and an u64. Returns an output event handle, autoclear for this is user-specified.
    
The value for the last u64 doesn't seem to matter (?): official sw sets this to the address of the structure used for storing the event which is initialized after using this cmd.
 
The value for the last u64 doesn't seem to matter (?): official sw sets this to the address of the structure used for storing the event which is initialized after using this cmd.
 +
 +
== ActivateNpadWithRevision ==
 +
Takes a PID-descriptor, a s32 revision, and an [[AM_services|AppletResourceUserId]]. No output.
 +
 +
Revisions:
 +
* 0x0: Initial [[#ActivateNpad|revision]], pre-5.0.0.
 +
* 0x1: [5.0.0+]
 +
* 0x2: [6.0.0+]
 +
* 0x3: [8.0.0+]
 +
 +
== SetNpadJoyHoldType ==
 +
Takes a PID-descriptor, a s64, and an [[AM_services|AppletResourceUserId]]. No output.
 +
 +
== GetNpadJoyHoldType ==
 +
Takes a PID-descriptor and an [[AM_services|AppletResourceUserId]]. Returns an output s64.
    
== SetNpadJoyAssignmentModeSingleByDefault ==
 
== SetNpadJoyAssignmentModeSingleByDefault ==
Line 329: Line 378:     
== IsVibrationDeviceMounted ==
 
== IsVibrationDeviceMounted ==
Takes a total of 0x10-bytes of input and a PID, returns an output u8 bool.
+
Takes a PID, an [[#VibrationDeviceHandle]], and an u64 [[AM_services|AppletResourceUserId]], returns an output u8 bool.
 +
 
 +
== ActivateConsoleSixAxisSensor ==
 +
Takes a PID and an u64 [[AM_services|AppletResourceUserId]], no output.
    
== ActivateSevenSixAxisSensor ==
 
== ActivateSevenSixAxisSensor ==
 
Takes a PID and an u64 [[AM_services|AppletResourceUserId]], no output.
 
Takes a PID and an u64 [[AM_services|AppletResourceUserId]], no output.
 +
 +
Unused by official sw, [[#ActivateConsoleSixAxisSensor]] is used instead. However, internally ActivateSevenSixAxisSensor is identical to [[#ActivateConsoleSixAxisSensor]]. Deactivation is done with hiddbg DeactivateConsoleSixAxisSensor (which is unused by official sw).
    
== StartSevenSixAxisSensor ==
 
== StartSevenSixAxisSensor ==
Line 362: Line 416:  
The NpadInterfaceType must be 1-4, otherwise this will assert.
 
The NpadInterfaceType must be 1-4, otherwise this will assert.
   −
== VibrationDeviceHandle ==
+
== IAppletResource ==
This is an u32.
+
{| class="wikitable" border="1"
 
+
|-
== VibrationDeviceInfo ==
+
! Cmd || Name
This is a 0x8-byte struct.
  −
 
  −
== VibrationValue ==
  −
This is a 0x10-byte struct, which contains 4 float values.
  −
 
  −
== IAppletResource ==
  −
 
  −
{| class="wikitable" border="1"
  −
|-
  −
! Cmd || Name
   
|-
 
|-
 
| 0 || [[#GetSharedMemoryHandle]]
 
| 0 || [[#GetSharedMemoryHandle]]
Line 395: Line 439:  
=== ActivateVibrationDevice ===
 
=== ActivateVibrationDevice ===
 
Takes an input [[#VibrationDeviceHandle]]. No output.
 
Takes an input [[#VibrationDeviceHandle]]. No output.
 +
 +
== GyroscopeZeroDriftMode ==
 +
This is "nn::hid::GyroscopeZeroDriftMode".
 +
 +
{| class="wikitable" border="1"
 +
!  Value
 +
!  Description
 +
|-
 +
| 0 || Loose
 +
|-
 +
| 1 || Standard
 +
|-
 +
| 2 || Tight
 +
|}
 +
 +
== SixAxisSensorHandle ==
 +
This is an u32.
 +
 +
== VibrationDeviceHandle ==
 +
This is an u32.
 +
 +
== VibrationDeviceInfo ==
 +
This is a 0x8-byte struct.
 +
 +
== VibrationValue ==
 +
This is a 0x10-byte struct, which contains 4 float values.
    
== NpadStyleTag ==
 
== NpadStyleTag ==
Line 618: Line 688:  
| 227 || [5.0.0+] GetRxPacketHistory
 
| 227 || [5.0.0+] GetRxPacketHistory
 
|-
 
|-
| 228 || [6.0.0+] AcquireOperationEventHandle
+
| 228 || [6.0.0+] [[#AcquireOperationEventHandle]]
 
|-
 
|-
 
| 229 || [6.0.0+] [[#ReadSerialFlash]]
 
| 229 || [6.0.0+] [[#ReadSerialFlash]]
Line 624: Line 694:  
| 230 || [6.0.0+] [[#WriteSerialFlash]]
 
| 230 || [6.0.0+] [[#WriteSerialFlash]]
 
|-
 
|-
| 231 || [6.0.0+] GetOperationResult
+
| 231 || [6.0.0+] [[#GetOperationResult]]
 
|-
 
|-
 
| 232 || [6.0.0+] EnableShipmentMode
 
| 232 || [6.0.0+] EnableShipmentMode
Line 746: Line 816:     
[9.0.0+] Now takes a total of 8-bytes of input and a type-0x6 output buffer, returns a total of 8-bytes of output.
 
[9.0.0+] Now takes a total of 8-bytes of input and a type-0x6 output buffer, returns a total of 8-bytes of output.
 +
 +
== AcquireOperationEventHandle ==
 +
Takes an input u64 '''UniquePadId''', returns an output Event handle. The EventClearMode used by official sw is user-specified.
 +
 +
This is not used internally by sdk-nso besides exposing it to the user. With the sdk-nso for [9.0.0+] the wrapper funcs for this was removed (sdk-nso still has the actual cmd).
 +
 +
This must be used before [[#ReadSerialFlash]]/[[#WriteSerialFlash]]. Afterwards, this Event is used to wait for the async operation started by [[#ReadSerialFlash]]/[[#WriteSerialFlash]] to finish. After waiting on the Event, [[#GetOperationResult]] should be used.
    
== ReadSerialFlash ==
 
== ReadSerialFlash ==
Line 752: Line 829:  
Reads from the specified controller's spi-flash. The input size is the original size without page-alignment. The TransferMemory permissions is RW-.
 
Reads from the specified controller's spi-flash. The input size is the original size without page-alignment. The TransferMemory permissions is RW-.
   −
This doesn't seem to be usable?
+
See also [[#AcquireOperationEventHandle]].
 +
 
 +
With the sdk-nso for [9.0.0+] the wrapper funcs for this was removed (sdk-nso still has the actual cmd).
    
== WriteSerialFlash ==
 
== WriteSerialFlash ==
Line 758: Line 837:     
Writes to the specified controller's spi-flash. The TransferMemory permissions is R--.
 
Writes to the specified controller's spi-flash. The TransferMemory permissions is R--.
 +
 +
See also [[#AcquireOperationEventHandle]].
 +
 +
With the sdk-nso for [9.0.0+] the wrapper funcs for this was removed (sdk-nso still has the actual cmd).
 +
 +
== GetOperationResult ==
 +
Takes an input u64 '''UniquePadId''', no output.
 +
 +
Get the Result for the Operation and handles cleanup, for the specified controller.
 +
 +
This is not used internally by sdk-nso besides exposing it to the user. With the sdk-nso for [9.0.0+] the wrapper funcs for this was removed (sdk-nso still has the actual cmd).
    
== GetUniquePadDeviceTypeSetInternal ==
 
== GetUniquePadDeviceTypeSetInternal ==
Line 1,326: Line 1,416:  
| 830 || [7.0.0+] [[#SetNotificationLedPattern]]
 
| 830 || [7.0.0+] [[#SetNotificationLedPattern]]
 
|-
 
|-
| 831 || [9.0.0+] SetNotificationLedPatternWithTimeout
+
| 831 || [9.0.0+] [[#SetNotificationLedPatternWithTimeout]]
 
|-
 
|-
| 832 || [9.0.0+] PrepareHidsForNotificationWake
+
| 832 || [9.0.0+] [[#PrepareHidsForNotificationWake]]
 
|-
 
|-
 
| 850 || [3.0.0+] IsUsbFullKeyControllerEnabled
 
| 850 || [3.0.0+] IsUsbFullKeyControllerEnabled
Line 1,409: Line 1,499:     
== GetUniquePadsFromNpad ==
 
== GetUniquePadsFromNpad ==
Takes an input u32 [[#NpadIdType]], a type-0xA output buffer, and returns an output u64 for total output entries.
+
Takes an input u32 [[#NpadIdType]], a type-0xA output buffer, and returns an output s64 for total output entries (which is copied to a s32 by official sw).
    
The output buffer contains an array of u64 '''UniquePadId'''.
 
The output buffer contains an array of u64 '''UniquePadId'''.
Line 1,417: Line 1,507:     
== GetUniquePadIds ==
 
== GetUniquePadIds ==
Takes a type-0xA output buffer, and returns an output u64 for total output entries.
+
Takes a type-0xA output buffer, and returns an output s64 for total output entries (which is copied to a s32 by official sw).
    
The output buffer contains an array of u64 '''UniquePadId'''.
 
The output buffer contains an array of u64 '''UniquePadId'''.
Line 1,432: Line 1,522:     
This sends subcommand 0x38 to the specified controller, for setting the pattern for the HOME button notification LED. The input structure is converted to the format used by this [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md#subcommand-0x38-set-home-light subcommand].
 
This sends subcommand 0x38 to the specified controller, for setting the pattern for the HOME button notification LED. The input structure is converted to the format used by this [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md#subcommand-0x38-set-home-light subcommand].
 +
 +
[9.0.0+] This runs code similar to [[#SetNotificationLedPatternWithTimeout]], except it passes the following param values to an internal func: flag=1 and TimeSpan=0 (with [[#SetNotificationLedPatternWithTimeout]] these are flag=0 and TimeSpan={input value}).
 +
 +
== SetNotificationLedPatternWithTimeout ==
 +
Takes an input [[#NotificationLedPattern]], an u64 '''UniquePadId''', and an s64 TimeSpan, no output.
 +
 +
== PrepareHidsForNotificationWake ==
 +
Takes a type-0x9 input buffer containing an array of u64 '''UniquePadId''', no output.
    
== GetHidbusSystemServiceObject ==
 
== GetHidbusSystemServiceObject ==
 
No input, returns an [[#IHidbusSystemServer]].
 
No input, returns an [[#IHidbusSystemServer]].
 +
 +
== IHidbusSystemServer ==
 +
This is "nn::hidbus::IHidbusSystemServer".
 +
 +
This was added with [5.0.0+].
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 500 || SetAppletResourceUserId
 +
|-
 +
| 501 || RegisterAppletResourceUserId
 +
|-
 +
| 502 || UnregisterAppletResourceUserId
 +
|}
    
== NotificationLedPattern ==
 
== NotificationLedPattern ==
Line 1,680: Line 1,794:  
| System
 
| System
 
| Generic controller.
 
| Generic controller.
|}
  −
  −
== IHidbusSystemServer ==
  −
This is "nn::hidbus::IHidbusSystemServer".
  −
  −
This was added with [5.0.0+].
  −
  −
{| class="wikitable" border="1"
  −
|-
  −
! Cmd || Name
  −
|-
  −
| 500 ||
  −
|-
  −
| 501 ||
  −
|-
  −
| 502 ||
   
|}
 
|}
   Line 1,871: Line 1,969:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 
|-
 
|-
| 0 || AcquireDevice || Takes an input s32, no output.
+
| 0 || [[#AcquireDevice]]
 
|-
 
|-
| 1 || ReleaseDevice || Takes an input s32, no output.
+
| 1 || [[#ReleaseDevice]]
 
|-
 
|-
| 2 || GetCtrlSession || Takes an input u32, returns an [[#ICtrlSession]].
+
| 2 || [[#GetCtrlSession]]
 
|-
 
|-
| 3 || GetReadSession || Takes an input u32, returns an [[#IReadSession]].
+
| 3 || [[#GetReadSession]]
 
|-
 
|-
| [1.0.0-2.3.0] 4 || GetWriteSession || Takes an input u32, returns an [[#IWriteSession]].
+
| 4 || [1.0.0-2.3.0] [[#GetWriteSession]]
 
|}
 
|}
 +
 +
== AcquireDevice ==
 +
Takes an input s32, no output.
 +
 +
== ReleaseDevice ==
 +
Takes an input s32, no output.
 +
 +
== GetCtrlSession ==
 +
Takes an input u32, returns an [[#ICtrlSession]].
 +
 +
== GetReadSession ==
 +
Takes an input u32, returns an [[#IReadSession]].
 +
 +
== GetWriteSession ==
 +
Takes an input u32, returns an [[#IWriteSession]].
    
== ICtrlSession ==
 
== ICtrlSession ==
Line 1,891: Line 2,004:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 
|-
 
|-
| 0 || GetString ||
+
| 0 || GetString
 
|-
 
|-
| 1 || GetCodeBook ||
+
| 1 || GetCodeBook
 
|-
 
|-
| 2 || GetReport ||
+
| 2 || GetReport
 
|-
 
|-
| 3 || SetReport ||
+
| 3 || SetReport
 
|-
 
|-
| 4 || GetIdle ||
+
| 4 || GetIdle
 
|-
 
|-
| 5 || SetIdle ||
+
| 5 || SetIdle
 
|-
 
|-
| 6 || GetProtocol ||
+
| 6 || GetProtocol
 
|-
 
|-
| 7 || SetProtocol ||
+
| 7 || SetProtocol
 
|-
 
|-
| 8 || GetDescriptor ||
+
| 8 || GetDescriptor
 
|-
 
|-
| 9 || SetDescriptor ||
+
| 9 || SetDescriptor
 
|-
 
|-
| 10 || GetStateChangeEvent ||
+
| 10 || GetStateChangeEvent
 
|-
 
|-
| 11 || SignalStateChangeEvent ||
+
| 11 || SignalStateChangeEvent
 
|-
 
|-
| 12 || [3.0.0+] Write ||
+
| 12 || [3.0.0+] Write
 
|}
 
|}
   −
All of these use USB [[USB_services|CtrlXfer]], except for cmd10-11 which are event(?) related, and cmd1 which copies 0x4000-bytes from state to output.
+
All of these use USB [[USB_services|CtrlXfer]], except for GetStateChangeEvent and SignalStateChangeEvent, and GetCodeBook which copies 0x4000-bytes from state to output.
    
== IReadSession ==
 
== IReadSession ==
Line 1,929: Line 2,042:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 
|-
 
|-
| 0 || Read ||
+
| 0 || [[#Read]]
 
|}
 
|}
   −
Cmd0 uses [[USB_services|PostBufferAsync]] etc with the INPUT endpoint. The size must be <=0x1000. The actual transfer size is returned in an output u64. The data is copied from the tmpbuf to the output buffer using the actual-transfer-size.
+
=== Read ===
 +
Uses [[USB_services|PostBufferAsync]] etc with the INPUT endpoint. The size must be <=0x1000. The actual transfer size is returned in an output u64. The data is copied from the tmpbuf to the output buffer using the actual-transfer-size.
   −
[3.0.0+] Cmd0 now takes a total of 8-bytes of input.
+
[3.0.0+] Now takes a total of 8-bytes of input.
    
== IWriteSession ==
 
== IWriteSession ==
Line 1,945: Line 2,059:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 
|-
 
|-
| 0 || Write || This is the inverse of [[#IReadSession]] cmd0. Uses the OUTPUT endpoint with an input buffer.
+
| 0 || [[#Write]]
 
|}
 
|}
 +
 +
=== Write ===
 +
This is the inverse of [[#IReadSession]] cmd0. Uses the OUTPUT endpoint with an input buffer.
    
= ahid:hdr =
 
= ahid:hdr =
Line 1,993: Line 2,110:  
| 5 || CheckNfcDevicePower
 
| 5 || CheckNfcDevicePower
 
|-
 
|-
| 6 || [5.0.0+]
+
| 6 || [5.0.0+] SetMcuStateImmediate
 
|-
 
|-
 
| 10 || SetNfcEvent
 
| 10 || SetNfcEvent
Line 2,059: Line 2,176:  
| 12 || DisableJoyPollingReceiveMode
 
| 12 || DisableJoyPollingReceiveMode
 
|-
 
|-
| [5.0.0-6.2.0] 13 || GetPollingData
+
| 13 || [5.0.0-6.2.0] GetPollingData
 
|-
 
|-
 
| 14 || [6.0.0+] SetStatusManagerType
 
| 14 || [6.0.0+] SetStatusManagerType

Navigation menu