Difference between revisions of "HID services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 678: Line 678:
 
Takes an input TransferMemory handle, an input u32 offset, an input u64 size, and an u64 '''UniquePadId''', no output.
 
Takes an input TransferMemory handle, an input u32 offset, an input u64 size, and an u64 '''UniquePadId''', no output.
  
Writes to 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-.
  
 
== AttachHdlsWorkBuffer ==
 
== AttachHdlsWorkBuffer ==

Revision as of 01:16, 26 June 2019

See here for the HID shared-memory.

hid

This is "nn::hid::IHidServer".

Cmd Name
0 #CreateAppletResource
1 ActivateDebugPad
11 ActivateTouchScreen
21 ActivateMouse
31 ActivateKeyboard
32 [6.0.0+] SendKeyboardLockKeyEvent
40 AcquireXpadIdEventHandle
41 ReleaseXpadIdEventHandle
51 ActivateXpad
55 GetXpadIds
56 ActivateJoyXpad
58 GetJoyXpadLifoHandle
59 GetJoyXpadIds
60 ActivateSixAxisSensor
61 DeactivateSixAxisSensor
62 GetSixAxisSensorLifoHandle
63 ActivateJoySixAxisSensor
64 DeactivateJoySixAxisSensor
65 GetJoySixAxisSensorLifoHandle
66 StartSixAxisSensor
67 StopSixAxisSensor
68 IsSixAxisSensorFusionEnabled
69 EnableSixAxisSensorFusion
70 SetSixAxisSensorFusionParameters
71 GetSixAxisSensorFusionParameters
72 ResetSixAxisSensorFusionParameters
73 SetAccelerometerParameters
74 GetAccelerometerParameters
75 ResetAccelerometerParameters
76 SetAccelerometerPlayMode
77 GetAccelerometerPlayMode
78 ResetAccelerometerPlayMode
79 SetGyroscopeZeroDriftMode
80 GetGyroscopeZeroDriftMode
81 ResetGyroscopeZeroDriftMode
82 IsSixAxisSensorAtRest
83 [6.0.0+] IsFirmwareUpdateAvailableForSixAxisSensor
91 ActivateGesture
100 #SetSupportedNpadStyleSet
101 #GetSupportedNpadStyleSet
102 #SetSupportedNpadIdType
103 ActivateNpad
104 DeactivateNpad
106 #AcquireNpadStyleSetUpdateEventHandle
107 DisconnectNpad
108 GetPlayerLedPattern
109 [5.0.0+] ActivateNpadWithRevision
120 SetNpadJoyHoldType
121 GetNpadJoyHoldType
122 #SetNpadJoyAssignmentModeSingleByDefault
123 #SetNpadJoyAssignmentModeSingle
124 #SetNpadJoyAssignmentModeDual
125 #MergeSingleJoyAsDualJoy
126 StartLrAssignmentMode
127 StopLrAssignmentMode
128 SetNpadHandheldActivationMode
129 #GetNpadHandheldActivationMode
130 SwapNpadAssignment
131 IsUnintendedHomeButtonInputProtectionEnabled
132 EnableUnintendedHomeButtonInputProtection
133 [5.0.0+] SetNpadJoyAssignmentModeSingleWithDestination
134 [6.1.0+] SetNpadAnalogStickUseCenterClamp
135 [8.0.0+] SetNpadCaptureButtonAssignment
136 [8.0.0+] ClearNpadCaptureButtonAssignment
200 #GetVibrationDeviceInfo
201 #SendVibrationValue
202 #GetActualVibrationValue
203 #CreateActiveVibrationDeviceList
204 #PermitVibration
205 #IsVibrationPermitted
206 #SendVibrationValues
207 [4.0.0+] SendVibrationGcErmCommand
208 [4.0.0+] GetActualVibrationGcErmCommand
209 [4.0.0+] BeginPermitVibrationSession
210 [4.0.0+] EndPermitVibrationSession
211 [7.0.0+] #IsVibrationDeviceMounted
300 [3.0.0+] ActivateConsoleSixAxisSensor
301 [3.0.0+] StartConsoleSixAxisSensor
302 [3.0.0+] StopConsoleSixAxisSensor
303 [5.0.0+] #ActivateSevenSixAxisSensor
304 [5.0.0+] #StartSevenSixAxisSensor
305 [5.0.0+] #StopSevenSixAxisSensor
306 [5.0.0+] #InitializeSevenSixAxisSensor
307 [5.0.0+] #FinalizeSevenSixAxisSensor
308 [5.0.0+] #SetSevenSixAxisSensorFusionStrength
309 [5.0.0+] #GetSevenSixAxisSensorFusionStrength
310 [6.0.0+] #ResetSevenSixAxisSensorTimestamp
400 [3.0.0+] IsUsbFullKeyControllerEnabled
401 [3.0.0+] EnableUsbFullKeyController
402 [3.0.0+] IsUsbFullKeyControllerConnected
403 [4.0.0+] HasBattery
404 [4.0.0+] HasLeftRightBattery
405 [4.0.0+] GetNpadInterfaceType
406 [4.0.0+] GetNpadLeftRightInterfaceType
500 [5.0.0+] GetPalmaConnectionHandle
501 [5.0.0+] InitializePalma
502 [5.0.0+] AcquirePalmaOperationCompleteEvent
503 [5.0.0+] GetPalmaOperationInfo
504 [5.0.0+] PlayPalmaActivity
505 [5.0.0+] SetPalmaFrModeType
506 [5.0.0+] ReadPalmaStep
507 [5.0.0+] EnablePalmaStep
508 [5.0.0+] ResetPalmaStep
509 [5.0.0+] ReadPalmaApplicationSection
510 [5.0.0+] WritePalmaApplicationSection
511 [5.0.0+] ReadPalmaUniqueCode
512 [5.0.0+] SetPalmaUniqueCodeInvalid
513 [5.0.0+] WritePalmaActivityEntry
514 [5.0.0+] WritePalmaRgbLedPatternEntry
515 [5.0.0+] WritePalmaWaveEntry
516 [5.0.0+] SetPalmaDataBaseIdentificationVersion
517 [5.0.0+] GetPalmaDataBaseIdentificationVersion
518 [5.0.0+] SuspendPalmaFeature
519 [5.1.0+] GetPalmaOperationResult
520 [5.1.0+] ReadPalmaPlayLog
521 [5.1.0+] ResetPalmaPlayLog
522 [5.1.0+] SetIsPalmaAllConnectable
523 [5.1.0+] SetIsPalmaPairedConnectable
524 [5.1.0+] PairPalma
525 [5.1.0+] SetPalmaBoostMode
526 [7.0.0+] CancelWritePalmaWaveEntry
527 [8.0.0+] EnablePalmaBoostMode
528 [8.0.0+] GetPalmaBluetoothAddress
529 [8.0.0+] SetDisallowedPalmaConnection
1000 SetNpadCommunicationMode
1001 GetNpadCommunicationMode

