HID services: Difference between revisions
(10 intermediate revisions by 2 users not shown) | |||
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 282: | Line 282: | ||
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 == | ||
Line 287: | Line 297: | ||
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 330: | Line 355: | ||
== IsVibrationDeviceMounted == | == IsVibrationDeviceMounted == | ||
Takes a PID, an [[#VibrationDeviceHandle]], and an u64 [[AM_services|AppletResourceUserId]], 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. | |||
== StartSevenSixAxisSensor == | == StartSevenSixAxisSensor == | ||
Line 752: | Line 782: | ||
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 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]]. Afterwards, this Event is used to wait for the async operation started by [[#ReadSerialFlash]] to finish. After waiting on the Event, [[#GetOperationResult]] should be used. | 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 758: | Line 788: | ||
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-. | ||
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). | 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 767: | Line 797: | ||
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). | With the sdk-nso for [9.0.0+] the wrapper funcs for this was removed (sdk-nso still has the actual cmd). | ||
Line 1,717: | Line 1,749: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 500 || | | 500 || SetAppletResourceUserId | ||
|- | |- | ||
| 501 || | | 501 || RegisterAppletResourceUserId | ||
|- | |- | ||
| 502 || | | 502 || UnregisterAppletResourceUserId | ||
|} | |} | ||
Line 1,897: | Line 1,929: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || AcquireDevice | | 0 || [[#AcquireDevice]] | ||
|- | |- | ||
| 1 || ReleaseDevice | | 1 || [[#ReleaseDevice]] | ||
|- | |- | ||
| 2 || | | 2 || [[#GetCtrlSession]] | ||
|- | |- | ||
| 3 || | | 3 || [[#GetReadSession]] | ||
|- | |- | ||
| [1.0.0-2.3.0] | | 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,917: | Line 1,964: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Cmd || Name | ! 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 | 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,955: | Line 2,002: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || Read | | 0 || [[#Read]] | ||
|} | |} | ||
=== 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+] | [3.0.0+] Now takes a total of 8-bytes of input. | ||
== IWriteSession == | == IWriteSession == | ||
Line 1,971: | Line 2,019: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || | | 0 || [[#Write]] | ||
|} | |} | ||
=== Write === | |||
This is the inverse of [[#IReadSession]] cmd0. Uses the OUTPUT endpoint with an input buffer. | |||
= ahid:hdr = | = ahid:hdr = | ||
Line 2,019: | Line 2,070: | ||
| 5 || CheckNfcDevicePower | | 5 || CheckNfcDevicePower | ||
|- | |- | ||
| 6 || [5.0.0+] | | 6 || [5.0.0+] SetMcuStateImmediate | ||
|- | |- | ||
| 10 || SetNfcEvent | | 10 || SetNfcEvent | ||
Line 2,085: | Line 2,136: | ||
| 12 || DisableJoyPollingReceiveMode | | 12 || DisableJoyPollingReceiveMode | ||
|- | |- | ||
| [5.0.0-6.2.0] | | 13 || [5.0.0-6.2.0] GetPollingData | ||
|- | |- | ||
| 14 || [6.0.0+] SetStatusManagerType | | 14 || [6.0.0+] SetStatusManagerType |