HID services: Difference between revisions
(45 intermediate revisions by 3 users not shown) | |||
Line 192: | Line 192: | ||
| 404 || [4.0.0+] HasLeftRightBattery | | 404 || [4.0.0+] HasLeftRightBattery | ||
|- | |- | ||
| 405 || [4.0.0+] GetNpadInterfaceType | | 405 || [4.0.0+] [[#GetNpadInterfaceType]] | ||
|- | |- | ||
| 406 || [4.0.0+] GetNpadLeftRightInterfaceType | | 406 || [4.0.0+] GetNpadLeftRightInterfaceType | ||
|- | |||
| 407 || [9.0.0+] GetNpadOfHighestBatteryLevelForJoyLeft | |||
|- | |||
| 408 || [9.0.0+] GetNpadOfHighestBatteryLevelForJoyRight | |||
|- | |- | ||
| 500 || [5.0.0+] GetPalmaConnectionHandle | | 500 || [5.0.0+] GetPalmaConnectionHandle | ||
Line 259: | Line 263: | ||
|- | |- | ||
| 1001 || GetNpadCommunicationMode | | 1001 || GetNpadCommunicationMode | ||
|- | |||
| 1002 || [9.0.0+] SetTouchScreenConfiguration | |||
|- | |||
| 1003 || [9.0.0+] IsFirmwareUpdateNeededForNotification | |||
|} | |} | ||
Line 265: | Line 273: | ||
== SetSupportedNpadStyleSet == | == SetSupportedNpadStyleSet == | ||
Takes an u32 [[#NpadStyleTag]]. | Takes a PID-descriptor, an u32 [[#NpadStyleTag]], and an u64 [[AM_services|AppletResourceUserId]], no output. | ||
== GetSupportedNpadStyleSet == | == GetSupportedNpadStyleSet == | ||
Takes a PID-descriptor and an u64 [[AM_services|AppletResourceUserId]], returns an u32 [[#NpadStyleTag]]. | |||
== SetSupportedNpadIdType == | == SetSupportedNpadIdType == | ||
Line 276: | Line 284: | ||
== 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. | ||
Line 321: | Line 329: | ||
== IsVibrationDeviceMounted == | == IsVibrationDeviceMounted == | ||
Takes a | Takes a PID, an [[#VibrationDeviceHandle]], and an u64 [[AM_services|AppletResourceUserId]], returns an output u8 bool. | ||
== ActivateSevenSixAxisSensor == | == ActivateSevenSixAxisSensor == | ||
Line 348: | Line 356: | ||
== ResetSevenSixAxisSensorTimestamp == | == ResetSevenSixAxisSensorTimestamp == | ||
Takes a PID and an u64 [[AM_services|AppletResourceUserId]], no output. | Takes a PID and an u64 [[AM_services|AppletResourceUserId]], no output. | ||
== GetNpadInterfaceType == | |||
Takes an input u32 NpadIdType, returns an output u8 [[#NpadInterfaceType]]. | |||
The NpadInterfaceType must be 1-4, otherwise this will assert. | |||
== VibrationDeviceHandle == | == VibrationDeviceHandle == | ||
Line 421: | Line 434: | ||
| 7 | | 7 | ||
| NpadLark | | NpadLark | ||
| NES controller. | | NES/Famicom controller. | ||
|- | |- | ||
| 8 | | 8 | ||
| NpadHandheldLark | | NpadHandheldLark | ||
| NES controller in handheld mode. | | NES/Famicom controller in handheld mode. | ||
|- | |- | ||
| 9 | | 9 | ||
| NpadLucia | | NpadLucia | ||
| | | SNES controller. | ||
|- | |- | ||
| 10-28 | | 10-28 | ||
Line 437: | Line 450: | ||
| 29 | | 29 | ||
| NpadSystemExt | | NpadSystemExt | ||
| | | Generic external controller. | ||
|- | |- | ||
| 30 | | 30 | ||
| NpadSystem | | NpadSystem | ||
| | | Generic controller. | ||
|- | |- | ||
| 31 | | 31 | ||
Line 450: | Line 463: | ||
== NpadIdType == | == NpadIdType == | ||
This is an u32. This is the controller index used in [[HID_Shared_Memory#Controllers|sharedmem]]. 0x20 is handheld. | This is an u32. This is the controller index used in [[HID_Shared_Memory#Controllers|sharedmem]]. 0x20 is handheld. | ||
== NpadInterfaceType == | |||
This is the output u8 returned by [[#GetNpadInterfaceType]]. | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
! Notes | |||
|- | |||
| 1 || Bluetooth || | |||
|- | |||
| 2 || Rail || | |||
|- | |||
| 3 || USB || | |||
|- | |||
| 4 || Unknown || | |||
|} | |||
= hid:dbg = | = hid:dbg = | ||
Line 469: | Line 499: | ||
|- | |- | ||
| 12 || UnsetTouchScreenAutoPilotState | | 12 || UnsetTouchScreenAutoPilotState | ||
|- | |||
| 13 || [9.0.0+] GetTouchScreenConfiguration | |||
|- | |- | ||
| 20 || DeactivateMouse | | 20 || DeactivateMouse | ||
Line 488: | Line 520: | ||
| 52 || UnsetXpadAutoPilotState | | 52 || UnsetXpadAutoPilotState | ||
|- | |- | ||
| 60 || DeactivateJoyXpad | | 53 ([1.0.0-8.1.0] 60) || [[#DeactivateJoyXpad]] | ||
|- | |||
| 60 || [9.0.0+] ClearNpadSystemCommonPolicy | |||
|- | |- | ||
| 91 || DeactivateGesture | | 91 || DeactivateGesture | ||
Line 578: | Line 612: | ||
| 224 || [5.0.0+] [[#UpdateDesignInfo]] | | 224 || [5.0.0+] [[#UpdateDesignInfo]] | ||
|- | |- | ||
| 225 || [5.0.0+] GetUniquePadDriverState | | 225 || [5.0.0+] [[#GetUniquePadDriverState]] | ||
|- | |- | ||
| 226 || [5.0.0+] GetSixAxisSensorDriverStates | | 226 || [5.0.0+] [[#GetSixAxisSensorDriverStates]] | ||
|- | |- | ||
| 227 || [5.0.0+] GetRxPacketHistory | | 227 || [5.0.0+] GetRxPacketHistory | ||
Line 588: | Line 622: | ||
| 229 || [6.0.0+] [[#ReadSerialFlash]] | | 229 || [6.0.0+] [[#ReadSerialFlash]] | ||
|- | |- | ||
| 230 || [6.0.0+] WriteSerialFlash | | 230 || [6.0.0+] [[#WriteSerialFlash]] | ||
|- | |- | ||
| 231 || [6.0.0+] GetOperationResult | | 231 || [6.0.0+] GetOperationResult | ||
Line 596: | Line 630: | ||
| 233 || [6.0.0+] ClearPairingInfo | | 233 || [6.0.0+] ClearPairingInfo | ||
|- | |- | ||
| 234 || [6.0.0+] GetUniquePadDeviceTypeSetInternal | | 234 || [6.0.0+] [[#GetUniquePadDeviceTypeSetInternal]] | ||
|- | |- | ||
| 235 || [7.0.0+] EnableAnalogStickPower | | 235 || [7.0.0+] EnableAnalogStickPower | ||
|- | |- | ||
| | | 236 || [9.0.0+] RequestKuinaUartClockCal | ||
|- | |- | ||
| | | 237 || [9.0.0+] GetKuinaUartClockCal | ||
|- | |- | ||
| | | 238 || [9.0.0+] SetKuinaUartClockTrim | ||
|- | |- | ||
| | | 239 || [9.0.0+] KuinaLoopbackTest | ||
|- | |- | ||
| | | 240 || [9.0.0+] RequestBatteryVoltage | ||
|- | |- | ||
| | | 241 || [9.0.0+] GetBatteryVoltage | ||
|- | |- | ||
| | | 242 || [9.0.0+] GetUniquePadPowerInfo | ||
|- | |- | ||
| | | 243 || [9.0.0+] RebootUniquePad | ||
|- | |- | ||
| | | 244 || [9.0.0+] RequestKuinaFirmwareVersion | ||
|- | |- | ||
| | | 245 || [9.0.0+] GetKuinaFirmwareVersion | ||
|- | |- | ||
| 328 || [7.0.0+] [[#ApplyHdlsNpadAssignmentState]] | | 246 || [9.0.0+] GetVidPid | ||
|- | |||
| 301 || [5.0.0-8.1.0] [[#GetAbstractedPadHandles]] | |||
|- | |||
| 302 || [5.0.0-8.1.0] [[#GetAbstractedPadState]] | |||
|- | |||
| 303 || [5.0.0-8.1.0] [[#GetAbstractedPadsState]] | |||
|- | |||
| 321 || [5.0.0-8.1.0] [[#SetAutoPilotVirtualPadState]] | |||
|- | |||
| 322 || [5.0.0-8.1.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]] | | 329 || [7.0.0+] [[#ApplyHdlsStateList]] | ||
Line 639: | Line 695: | ||
|- | |- | ||
| 501 || [8.0.0+] IsFactoryBootEnabled | | 501 || [8.0.0+] IsFactoryBootEnabled | ||
|- | |||
| 550 || [9.0.0+] SetAnalogStickModelDataTemporarily | |||
|- | |||
| 551 || [9.0.0+] GetAnalogStickModelData | |||
|- | |||
| 552 || [9.0.0+] ResetAnalogStickModelData | |||
|} | |} | ||
Line 674: | Line 736: | ||
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. | 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. | ||
== GetUniquePadDriverState == | |||
Takes a total of 8-bytes of input, returns a total of 0x20-bytes of output. | |||
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 0x18-bytes of output. | |||
== GetSixAxisSensorDriverStates == | |||
Takes a total of 8-bytes of input and a type-0xA 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. | |||
== ReadSerialFlash == | == ReadSerialFlash == | ||
Line 681: | Line 753: | ||
This doesn't seem to be usable? | This doesn't seem to be usable? | ||
== WriteSerialFlash == | |||
Takes an input TransferMemory handle, an input u32 offset, an input u64 tmem_size, an input u64 size, and an u64 '''UniquePadId''', no output. | |||
Writes to the specified controller's spi-flash. The TransferMemory permissions is R--. | |||
== GetUniquePadDeviceTypeSetInternal == | |||
Takes an input u64 '''UniquePadId''', returns an [[#DeviceTypeInternal]]. | |||
== GetAbstractedPadHandles == | == GetAbstractedPadHandles == | ||
Line 749: | Line 829: | ||
Takes an input [[#HdlsState]] and an input 8-byte '''HdlsHandle''', no output. | Takes an input [[#HdlsState]] and an input 8-byte '''HdlsHandle''', no output. | ||
[9.0.0+] Input order was swapped: now takes an input 8-byte '''HdlsHandle''' and a [[#HdlsState]], no output. | |||
== AbstractedPadState == | == AbstractedPadState == | ||
Line 757: | Line 836: | ||
! Offset || Size || Description | ! Offset || Size || Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x4 || Type, only 1 bit can be set. Converted to [[#HdlsDeviceInfo]]::type internally by [[#SetAutoPilotVirtualPadState]]. | ||
| | |- | ||
| 0x4 || 0x1 || Flags. [[#SetAutoPilotVirtualPadState]] only uses bit0: when clear it will skip using the rest of the input and run [[#UnsetAutoPilotVirtualPadState]] internally. | |||
|- | |||
| 0x5 || 0x3 || Padding | |||
|- | |||
| 0x8 || 0x4 || RGBA Single Body Color | |||
|- | |||
| 0xC || 0x4 || RGBA Single Buttons Color | |||
|- | |- | ||
| 0x10 || 0x1 || See [[#HiddbgHdlsDeviceInfo]]::[[#NpadInterfaceType]]. | |||
|- | |- | ||
| | | 0x11 || 0x3 || Padding | ||
|- | |- | ||
| | | 0x14 || 0x24 || [[#HdlsState]]. Unknown if the last 4-bytes are included in this struct, [[#SetAutoPilotVirtualPadState]]/[[#hiddbgGetAbstractedPadsState]] only uses the first 0x20-bytes. | ||
|- | |- | ||
| | | 0x38 || 0x60 || Unused with [[#SetAutoPilotVirtualPadState]]/[[#GetAbstractedPadsState]]. | ||
|} | |} | ||
Normally the input state is merged with an existing controller selected by Type. However in some cases (BIT(2-5) with type2!=0x2 and BIT(31)) it's detected as a dedicated controller. | |||
Type: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | |||
! [[#HdlsDeviceInfo]]::type bits | |||
! Description | |||
! Notes | |||
|- | |- | ||
| 0 || 0 || || | |||
|- | |- | ||
| | | 1 || 15 || || [[#DeviceType]] |= BIT(1) | ||
|- | |- | ||
| | | 2 || 1 || || | ||
|- | |- | ||
| | | 3 || 2 || || | ||
|- | |- | ||
| | | 4 || 1 || || | ||
| | |||
|- | |- | ||
| 5 || 2 || || | |||
|- | |- | ||
| | | 6 || 3 || || | ||
|- | |- | ||
| | | 7 || 11 || || [[#DeviceType]] |= BIT(11) | ||
|- | |- | ||
| | | 8 || 12 || || [[#DeviceType]] |= BIT(12) | ||
|- | |- | ||
| | | 9 || 13 || || [[#DeviceType]] |= BIT(13) | ||
|- | |||
| 10 || 14 || || [[#DeviceType]] |= BIT(14) | |||
|- | |||
| 11 || 15 || || [[#DeviceType]] |= BIT(11) | |||
|- | |||
| 12 || 12 || || [[#DeviceType]] |= BIT(12) | |||
|- | |||
| 13 || 13 || || [[#DeviceType]] |= BIT(13) | |||
|- | |||
| 14 || 14 || || [[#DeviceType]] |= BIT(14) | |||
|- | |||
| 15 || 17 || || | |||
|- | |||
| 31 || 21 || || [[#DeviceType]] = BIT(31) | |||
|- | |- | ||
|} | |} | ||
The above "[[#DeviceType]] |=" notes only apply when type2 is 0x2. | |||
== HdlsNpadAssignment == | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
| | ! Offset || Size || Description | ||
| | |||
| | |||
|- | |- | ||
| | | 0x0 || 0x4 || s32 Total entries | ||
| | |||
| | |||
|- | |- | ||
| | | 0x4 || 0x4 || Padding | ||
| | |||
| | |||
|- | |- | ||
| | | 0x8 || 0x200(0x20*0x10) || Array of [[#HdlsNpadAssignmentEntry]]. | ||
| | |} | ||
| | |||
This is a 0x208-byte struct. | |||
=== HdlsNpadAssignmentEntry === | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |- | ||
| | | 0x0 || 0x8 || HdlsHandle | ||
| | |||
| | |||
|- | |- | ||
| | | 0x8 || 0x4 || ? | ||
| | |||
| | |||
|- | |- | ||
| | | 0xC || 0x4 || ? | ||
| | |||
| | |||
|- | |- | ||
| | | 0x10 || 0x8 || ? | ||
| | |||
| | |||
|- | |- | ||
| | | 0x18 || 0x1 || ? | ||
| | |||
| | |||
|- | |- | ||
| | | 0x19 || 0x7 || Padding | ||
| | |||
| | |||
|} | |} | ||
== | This is a 0x20-byte struct. | ||
== HdlsStateList == | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset || Size || Description | ! Offset || Size || Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x4 || s32 Total entries | ||
|- | |- | ||
| | | 0x4 || 0x4 || Padding | ||
|- | |- | ||
| | | 0x8 || <[[#HdlsStateListEntry]] size>*0x10 || Array of [[#HdlsStateListEntry]]. | ||
|} | |||
This is a 0x408-byte struct. [9.0.0+] This is a 0x488-byte struct. | |||
This contains a list of all controllers, including non-virtual controllers. | |||
=== HdlsStateListEntry === | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || HdlsHandle | ||
|- | |- | ||
| | | 0x8 || [[#HdlsDeviceInfo]] size || [[#HdlsDeviceInfo]]. With [[#ApplyHdlsStateList]] this is only used when creating new devices. | ||
|- | |- | ||
| | | 0x8 + [[#HdlsDeviceInfo]] size, with 8-byte alignment || 0x24 || [[#HdlsState]] | ||
|- | |- | ||
| | | <Immediately following the above> || 0x4 || Padding | ||
|} | |} | ||
This is a | This is a 0x40-byte struct. [9.0.0+] This is a 0x48-byte struct. | ||
This is | |||
== HdlsDeviceInfo == | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || [[#DeviceTypeInternal]] | ||
|- | |- | ||
| | | 0x4 || 0x4 || RGBA Single Body Color | ||
|- | |- | ||
| | | 0x8 || 0x4 || RGBA Single Buttons Color | ||
|- | |- | ||
| | | 0xC || 0x1 || [[#NpadInterfaceType]]. 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 bit21: value 0x3 = unknown. When value is 0x2, state is merged with an existing controller (when the type value is compatible with this). Otherwise, it's a dedicated controller. | ||
|- | |- | ||
| | | 0xD || 0x3 || Padding | ||
|} | |||
[9.0.0+]: | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x1 || [[#DeviceTypeInternal]] | ||
|- | |- | ||
| | | 0x1 || 0x1 || [[#NpadInterfaceType]]. Similar to the field from the old struct. | ||
|- | |- | ||
| | | 0x2 || 0x2 || Padding | ||
|- | |- | ||
| | | 0x4 || 0x4 || RGBA Single Body Color | ||
|- | |- | ||
| | | 0x8 || 0x4 || RGBA Single Buttons Color | ||
|- | |- | ||
| | | 0xC || 0x4 || RGBA Unknown Body Color | ||
|- | |- | ||
| | | 0x10 || 0x4 || RGBA Unknown Buttons Color | ||
|} | |||
This is a 0x10-byte struct. [9.0.0+] This is a 0x14-byte struct. | |||
== DeviceTypeInternal == | |||
This is an u32 "nn::hid::detail::DeviceTypeInternal". | |||
[9.0.0+] This an u8 "nn::hidtypes::DeviceType". | |||
Bits for "nn::hid::detail::DeviceTypeInternal", only 1 bit can be set: | |||
{| class="wikitable" border="1" | |||
! 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 left controller | |||
|- | |- | ||
| | | 12 | ||
| | |||
| Famicom right controller (with microphone) | |||
|- | |- | ||
| | | 13 | ||
| | |||
| NES left controller | |||
|- | |- | ||
| | | 14 | ||
| | |||
| NES right controller | |||
|- | |- | ||
| | | 15-16 | ||
| | |||
| Invalid | |||
|- | |- | ||
| | | 17 | ||
| | |||
| Generic external controller | |||
|- | |- | ||
| | | 18-20 | ||
| | |||
| Invalid | |||
|- | |- | ||
| | | 21-23 | ||
| | |||
| Generic controller | |||
|} | |||
u8 values for "nn::hidtypes::DeviceType", must match one of the these values: | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
! Notes | |||
|- | |- | ||
| | | 1 || JoyRight || | ||
|- | |- | ||
| | | 2 || JoyLeft || | ||
|- | |- | ||
| | | 3 || FullKey || | ||
|- | |- | ||
| | | 4 || JoyLeft || | ||
|- | |- | ||
| | | 5 || JoyRight || | ||
|- | |- | ||
| | | 6 || FullKey || | ||
|- | |- | ||
| | | 7 || LarkLeft (HVC) || | ||
|- | |- | ||
| | | 8 || LarkRight (HVC) || | ||
|- | |- | ||
| | | 9 || LarkLeft (NES) || | ||
|- | |- | ||
| | | 10 || LarkRight (NES) || | ||
|- | |- | ||
| | | 11 || Invalid || | ||
|- | |- | ||
| | | 12 || Palma || | ||
|- | |- | ||
| | | 13 || FullKey || | ||
|- | |- | ||
| | | 14 || Invalid || | ||
|- | |- | ||
| | | 15 || FullKey || | ||
|- | |- | ||
| | | 16 || Controller is missing in sharedmem. | ||
|- | |- | ||
| | | 17-18 || Invalid || | ||
|- | |- | ||
| | | 19 || [[#DeviceType]] System with [[#NpadStyleTag]] |= NpadFullKey | ||
|- | |- | ||
| | | 20 || [[#DeviceType]] System with [[#NpadStyleTag]] |= NpadJoyDual | ||
|- | |- | ||
| | | 21 || [[#DeviceType]] System with [[#NpadStyleTag]] |= NpadJoyDual | ||
|} | |||
== HdlsState == | |||
Pre-9.0.0: | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x1 || powerConnected for the main [[HID_Shared_Memory#Controllers|PowerInfo]]. | ||
|- | |- | ||
| | | 0x1 || 0x1 || ORRed with powerConnected to set the value of the first byte for the controller [[HID_Shared_Memory#Flags|flags]]. | ||
|- | |- | ||
| | | 0x2 || 0x6 || Unknown | ||
|- | |- | ||
| | | 0x8 || 0x4 || batteryCharge for the main [[HID_Shared_Memory#Controllers|PowerInfo]]. | ||
|- | |- | ||
| | | 0xC || 0x4 || [[HID_Shared_Memory#Button_State|Buttons]]. Bit18 = HOME and bit19 = Capture. | ||
|- | |- | ||
| | | 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 | ||
|} | |||
[9.0.0+]: | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || batteryCharge for the main [[HID_Shared_Memory#Controllers|PowerInfo]]. | ||
|- | |- | ||
| | | 0x4 || 0x4 || Unknown | ||
|- | |- | ||
| | | 0x8 || 0x8 || [[HID_Shared_Memory#Button_State|Buttons]], masked with 0xfffffffff00fffff. See above table regarding HOME/Capture 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". | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! 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 | ||
|- | |- | ||
| | | 313 || [9.0.0+] GetNpadCaptureButtonAssignment | ||
|- | |- | ||
| | | 314 || [9.0.0+] GetAppletFooterUiType | ||
|- | |- | ||
| | | 315 || [9.0.0+] GetAppletDetailedUiType | ||
|- | |- | ||
| | | 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 | ||
|- | |- | ||
| | | 522 || [9.0.0+] SetJoyConRailEnabled | ||
|- | |- | ||
| | | 523 || [9.0.0+] IsJoyConRailEnabled | ||
|- | |- | ||
| | | 540 || AcquirePlayReportControllerUsageUpdateEvent | ||
|- | |- | ||
| 1150 || [8.0.0+] SetTouchScreenMagnification | | 541 || GetPlayReportControllerUsages | ||
|} | |- | ||
| 542 || AcquirePlayReportRegisteredDeviceUpdateEvent | |||
== GetUniquePadsFromNpad == | |- | ||
Takes an input u32 [[#NpadIdType]], a type-0xA output buffer, and returns an output | | 543 || GetRegisteredDevicesOld ([1.0.0-4.1.0] GetRegisteredDevices) | ||
|- | |||
The output buffer contains an array of u64 '''UniquePadId'''. | | 544 || [3.0.0+] AcquireConnectionTriggerTimeoutEvent | ||
|- | |||
== SetVibrationMasterVolume == | | 545 || [3.0.0+] SendConnectionTrigger | ||
Takes an input 32bit float. | |- | ||
| 546 || [3.0.0+] AcquireDeviceRegisteredEventForControllerSupport | |||
== GetUniquePadIds == | |- | ||
Takes a type-0xA output buffer, and returns an output | | 547 || [3.0.0+] GetAllowedBluetoothLinksCount | ||
|- | |||
The output buffer contains an array of u64 '''UniquePadId'''. | | 548 || [5.0.0+] GetRegisteredDevices | ||
|- | |||
== NotifyInputDetector == | | 549 || [6.0.0+] GetConnectableRegisteredDevices | ||
Takes an input u32 bitmask InputSourceId, no output. | |- | ||
| 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]] | |||
|- | |||
| 831 || [9.0.0+] [[#SetNotificationLedPatternWithTimeout]] | |||
|- | |||
| 832 || [9.0.0+] [[#PrepareHidsForNotificationWake]] | |||
|- | |||
| 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 | |||
|- | |||
| 1151 || [9.0.0+] GetTouchScreenFirmwareVersion | |||
|- | |||
| 1152 || [9.0.0+] SetTouchScreenDefaultConfiguration | |||
|- | |||
| 1153 || [9.0.0+] GetTouchScreenDefaultConfiguration | |||
|- | |||
| 1154 || [9.0.0+] IsFirmwareAvailableForNotification | |||
|- | |||
| 1155 || [9.0.0+] SetForceHandheldStyleVibration | |||
|- | |||
| 1156 || [9.0.0+] SendConnectionTriggerWithoutTimeoutEvent | |||
|} | |||
== GetMaskedSupportedNpadStyleSet == | |||
Takes an input u64 AppletResourceUserId, returns an output u32 [[#NpadStyleTag]]. | |||
Official sw uses the output from [[Applet_Manager_services|GetAppletResourceUserIdOfCallerApplet]] with this. | |||
== GetUniquePadsFromNpad == | |||
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'''. | |||
== SetVibrationMasterVolume == | |||
Takes an input 32bit float. | |||
== GetUniquePadIds == | |||
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'''. | |||
== 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 [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md#subcommand-0x38-set-home-light subcommand]. | |||
== 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. | |||
== | |||
Takes | |||
== GetHidbusSystemServiceObject == | == GetHidbusSystemServiceObject == | ||
Line 1,323: | Line 1,629: | ||
| 0 | | 0 | ||
| FullKey | | FullKey | ||
| Pro Controller. | | Pro Controller and Gc controller. | ||
|- | |- | ||
| 1 | | 1 | ||
Line 1,331: | Line 1,637: | ||
| 2 | | 2 | ||
| HandheldLeft | | HandheldLeft | ||
| Joy-Con left controller in handheld mode. | | Joy-Con/Famicom/NES left controller in handheld mode. | ||
|- | |- | ||
| 3 | | 3 | ||
| HandheldRight | | HandheldRight | ||
| Joy-Con right controller in handheld mode. | | Joy-Con/Famicom/NES right controller in handheld mode. | ||
|- | |- | ||
| 4 | | 4 | ||
| JoyLeft | | JoyLeft | ||
| Joy-Con left controller | | Joy-Con left controller. | ||
|- | |- | ||
| 5 | | 5 | ||
| JoyRight | | JoyRight | ||
| Joy-Con right controller | | Joy-Con right controller. | ||
|- | |- | ||
| 6 | | 6 | ||
Line 1,350: | Line 1,656: | ||
|- | |- | ||
| 7 | | 7 | ||
| | | LarkLeft (HVC) | ||
| Famicom controller. | | Famicom left controller. | ||
|- | |- | ||
| 8 | | 8 | ||
| | | LarkRight (HVC) | ||
| Famicom controller | | Famicom right controller (with microphone). | ||
|- | |- | ||
| 9 | | 9 | ||
| | | LarkLeft (NES) | ||
| NES controller. | | NES left controller. | ||
|- | |- | ||
| 10 | | 10 | ||
| | | LarkRight (NES) | ||
| NES controller | | NES right controller. | ||
|- | |- | ||
| 11-14 | | 11-14 | ||
| | | | ||
| | | Reserved | ||
|- | |- | ||
| 15 | | 15 | ||
| | | SystemExt | ||
| | | Generic external controller. | ||
|- | |- | ||
| 16-30 | | 16-30 | ||
| | | | ||
| | | Reserved | ||
|- | |- | ||
| 31 | | 31 | ||
| | | System | ||
| | | Generic controller. | ||
|} | |} | ||
Line 1,565: | Line 1,871: | ||
This is "nn::ahid::IServerSession". | This is "nn::ahid::IServerSession". | ||
Used for USB HID devices. | Used for USB HID devices. | ||
This service no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,571: | Line 1,879: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 0 || || Takes an input s32, no output. | | 0 || AcquireDevice || Takes an input s32, no output. | ||
|- | |- | ||
| 1 || || Takes an input s32, no output. | | 1 || ReleaseDevice || Takes an input s32, no output. | ||
|- | |- | ||
| 2 || || Takes an input u32, returns an [[#ICtrlSession]]. | | 2 || GetCtrlSession || Takes an input u32, returns an [[#ICtrlSession]]. | ||
|- | |- | ||
| 3 || || Takes an input u32, returns an [[#IReadSession]]. | | 3 || GetReadSession || Takes an input u32, returns an [[#IReadSession]]. | ||
|- | |- | ||
| [1.0.0-2.3.0] 4 || || Takes an input u32, returns an [[#IWriteSession]]. | | [1.0.0-2.3.0] 4 || GetWriteSession || Takes an input u32, returns an [[#IWriteSession]]. | ||
|} | |} | ||
== ICtrlSession == | == ICtrlSession == | ||
This is "nn::ahid::ICtrlSession". | This is "nn::ahid::ICtrlSession". | ||
This no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,589: | Line 1,899: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 0 || || | | 0 || GetString || | ||
|- | |- | ||
| 1 || || | | 1 || GetCodeBook || | ||
|- | |- | ||
| 2 || || | | 2 || GetReport || | ||
|- | |- | ||
| 3 || || | | 3 || SetReport || | ||
|- | |- | ||
| 4 || || | | 4 || GetIdle || | ||
|- | |- | ||
| 5 || || | | 5 || SetIdle || | ||
|- | |- | ||
| 6 || || | | 6 || GetProtocol || | ||
|- | |- | ||
| 7 || || | | 7 || SetProtocol || | ||
|- | |- | ||
| 8 || || | | 8 || GetDescriptor || | ||
|- | |- | ||
| 9 || || | | 9 || SetDescriptor || | ||
|- | |- | ||
| 10 || || | | 10 || GetStateChangeEvent || | ||
|- | |- | ||
| 11 || || | | 11 || SignalStateChangeEvent || | ||
|- | |- | ||
| 12 || [3.0.0+] || | | 12 || [3.0.0+] Write || | ||
|} | |} | ||
Line 1,620: | Line 1,930: | ||
== IReadSession == | == IReadSession == | ||
This is "nn::ahid::IReadSession". | This is "nn::ahid::IReadSession". | ||
This no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,625: | Line 1,937: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 0 || || | | 0 || Read || | ||
|} | |} | ||
Line 1,641: | Line 1,953: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 0 || || This is the inverse of [[#IReadSession]] cmd0. Uses the OUTPUT endpoint with an input buffer. | | 0 || Write || This is the inverse of [[#IReadSession]] cmd0. Uses the OUTPUT endpoint with an input buffer. | ||
|} | |} | ||
Line 1,648: | Line 1,960: | ||
Used internally for USB HID devices. | Used internally for USB HID devices. | ||
This service no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,653: | Line 1,967: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || | | 0 || GetDeviceEntries | ||
|- | |- | ||
| 1 || | | 1 || GetDeviceList | ||
|- | |- | ||
| 2 || | | 2 || GetDeviceParameters | ||
|- | |- | ||
| 3 || | | 3 || AttachDevice | ||
|- | |- | ||
| 4 || | | 4 || DetachDevice | ||
|- | |- | ||
| 5 || [6.0.0+] | | 5 || [6.0.0+] SetDeviceFilter | ||
|} | |} | ||
Line 1,765: | Line 2,079: | ||
These are firmware files for the touchscreen controller. | These are firmware files for the touchscreen controller. | ||
[9.0.0+] The hid-sysmodule RomFS now contains: | |||
ftmFwUpdate | |||
├── FTS_00120100.fts256 | |||
├── FTS_32000001.fts256 | |||
├── FTS_32000102.fts256 | |||
├── FTS_32000302.fts256 | |||
└── FTS_32000402.fts256 | |||
= Firmware update = | = Firmware update = | ||
Line 1,770: | Line 2,092: | ||
These titles contain the following files: | These titles contain the following files: | ||
* '''ExpectVersionInfo.csv''' - List in the format "[device],[type],[version]" where "device" can be "JoyLeft", "JoyRight", "FullKey" or " | * '''ExpectVersionInfo.csv''' - List in the format "[device],[type],[version]" where "device" can be "JoyLeft", "JoyRight", "FullKey", "Palma" or "Handheld", "type" can be "BT", "MCU", "USB" or "SioH" 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. | * '''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. | * '''ukyosakyo_ep2_ota.bin''' - Left/Right Joy-Con BT firmware. | ||
Line 1,780: | Line 2,102: | ||
* [6.0.0+] '''ProController.dfu''' - Pro Controller USB firmware. | * [6.0.0+] '''ProController.dfu''' - Pro Controller USB firmware. | ||
* [6.1.0+] '''PalmaFw.bin''' - Poké Ball Plus BT firmware. | * [6.1.0+] '''PalmaFw.bin''' - Poké Ball Plus BT firmware. | ||
* [9.0.0+] '''ExpectVersionInfo-platform.hoag.csv''' - Same as "ExpectVersionInfo.csv" but for the Switch Lite platform. | |||
* [9.0.0+] '''FirmwareInfo-platform.hoag.csv''' - Same as "FirmwareInfo.csv" but for the Switch Lite platform. | |||
* [9.0.0+] '''sioh.bin''' - Switch Lite Joy-Con firmware. | |||
* [9.0.0+] '''sioh_iap.bin''' - Switch Lite Joy-Con (IAP profile) firmware. | |||
[[Category:Services]] | [[Category:Services]] |