CreateAppletResource

Takes a PID and an u64 AppletResourceUserId. Returns an #IAppletResource.

SetSupportedNpadStyleSet

Takes an u32 #NpadStyleTag.

GetSupportedNpadStyleSet

Returns an u32 #NpadStyleTag.

SetSupportedNpadIdType

Takes a PID-descriptor, a type-0x9 input buffer, and an AppletResourceUserId. No output.

The input buffer contains an array of u32 #NpadIdType.

AcquireNpadStyleSetUpdateEventHandle

Takes an input u32, an u64 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.

SetNpadJoyAssignmentModeSingleByDefault

Takes a PID-descriptor, an u32, and an AppletResourceUserId. No output.

SetNpadJoyAssignmentModeSingle

Takes a PID-descriptor, an u32, AppletResourceUserId, and s64 NpadJoyDeviceType. No output.

SetNpadJoyAssignmentModeDual

Takes a PID-descriptor, an u32, and an AppletResourceUserId. No output.

MergeSingleJoyAsDualJoy

Takes a PID-descriptor, two u32s, and an AppletResourceUserId. No output.

GetNpadHandheldActivationMode

Takes a PID and an u64 AppletResourceUserId. Returns an output u64. Official user-processes panic if the output u64 is not 0-2.

GetVibrationDeviceInfo

Takes a #VibrationDeviceHandle. Returns an output #VibrationDeviceInfo.

SendVibrationValue

Takes a PID-descriptor, a #VibrationDeviceHandle, a #VibrationValue immediately after that, and an u64 AppletResourceUserId. No output.

GetActualVibrationValue

Takes a PID-descriptor, a #VibrationDeviceHandle, and an u64 AppletResourceUserId. Returns an output #VibrationValue.

CreateActiveVibrationDeviceList

No input. Returns an #IActiveVibrationDeviceList.

PermitVibration

Takes an input u8 bool. No output.

This affects the config displayed by System Settings.

IsVibrationPermitted

No input. Returns an output u8 bool.

SendVibrationValues

Takes an u64 AppletResourceUserId, and two type-0x9 input buffers containing an array of: #VibrationDeviceHandle for first buffer, and #VibrationValue for the second buffer.

Official sw uses the same entry-count for each array.

IsVibrationDeviceMounted

Takes a total of 0x10-bytes of input and a PID, returns an output u8 bool.

ActivateSevenSixAxisSensor

Takes a PID and an u64 AppletResourceUserId, no output.

StartSevenSixAxisSensor

Takes a PID and an u64 AppletResourceUserId, no output.

StopSevenSixAxisSensor

Takes a PID and an u64 AppletResourceUserId, no output.

InitializeSevenSixAxisSensor

Takes a PID, an u64 AppletResourceUserId, two u64s for the size of each TransferMemory, and two TransferMemory handles. No output.

The size of the first TransferMemory is 0x1000 with MemoryPermission=read-only, while the second one has size 0x7F000 with MemoryPermission=none.

FinalizeSevenSixAxisSensor

Takes a PID and an u64 AppletResourceUserId, no output.

SetSevenSixAxisSensorFusionStrength

Takes a PID, a float, and an u64 AppletResourceUserId, no output.

GetSevenSixAxisSensorFusionStrength

Takes a PID and an u64 AppletResourceUserId, returns an output float.

ResetSevenSixAxisSensorTimestamp

Takes a PID and an u64 AppletResourceUserId, no output.

VibrationDeviceHandle

This is an u32.

VibrationDeviceInfo

This is a 0x8-byte struct.

VibrationValue

This is a 0x10-byte struct, which contains 4 float values.

IAppletResource

Cmd Name
0 #GetSharedMemoryHandle

GetSharedMemoryHandle

No input. Returned a sharedmem handle.

IActiveVibrationDeviceList

This is "nn::hid::IActiveVibrationDeviceList".

Cmd Name
0 #ActivateVibrationDevice

ActivateVibrationDevice

Takes an input #VibrationDeviceHandle. No output.

NpadStyleTag

This is a bitfield describing which controller styles are supported.

Bits Description Notes
0 NpadFullKey Pro Controller.
1 NpadHandheld Joy-Con controller in handheld mode.
2 NpadJoyDual Joy-Con controller in dual mode.
3 NpadJoyLeft Joy-Con left controller in single mode.
4 NpadJoyRight Joy-Con right controller in single mode.
5 NpadGc GameCube controller.
6 NpadPalma Poké Ball Plus controller.
7 NpadLark NES controller.
8 NpadHandheldLark NES controller in handheld mode.
9 NpadLucia
10-28 Reserved
29 NpadSystemExt
30 NpadSystem
31 Reserved

NpadIdType

This is an u32. This is the controller index used in sharedmem. 0x20 is handheld.

hid:dbg

This is "nn::hid::IHidDebugServer".

Cmd Name
0 DeactivateDebugPad
1 SetDebugPadAutoPilotState
2 UnsetDebugPadAutoPilotState
10 DeactivateTouchScreen
11 SetTouchScreenAutoPilotState
12 UnsetTouchScreenAutoPilotState
20 DeactivateMouse
21 SetMouseAutoPilotState
22 UnsetMouseAutoPilotState
30 DeactivateKeyboard
31 SetKeyboardAutoPilotState
32 UnsetKeyboardAutoPilotState
50 DeactivateXpad
51 SetXpadAutoPilotState
52 UnsetXpadAutoPilotState
60 DeactivateJoyXpad
91 DeactivateGesture
110 DeactivateHomeButton
111 SetHomeButtonAutoPilotState
112 UnsetHomeButtonAutoPilotState
120 DeactivateSleepButton
121 SetSleepButtonAutoPilotState
122 UnsetSleepButtonAutoPilotState
123 DeactivateInputDetector
130 DeactivateCaptureButton
131 SetCaptureButtonAutoPilotState
132 UnsetCaptureButtonAutoPilotState
133 [3.0.0+] SetShiftAccelerometerCalibrationValue
134 [3.0.0+] GetShiftAccelerometerCalibrationValue
135 [3.0.0+] SetShiftGyroscopeCalibrationValue
136 [3.0.0+] GetShiftGyroscopeCalibrationValue
140 [3.0.0+] DeactivateConsoleSixAxisSensor
141 [5.0.0+] GetConsoleSixAxisSensorSamplingFrequency
142 [5.0.0+] DeactivateSevenSixAxisSensor
143 [5.0.0+] GetConsoleSixAxisSensorCountStates
144 [8.0.0+] GetAccelerometerFsr
145 [8.0.0+] SetAccelerometerFsr
146 [8.0.0+] GetAccelerometerOdr
147 [8.0.0+] SetAccelerometerOdr
148 [8.0.0+] GetGyroscopeFsr
149 [8.0.0+] SetGyroscopeFsr
150 [8.0.0+] GetGyroscopeOdr
151 [8.0.0+] SetGyroscopeOdr
201 ActivateFirmwareUpdate
202 DeactivateFirmwareUpdate
203 #StartFirmwareUpdate
204 GetFirmwareUpdateStage
205 #GetFirmwareVersion
206 #GetDestinationFirmwareVersion
207 #DiscardFirmwareInfoCacheForRevert
208 [3.0.0+] StartFirmwareUpdateForRevert
209 [3.0.0+] GetAvailableFirmwareVersionForRevert
210 [4.0.0+] IsFirmwareUpdatingDevice
211 [6.0.0+] StartFirmwareUpdateIndividual
215 [6.0.0+] SetUsbFirmwareForceUpdateEnabled
216 [6.0.0+] SetAllKuinaDevicesToFirmwareUpdateMode
221 [3.0.0+] #UpdateControllerColor
222 [4.0.0+] ConnectUsbPadsAsync
223 [4.0.0+] DisconnectUsbPadsAsync
224 [5.0.0+] #UpdateDesignInfo
225 [5.0.0+] GetUniquePadDriverState
226 [5.0.0+] GetSixAxisSensorDriverStates
227 [5.0.0+] GetRxPacketHistory
228 [6.0.0+] AcquireOperationEventHandle
229 [6.0.0+] #ReadSerialFlash
230 [6.0.0+] WriteSerialFlash
231 [6.0.0+] GetOperationResult
232 [6.0.0+] EnableShipmentMode
233 [6.0.0+] ClearPairingInfo
234 [6.0.0+] GetUniquePadDeviceTypeSetInternal
235 [7.0.0+] EnableAnalogStickPower
301 [5.0.0+] GetAbstractedPadHandles
302 [5.0.0+] GetAbstractedPadState
303 [5.0.0+] GetAbstractedPadsState
321 [5.0.0+] SetAutoPilotVirtualPadState
322 [5.0.0+] UnsetAutoPilotVirtualPadState
323 [5.0.0+] UnsetAllAutoPilotVirtualPadState
324 [7.0.0+] #AttachHdlsWorkBuffer
325 [7.0.0+] #ReleaseHdlsWorkBuffer
326 [7.0.0+] #DumpHdlsNpadAssignmentState
327 [7.0.0+] #DumpHdlsStates
328 [7.0.0+] #ApplyHdlsNpadAssignmentState
329 [7.0.0+] #ApplyHdlsStateList
330 [7.0.0+] #AttachHdlsVirtualDevice
331 [7.0.0+] #DetachHdlsVirtualDevice
332 [7.0.0+] #SetHdlsState
350 [5.0.0+] AddRegisteredDevice
400 [6.0.0+] DisableExternalMcuOnNxDevice
401 [6.0.0+] DisableRailDeviceFiltering
500 [8.0.0+] SetFactoryInt
501 [8.0.0+] IsFactoryBootEnabled

StartFirmwareUpdate

Takes a total of 0x20-bytes of input, 2 handles, and returns an output handle.

[3.0.0+] Now takes a total of 8-bytes of input, and no longer uses any input/output handles.

GetFirmwareVersion

Takes a total of 8-bytes of input, and returns a total of 4-bytes of output.

[3.0.0+] Now returns an additional 0xC-bytes of output.

GetDestinationFirmwareVersion

Takes a total of 8-bytes of input, and returns a total of 4-bytes of output.

[3.0.0+] Now returns an additional 0xC-bytes of output.

DiscardFirmwareInfoCacheForRevert

Takes a total of 8-bytes of input, and returns a total of 5-bytes of output.

[3.0.0+] No input/output.

UpdateControllerColor

Takes two input u32s for the colors, an input u64 UniquePadId, and no output.

A state flag must be clear, otherwise an error is thrown. Afterwards, this flag is set.

Sends the spi-write subcommand to the specified controller, for writing the color data. This writes to offset 0x6050 size 0x6, where the first 3-bytes are from the first u32 and the remaining 3-bytes are from the second u32.

UpdateDesignInfo

Takes 4 input u32s for the colors, an input u8, an input u64 UniquePadId, and no output.

A state flag must be clear (same as #UpdateControllerColor), otherwise an error is thrown. Afterwards, this flag is set.

Sends the spi-write subcommand to the specified controller, for writing to offset 0x6050 size 0xD. The first 3-bytes from each u32 is used for the spi-write-data, with the u8 being copied immediately afterwards the color data.

ReadSerialFlash

Takes an input TransferMemory handle, an input u32 offset, an input u64 size, and an u64 UniquePadId, no output.

Reads from the specified controller's spi-flash. The input size is the original size without page-alignment. The TransferMemory permissions is RW-.

AttachHdlsWorkBuffer

Takes an input TransferMemory handle and an u64 for the TransferMemory size, no output.

Official user-processes use TransferMemory size=0x1000 and permissions=RW.

This TransferMemory is used as input/output by the other Hdls commands.

Hdls is for virtual HID controllers.

ReleaseHdlsWorkBuffer

No input/output.

DumpHdlsNpadAssignmentState

No input/output.

After using this cmd, the output #HdlsNpadAssignment is located at tmem+0.

DumpHdlsStates

No input/output.

After using this cmd, the output #HdlsStateList struct is located at tmem+0.

ApplyHdlsNpadAssignmentState

Takes an input u8 bool, no output.

Prior to using this cmd, the input #HdlsNpadAssignment is written to tmem+0 by the user-process.

ApplyHdlsStateList

No input/output.

Prior to using this cmd, the input #HdlsStateList is written to tmem+0 by the user-process.

The #HdlsState will be applied for each HdlsHandle. If a HdlsHandle is not found, code similar to #AttachHdlsVirtualDevice will run with the #HdlsDeviceInfo, then it will continue with applying state with the new device.

AttachHdlsVirtualDevice

Takes an #HdlsDeviceInfo, returns a 8-byte HdlsHandle.

DetachHdlsVirtualDevice

Takes an input 8-byte HdlsHandle, no output.

SetHdlsState

Takes an input #HdlsState and an input 8-byte HdlsHandle, no output.

HdlsNpadAssignment

This is a 0x208-byte struct. This seems to be an array, structure unknown.

HdlsStateList

Offset Size Description
0x0 0x4 Total entries
0x4 0x4 Padding
0x8 0x400(0x40*0x10) Array of #HdlsStateListEntry.

This is a 0x408-byte struct.

This contains a list of all controllers, including non-virtual controllers.

HdlsStateListEntry

Offset Size Description
0x0 0x8 HdlsHandle
0x8 0x10 #HdlsDeviceInfo. With #ApplyHdlsStateList this is only used when creating new devices.
0x18 0x24 #HdlsState
0x3C 0x4 Padding

This is a 0x40-byte struct.

HdlsDeviceInfo

Offset Size Description
0x0 0x4 Only one bit can be set, see below.
0x4 0x4 RGBA Single Body Color
0x8 0x4 RGBA Single Buttons Color
0xC 0x1 Additional type field used with the above type field, if the value doesn't match one of the following a default is used. Type Pro-Controller: value 0x3 indicates that the controller is connected via USB. Type Joy-Con Left/Right: with value 0x2 the system doesn't list the controller in hid sharedmem. Type bit21: value 0x3 = unknown.
0xD 0x3 Padding

This is a 0x10-byte struct.

Bits for the above type field:

Bits Description Notes
0-7 BIT(N*4+0) = Pro-Controller, BIT(N*4+1) = Joy-Con Left, BIT(N*4+2) = Joy-Con Right, BIT(N*4+3) = invalid. Where N is 0-1.
8-10 Pro-Controller
11 Famicom-Controller
12 Famicom-Controller II with microphone
13 NES-Controller (#DeviceType=0x200)
14 NES-Controller (#DeviceType=0x400)
15-16 Invalid
17 Unknown (#DeviceType=0x8000)
18-20 Invalid
21-23 Unknown (#DeviceType=0x80000000)

HdlsState

Offset Size Description
0x0 0x1 powerConnected for the main PowerInfo.
0x1 0x1 ORRed with powerConnected to set the value of the first byte for the controller flags.
0x2 0x6 Unknown
0x8 0x4 batteryCharge for the main PowerInfo.
0xC 0x4 Buttons
0x10 0x10(4*2*2) Joystick data, see HID_Shared_Memory#Controller_State.
0x20 0x1 Unused for input. Set with output from #DumpHdlsStates (zero in some cases).
0x21 0x3 Padding

This is a 0x24-byte struct.

hid:sys

This is "nn::hid::IHidSystemServer".

Cmd Name
31 SendKeyboardLockKeyEvent
101 AcquireHomeButtonEventHandle
111 ActivateHomeButton
121 AcquireSleepButtonEventHandle
131 ActivateSleepButton
141 AcquireCaptureButtonEventHandle
151 ActivateCaptureButton
161 [7.0.0+] GetPlatformConfig
210 AcquireNfcDeviceUpdateEventHandle
211 GetNpadsWithNfc
212 AcquireNfcActivateEventHandle
213 ActivateNfc
214 [4.0.0+] GetXcdHandleForNpadWithNfc
215 [4.0.0+] IsNfcActivated
230 AcquireIrSensorEventHandle
231 ActivateIrSensor
301 ActivateNpadSystem
303 ApplyNpadSystemCommonPolicy
304 EnableAssigningSingleOnSlSrPress
305 DisableAssigningSingleOnSlSrPress
306 GetLastActiveNpad
307 GetNpadSystemExtStyle
308 [5.0.0+] ApplyNpadSystemCommonPolicyFull
309 [5.0.0+] GetNpadFullKeyGripColor
310 [6.0.0+] GetMaskedSupportedNpadStyleSet
311 SetNpadPlayerLedBlinkingDevice
312 [6.0.0+] SetSupportedNpadStyleSetAll
321 [3.0.0+] #GetUniquePadsFromNpad
322 GetIrSensorState
323 GetXcdHandleForNpadWithIrSensor
500 SetAppletResourceUserId
501 RegisterAppletResourceUserId
502 UnregisterAppletResourceUserId
503 EnableAppletToGetInput
504 SetAruidValidForVibration
505 EnableAppletToGetSixAxisSensor
510 #SetVibrationMasterVolume
511 GetVibrationMasterVolume
512 [3.0.0+] BeginPermitVibrationSession
513 [3.0.0+] EndPermitVibrationSession
520 EnableHandheldHids
521 DisableHandheldHids
540 AcquirePlayReportControllerUsageUpdateEvent
541 GetPlayReportControllerUsages
542 AcquirePlayReportRegisteredDeviceUpdateEvent
543 GetRegisteredDevicesOld ([1.0.0-4.1.0] GetRegisteredDevices)
544 [3.0.0+] AcquireConnectionTriggerTimeoutEvent
545 [3.0.0+] SendConnectionTrigger
546 [3.0.0+] AcquireDeviceRegisteredEventForControllerSupport
547 [3.0.0+] GetAllowedBluetoothLinksCount
548 [5.0.0+] GetRegisteredDevices
549 [6.0.0+] GetConnectableRegisteredDevices
700 ActivateUniquePad
702 AcquireUniquePadConnectionEventHandle
703 #GetUniquePadIds
751 AcquireJoyDetachOnBluetoothOffEventHandle
800 ListSixAxisSensorHandles
801 IsSixAxisSensorUserCalibrationSupported
802 ResetSixAxisSensorCalibrationValues
803 StartSixAxisSensorUserCalibration
804 CancelSixAxisSensorUserCalibration
805 [3.0.0+] GetUniquePadBluetoothAddress
806 [3.0.0+] DisconnectUniquePad
807 [5.0.0+] GetUniquePadType
808 [5.0.0+] GetUniquePadInterface
809 [5.0.0+] GetUniquePadSerialNumber
810 [5.0.0+] GetUniquePadControllerNumber
811 [5.0.0+] GetSixAxisSensorUserCalibrationStage
812 [8.0.0+] GetConsoleUniqueSixAxisSensorHandle
821 StartAnalogStickManualCalibration
822 RetryCurrentAnalogStickManualCalibrationStage
823 CancelAnalogStickManualCalibration
824 ResetAnalogStickManualCalibration
825 [5.0.0+] GetAnalogStickState
826 [5.0.0+] GetAnalogStickManualCalibrationStage
827 [5.0.0+] IsAnalogStickButtonPressed
828 [5.0.0+] IsAnalogStickInReleasePosition
829 [5.0.0+] IsAnalogStickInCircumference
830 [7.0.0+] #SetNotificationLedPattern
850 [3.0.0+] IsUsbFullKeyControllerEnabled
851 [3.0.0+] EnableUsbFullKeyController
852 [3.0.0+] IsUsbConnected
870 [5.1.0+] IsHandheldButtonPressedOnConsoleMode
900 ActivateInputDetector
901 #NotifyInputDetector
1000 [3.0.0+] InitializeFirmwareUpdate
1001 [3.0.0+] GetFirmwareVersion
1002 [3.0.0+] GetAvailableFirmwareVersion
1003 [3.0.0+] IsFirmwareUpdateAvailable
1004 [3.0.0+] CheckFirmwareUpdateRequired
1005 [3.0.0+] StartFirmwareUpdate
1006 [3.0.0+] AbortFirmwareUpdate
1007 [3.0.0+] GetFirmwareUpdateState
1008 [4.0.0+] ActivateAudioControl
1009 [4.0.0+] AcquireAudioControlEventHandle
1010 [4.0.0+] GetAudioControlStates
1011 [4.0.0+] DeactivateAudioControl
1050 [5.0.0+] IsSixAxisSensorAccurateUserCalibrationSupported
1051 [5.0.0+] StartSixAxisSensorAccurateUserCalibration
1052 [5.0.0+] CancelSixAxisSensorAccurateUserCalibration
1053 [5.0.0+] GetSixAxisSensorAccurateUserCalibrationState
1100 [5.0.0+] #GetHidbusSystemServiceObject
1120 [6.0.0+] SetFirmwareHotfixUpdateSkipEnabled
1130 [6.0.0+] InitializeUsbFirmwareUpdate
1131 [6.0.0+] FinalizeUsbFirmwareUpdate
1132 [6.0.0+] CheckUsbFirmwareUpdateRequired
1133 [6.0.0+] StartUsbFirmwareUpdate
1134 [6.0.0+] GetUsbFirmwareUpdateState
1150 [8.0.0+] SetTouchScreenMagnification

GetUniquePadsFromNpad

Takes an input u32 #NpadIdType, a type-0xA output buffer, and returns an output u64 for total output entries.

The output buffer contains an array of u64 UniquePadId.

SetVibrationMasterVolume

Takes an input 32bit float.

GetUniquePadIds

Takes a type-0xA output buffer, and returns an output u64 for total output entries.

The output buffer contains an array of u64 UniquePadId.

NotifyInputDetector

Takes an input u32 bitmask InputSourceId, no output.

This is the only hid:sys command used by USB-sysmodule (with value 0x40).

SetNotificationLedPattern

Takes an input #NotificationLedPattern and an u64 UniquePadId, no output.

The specified controller must have a HOME button.

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 subcommand.

GetHidbusSystemServiceObject

No input, returns an #IHidbusSystemServer.

NotificationLedPattern

Offset Size Subcommand argdata bytepos Subcommand argdata nibble Description
0x0 0x1 0x0 Low Mini Cycle Base Duration. Value 0x1-0xF: 12.5ms - 187.5ms. Value 0x0 = 0ms/OFF.
0x1 0x1 0x0 High Number of Mini Cycles + 1. Value 0x0-0xF: 1 - 16 mini cycles.
0x2 0x1 0x1 Low Number of Full Cycles. Value 0x1-0xF: 1 - 15 full cycles. Value 0x0 is repeat forever, but if Mini Cycle Base Duration is set to 0x0, it does the 1st Mini Cycle with a 12.5ms base duration and then the LED stays on with LED Start Intensity.
0x3 0x1 0x1 High LED Start Intensity. Value 0x0-0xF: 0% - 100%. (In HW, 1 - 241 duty)
0x4 0x1 0x2 High Mini Cycle 1 LED Intensity. Value 0x0-0xF: 0% - 100%. (In HW, 1 - 241 duty)
0x5 0x1 0x3 High Fading Transition Steps to Mini Cycle 1 (Uses PWM). Value 0x0: Instant. Each step duration is based on Mini Cycle Step Duration Multiplier.
0x6 0x1 0x3 Low Final Step Duration Multiplier of Mini Cycle 1. Value is a Multiplier of Mini Cycle Base Duration. Value 0x0: 12.5ms, 0x1 - xF: 1x - 15x.
0x7 0x1 Unused
0x8 0x1 0x2 Low Mini Cycle 2 LED Intensity.
0x9 0x1 0x4 High Fading Transition Steps to Mini Cycle 2 (see above).
0xA 0x1 0x4 Low Final Step Duration Multiplier of Mini Cycle 2 (see above).
0xB 0x1 Unused
0xC 0x1 0x5 High Mini Cycle 3 LED Intensity.
0xD 0x1 0x6 High Fading Transition Steps to Mini Cycle 3 (see above).
0xE 0x1 0x6 Low Final Step Duration Multiplier of Mini Cycle 3 (see above).
0xF 0x1 Unused
0x10 0x1 0x5 Low Mini Cycle 4 LED Intensity.
0x11 0x1 0x7 High Fading Transition Duration to Mini Cycle 4 (see above).
0x12 0x1 0x7 Low Final Step Duration Multiplier of Mini Cycle 4 (see above).
0x13 0x1 Unused
0x14 0x1 0x8 High Mini Cycle 5 LED Intensity.
0x15 0x1 0x9 High Fading Transition Steps to Mini Cycle 5 (see above).
0x16 0x1 0x9 Low Final Step Duration Multiplier of Mini Cycle 5 (see above).
0x17 0x1 Unused
0x18 0x1 0x8 Low Mini Cycle 6 LED Intensity.
0x19 0x1 0xA High Fading Transition Steps to Mini Cycle 6 (see above).
0x1A 0x1 0xA Low Final Step Duration Multiplier of Mini Cycle 6 (see above).
0x1B 0x1 Unused
0x1C 0x1 0xB High Mini Cycle 7 LED Intensity.
0x1D 0x1 0xC High Fading Transition Steps to Mini Cycle 7 (see above).
0x1E 0x1 0xC Low Final Step Duration Multiplier of Mini Cycle 7 (see above).
0x1F 0x1 Unused
0x20 0x1 0xB Low Mini Cycle 8 LED Intensity.
0x21 0x1 0xD Low Fading Transition Steps to Mini Cycle 8 (see above).
0x22 0x1 0xD High Final Step Duration Multiplier of Mini Cycle 8 (see above).
0x23 0x1 Unused
0x24 0x1 0xE High Mini Cycle 9 LED Intensity.
0x25 0x1 0xF High Fading Transition Steps to Mini Cycle 9 (see above).
0x26 0x1 0xF Low Final Step Duration Multiplier of Mini Cycle 9 (see above).
0x27 0x1 Unused
0x28 0x1 0xE Low Mini Cycle 10 LED Intensity.
0x29 0x1 0x10 High Fading Transition Steps to Mini Cycle 10 (see above).
0x2A 0x1 0x10 Low Final Step Duration Multiplier of Mini Cycle 10 (see above).
0x2B 0x1 Unused
0x2C 0x1 0x11 High Mini Cycle 11 LED Intensity.
0x2D 0x1 0x12 High Fading Transition Steps to Mini Cycle 11 (see above).
0x2E 0x1 0x12 Low Final Step Duration Multiplier of Mini Cycle 11 (see above).
0x2F 0x1 Unused
0x30 0x1 0x11 Low Mini Cycle 12 LED Intensity.
0x31 0x1 0x13 High Fading Transition Steps to Mini Cycle 12 (see above).
0x32 0x1 0x13 Low Final Step Duration Multiplier of Mini Cycle 12 (see above).
0x33 0x1 Unused
0x34 0x1 0x14 High Mini Cycle 13 LED Intensity.
0x35 0x1 0x15 High Fading Transition Steps to Mini Cycle 13 (see above).
0x36 0x1 0x15 Low Final Step Duration Multiplier of Mini Cycle 13 (see above).
0x37 0x1 Unused
0x38 0x1 0x14 Low Mini Cycle 14 LED Intensity.
0x39 0x1 0x16 High Fading Transition Steps to Mini Cycle 14 (see above).
0x3A 0x1 0x16 Low Final Step Duration Multiplier of Mini Cycle 14 (see above).
0x3B 0x1 Unused
0x3C 0x1 0x17 High Mini Cycle 15 LED Intensity.
0x3D 0x1 0x18 High Fading Transition Steps to Mini Cycle 15 (see above).
0x3E 0x1 0x18 Low Final Step Duration Multiplier of Mini Cycle 15 (see above).
0x3F 0x1 Unused
0x40 0x1 0x17 Low Mini Cycle 16 LED Intensity.
0x41 0x1 0x19 High Fading Transition Steps to Mini Cycle 16 (see above). (Unused in older Joy-Con / Pro-Con FW. Unknown for new.)
0x42 0x1 0x19 Low Final Step Duration Multiplier of Mini Cycle 16 (see above). (Unused in older Joy-Con / Pro-Con FW. Unknown for new.)
0x43 0x1 Unused
0x44 0x1 0x1A High Unknown (Unused in older Joy-Con / Pro-Con FW. Unknown for new.)
0x45 0x1 0x1A Low Unknown (Unused in older Joy-Con / Pro-Con FW. Unknown for new.)
0x46 0x1 Padding
0x47 0x1 Padding

This is "nn::hid::system::NotificationLedPattern".

This is a 0x48-byte struct.

The above descriptions in the table are based on the info from here.

argdata in the subcommand is initialized as follows: ((u8*)cmd_argdata)[pos] = u8_in[pos2] | u8_in[pos3]<<4; Hence, 4bits from pairs of 2-bytes of the input struct are combined to write to the subcommand. Only the low 4bits of each used byte in the struct is used. This is written to stack initially, then copied to the actual cmd_argdata (the data immediately following the subcommandID byte). There's a total of 0x1B-bytes of cmd_argdata initialized from this.

The layout of cmd_argdata is as follows:

Offset Size Description
0x0 0x1B See above.
0x1B 0xB Cleared to zero.
0x26 0x5 Unused
0x2B 0x8 Set to an input value, which is hard-coded 0.
0x33 0x2 Set to value 0.
0x35 0x1 Set to value 1.

DeviceType

This is a bitmask describing the controller device type.

Bits Description Notes
0 Pro Controller.
1 Unknown
2 Unknown
3 Unknown
4 Joy-Con left controller.
5 Joy-Con right controller.
6 Unknown
7 Famicom controller.
8 Famicom controller II with microphone.
9 NES controller.
10 NES controller (same as above?).
11-14 Unknown
15 Unknown controller type.
16-30 Unknown
31 Unknown controller type (similar to bit15?).

IHidbusSystemServer

This is "nn::hidbus::IHidbusSystemServer".

This was added with [5.0.0+].

Cmd Name
500
501
502

hid:tmp

This is "nn::hid::IHidTemporaryServer".

This service was added with [3.0.0+], then removed with [8.0.0+].

Cmd Name
0 GetConsoleSixAxisSensorCalibrationValues

irs

This is "nn::irsensor::IIrSensorServer".

Cmd Name
302 #ActivateIrsensor
303 #DeactivateIrsensor
304 #GetIrsensorSharedMemoryHandle
305 #StopImageProcessor
306 #RunMomentProcessor
307 #RunClusteringProcessor
308 #RunImageTransferProcessor
309 #GetImageTransferProcessorState
310 #RunTeraPluginProcessor
311 #GetNpadIrCameraHandle
312 #RunPointingProcessor
313 #SuspendImageProcessor
314 [3.0.0+] #CheckFirmwareVersion
315 [4.0.0+] SetFunctionLevel
316 [4.0.0+] RunImageTransferExProcessor
317 [4.0.0+] RunIrLedProcessor
318 [4.0.0+] StopImageProcessorAsync
319 [4.0.0+] ActivateIrsensorWithFunctionLevel

ActivateIrsensor

Takes a PID-descriptor and an AppletResourceUserId. No output.

DeactivateIrsensor

Takes a PID-descriptor and an AppletResourceUserId. No output.

GetIrsensorSharedMemoryHandle

Takes a PID-descriptor and an AppletResourceUserId. Returns a SharedMemory handle.

The SharedMemory is mapped with permissions=read-only and size=0x8000.

StopImageProcessor

Takes a PID-descriptor, an #IrCameraHandle, and an AppletResourceUserId. No output.

RunMomentProcessor

Takes a PID-descriptor, an #IrCameraHandle, an AppletResourceUserId, and a #PackedMomentProcessorConfig. No output.

RunClusteringProcessor

Takes a PID-descriptor, an #IrCameraHandle, an AppletResourceUserId, and a #PackedClusteringProcessorConfig. No output.

RunImageTransferProcessor

Takes a PID-descriptor, an #IrCameraHandle, an AppletResourceUserId, a #PackedImageTransferProcessorConfig, an u64 for the TransferMemory_size, and a TransferMemory handle. No output.

Official sw creates the TransferMemory with an user-specified buffer and permissions=0.

GetImageTransferProcessorState

Takes a PID-descriptor, a type-0x6 output buffer, an #IrCameraHandle, and an AppletResourceUserId. Returns an #ImageTransferProcessorState. No output.

RunTeraPluginProcessor

Takes a PID-descriptor, an #IrCameraHandle, a #PackedTeraPluginProcessorConfig (immediately after the previous word), and an AppletResourceUserId. No output.

GetNpadIrCameraHandle

Takes an input u32. Returns an output #IrCameraHandle.

RunPointingProcessor

Takes a PID-descriptor, an #IrCameraHandle, a #PackedDpdProcessorConfig (immediately after the previous word), and an AppletResourceUserId. No output.

SuspendImageProcessor

Takes a PID-descriptor, an #IrCameraHandle, and an AppletResourceUserId. No output.

CheckFirmwareVersion

Takes a PID-descriptor, an #IrCameraHandle, a #PackedMcuVersion, and an AppletResourceUserId. No output.

IrCameraHandle

This is an u32.

PackedMomentProcessorConfig

This is a 0x20-byte struct. This is converted from another structure by the official user-process.

Offset Size Description DefaultConfig
0x0 0x8 ? 0x493E0
0x8 0x1 ? 0x0
0x9 0x1 ? 0x8
0xA 0x1 ? 0x0
0xB 0x5 Padding
0x10 0x8 u16, u32, u16 {Not written}, 0x1400000, 0xF0
0x18 0x4 Hard-coded to 0xA0003.
0x1C 0x1 ? 0x1
0x1D 0x1 ? 0x50
0x1E 0x2 Padding

PackedClusteringProcessorConfig

This is a 0x28-byte struct.

PackedImageTransferProcessorConfig

This is a 0x18-byte struct. This is converted from another structure by the official user-process. The conversion is the same as PackedMomentProcessorConfig, except the code using out +0x1C/+0x1D was removed, and the constant is now located at out+0x10. The code which wrote to out u64 +0x10 from in+0x24 was replaced with code which writes an u8 to out+0x14.

ImageTransferProcessorState

This is a 0x10-byte struct.

PackedTeraPluginProcessorConfig

This is an u64.

PackedDpdProcessorConfig

This is a 0x10-byte struct.

PackedMcuVersion

This is an u32.

irs:sys

This is "nn::irsensor::IIrSensorSystemServer".

Cmd Name
500 SetAppletResourceUserId
501 RegisterAppletResourceUserId
502 UnregisterAppletResourceUserId
503 EnableAppletToGetInput

ahid:cd

This is "nn::ahid::IServerSession".

Used for USB HID devices.

Cmd Name Notes
0 Takes an input s32, no output.
1 Takes an input s32, no output.
2 Takes an input u32, returns an #ICtrlSession.
3 Takes an input u32, returns an #IReadSession.
[1.0.0-2.3.0] 4 Takes an input u32, returns an #IWriteSession.

ICtrlSession

This is "nn::ahid::ICtrlSession".

Cmd Name Notes
0
1
2
3
4
5
6
7
8
9
10
11
12 [3.0.0+]

All of these use USB CtrlXfer, except for cmd10-11 which are event(?) related, and cmd1 which copies 0x4000-bytes from state to output.

IReadSession

This is "nn::ahid::IReadSession".

Cmd Name Notes
0

Cmd0 uses 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.

IWriteSession

This is "nn::ahid::IWriteSession".

This was removed with [3.0.0+].

Cmd Name Notes
0 This is the inverse of #IReadSession cmd0. Uses the OUTPUT endpoint with an input buffer.

ahid:hdr

This is "nn::ahid::hdr::ISession".

Used internally for USB HID devices.

Cmd Name
0
1
2
3
4
5 [6.0.0+]

xcd:sys

This is "nn::xcd::detail::ISystemServer".

Cmd Name
0 GetDataFormat
1 SetDataFormat
2 GetMcuState
3 SetMcuState
4 GetMcuVersionForNfc
5 CheckNfcDevicePower
6 [5.0.0+]
10 SetNfcEvent
11 GetNfcInfo
12 StartNfcDiscovery
13 StopNfcDiscovery
14 StartNtagRead
15 StartNtagWrite
16 SendNfcRawData
17 RegisterMifareKey
18 ClearMifareKey
19 StartMifareRead
20 StartMifareWrite
101 GetAwakeTriggerReasonForLeftRail
102 GetAwakeTriggerReasonForRightRail

[5.0.0+] SetDataFormat, SetMcuState, and ClearMifareKey: now takes a total of 0xC-bytes of input instead of 0x10.

[6.0.0+]: The buffer type used by GetNfcInfo is now 0x32 instead of 0x1A.

hidbus

This is "nn::hidbus::IHidbusServer".

This was added with [5.0.0+].

Cmd Name
1 GetBusHandle
2 IsExternalDeviceConnected
3 Initialize
4 Finalize
5 EnableExternalDevice
6 GetExternalDeviceId
7 SendCommandAsync
8 GetSendCommandAsynceResult
9 SetEventForSendCommandAsycResult
10 GetSharedMemoryHandle
11 EnableJoyPollingReceiveMode
12 DisableJoyPollingReceiveMode
[5.0.0-6.2.0] 13 GetPollingData
14 [6.0.0+] SetStatusManagerType

RomFS

The hid-sysmodule RomFS contains:

 ftmFwUpdate
   ├── NTD_4CD_1801.fts256
   ├── NTD_4CD_2602.fts256
   ├── NTD_4CD_3801.fts256
   └── NTD_4CD_xxxx.fts256 [7.0.0+]

These are firmware files for the touchscreen controller.

Firmware update

HID-sysmodule mounts the contents of title 0100000000000822 as "systemData" or the contents of title 010000000000B22B as "systemDataD". Both titles contain the same files, but 0100000000000822 is used on retail units while 010000000000B22B is used for development.

These titles contain the following files:

  • ExpectVersionInfo.csv - List in the format "[device],[type],[version]" where "device" can be "JoyLeft", "JoyRight", "FullKey" or "Palma", "type" can be "BT", "MCU" or "USB" and "version" is the hexadecimal representation of the firmware file's version.
  • FirmwareInfo.csv - List in the format "[device],[type],[version],[file]" where "device", "type" and "version" should match the values from "ExpectVersionInfo" and "file" is the name of the firmware file.
  • ukyosakyo_ep2_ota.bin - Left/Right Joy-Con BT firmware.
  • raizo_ep2_ota.bin - Pro Controller BT firmware.
  • tera_ota.bin - Right Joy-Con MCU firmware.
  • tera_ota_iap.bin - Right Joy-Con MCU (IAP profile) firmware.
  • tera_fullkey_ota.bin - Pro Controller MCU firmware.
  • tera_fullkey_ota_iap.bin - Pro Controller MCU (IAP profile) firmware.
  • [6.0.0+] ProController.dfu - Pro Controller USB firmware.
  • [6.1.0+] PalmaFw.bin - Poké Ball Plus BT firmware.