HID services: Difference between revisions
No edit summary |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 281: | Line 281: | ||
|- | |- | ||
| 2000 || [10.0.0+] [[#ActivateDigitizer]] | | 2000 || [10.0.0+] [[#ActivateDigitizer]] | ||
|- | |||
| 3000 || [15.0.0+] GetDebugPadGenericPadMap | |||
|- | |||
| 3001 || [15.0.0+] SetDebugPadGenericPadMap | |||
|- | |||
| 3002 || [15.0.0+] ResetDebugPadGenericPadMap | |||
|- | |||
| 3003 || [15.0.0+] GetDebugPadKeyboardMap | |||
|- | |||
| 3004 || [15.0.0+] SetDebugPadKeyboardMap | |||
|- | |||
| 3005 || [15.0.0+] ResetDebugPadKeyboardMap | |||
|- | |||
| 3006 || [15.0.0+] GetFullKeyGenericPadMap | |||
|- | |||
| 3007 || [15.0.0+] SetFullKeyGenericPadMap | |||
|- | |||
| 3008 || [15.0.0+] ResetFullKeyGenericPadMap | |||
|- | |||
| 3009 || [15.0.0+] GetFullKeyKeyboardMap | |||
|- | |||
| 3010 || [15.0.0+] SetFullKeyKeyboardMap | |||
|- | |||
| 3011 || [15.0.0+] ResetFullKeyKeyboardMap | |||
|} | |} | ||
Line 1,019: | Line 1,043: | ||
|- | |- | ||
| 136 || [3.0.0+] GetShiftGyroscopeCalibrationValue | | 136 || [3.0.0+] GetShiftGyroscopeCalibrationValue | ||
|- | |||
| 137 || [15.0.0+] SetSixAxisSensorMode | |||
|- | |- | ||
| 140 || [3.0.0+] DeactivateConsoleSixAxisSensor | | 140 || [3.0.0+] DeactivateConsoleSixAxisSensor | ||
Line 1,262: | Line 1,288: | ||
== GetFirmwareVersion == | == GetFirmwareVersion == | ||
Takes | Takes an input [[#NpadIdType]] and an input [[#DeviceType]]. Returns an output [[#FirmwareVersion]]. | ||
[ | |||
== GetDestinationFirmwareVersion == | == GetDestinationFirmwareVersion == | ||
Takes | Takes an input [[#NpadIdType]] and an input [[#DeviceType]]. Returns an output [[#FirmwareVersion]]. | ||
[ | |||
== DiscardFirmwareInfoCacheForRevert == | == DiscardFirmwareInfoCacheForRevert == | ||
Takes | Takes an input [[#NpadIdType]] and an input [[#DeviceType]]. Returns a total of 5-bytes of output. | ||
[3.0.0+] No input/output. | [3.0.0+] No input/output. | ||
Line 1,429: | Line 1,451: | ||
|- | |- | ||
| 31 || [[#SendKeyboardLockKeyEvent_2|SendKeyboardLockKeyEvent]] | | 31 || [[#SendKeyboardLockKeyEvent_2|SendKeyboardLockKeyEvent]] | ||
|- | |||
| 32 || [15.0.0+] SetSystemKeyboardState | |||
|- | |||
| 33 || [15.0.0+] UnsetSystemKeyboardState | |||
|- | |- | ||
| 101 || [[#AcquireHomeButtonEventHandle]] | | 101 || [[#AcquireHomeButtonEventHandle]] | ||
Line 1,693: | Line 1,719: | ||
|- | |- | ||
| 1134 || [6.0.0+] GetUsbFirmwareUpdateState | | 1134 || [6.0.0+] GetUsbFirmwareUpdateState | ||
|- | |||
| 1135 || [15.0.0+] InitializeUsbFirmwareUpdateWithoutMemory | |||
|- | |- | ||
| 1150 || [8.0.0+] SetTouchScreenMagnification | | 1150 || [8.0.0+] SetTouchScreenMagnification | ||
Line 1,897: | Line 1,925: | ||
The specified controller must have a HOME button. | 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 | This sends [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md#subcommand-0x38-set-home-light subcommand 0x38] to the specified controller, for setting the pattern for the HOME button notification LED. The input structure is converted to the format as follows: <code>((u8*)cmd_argdata)[pos] = u8_in[pos2] | u8_in[pos3]<<4;</code> 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 0x1D-bytes of cmd_argdata initialized from this. | ||
The layout of cmd_argdata is as follows: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x1 || <nowiki>((TimeUnit & 0xF) | ((FrameCount & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x1 || 0x1 || <nowiki>((CycleCount & 0xF) | ((InitialBrightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x2 || 0x1 || <nowiki>((Frame2Brightness & 0xF) | ((Frame1Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x3 || 0x1 || <nowiki>((Frame1TimeToHold & 0xF) | ((Frame1TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x4 || 0x1 || <nowiki>((Frame2TimeToHold & 0xF) | ((Frame2TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x5 || 0x1 || <nowiki>((Frame4Brightness & 0xF) | ((Frame3Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x6 || 0x1 || <nowiki>((Frame3TimeToHold & 0xF) | ((Frame3TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x7 || 0x1 || <nowiki>((Frame4TimeToHold & 0xF) | ((Frame4TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x8 || 0x1 || <nowiki>((Frame6Brightness & 0xF) | ((Frame5Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x9 || 0x1 || <nowiki>((Frame5TimeToHold & 0xF) | ((Frame5TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0xA || 0x1 || <nowiki>((Frame6TimeToHold & 0xF) | ((Frame6TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0xB || 0x1 || <nowiki>((Frame8Brightness & 0xF) | ((Frame7Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0xC || 0x1 || <nowiki>((Frame7TimeToHold & 0xF) | ((Frame7TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0xD || 0x1 || <nowiki>((Frame8TimeToHold & 0xF) | ((Frame8TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0xE || 0x1 || <nowiki>((Frame10Brightness & 0xF) | ((Frame9Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0xF || 0x1 || <nowiki>((Frame9TimeToHold & 0xF) | ((Frame9TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x10 || 0x1 || <nowiki>((Frame10TimeToHold & 0xF) | ((Frame10TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x11 || 0x1 || <nowiki>((Frame12Brightness & 0xF) | ((Frame11Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x12 || 0x1 || <nowiki>((Frame11TimeToHold & 0xF) | ((Frame11TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x13 || 0x1 || <nowiki>((Frame12TimeToHold & 0xF) | ((Frame12TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x14 || 0x1 || <nowiki>((Frame14Brightness & 0xF) | ((Frame13Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x15 || 0x1 || <nowiki>((Frame13TimeToHold & 0xF) | ((Frame13TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x16 || 0x1 || <nowiki>((Frame14TimeToHold & 0xF) | ((Frame14TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x17 || 0x1 || <nowiki>((Reserved & 0xF) | ((Frame15Brightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x18 || 0x1 || <nowiki>((Frame15TimeToHold & 0xF) | ((Frame15TimeTowards & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x19 || 0x1 || <nowiki>((Reserved & 0xF) | ((Reserved & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x1A || 0x1 || <nowiki>((TimeTowardsFinalBrightness & 0xF) | ((FinalBrightness & 0xF) << 4))</nowiki> | |||
|- | |||
| 0x1B || 0x1 || <nowiki>(Timeout & 0xFF)</nowiki> | |||
|- | |||
| 0x1C || 0x1 || <nowiki>((Timeout >> 8) & 0xFF)</nowiki> | |||
|} | |||
[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}). | [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}). | ||
Line 1,924: | Line 2,016: | ||
It first ensures the touch screen IC's chip id is one of the following: | It first ensures the touch screen IC's chip id is one of the following: | ||
0x7036 - STMicroelectronics FingerTipS FT9CJ | 0x7036 - STMicroelectronics FingerTipS FT9CJ/FT9CF | ||
0x4036 - | 0x4036 - ? | ||
Then constructs the final firmware version as follows: | Then constructs the final firmware version as follows: | ||
Line 6,879: | Line 6,971: | ||
= NpadDeviceTypeSet = | = NpadDeviceTypeSet = | ||
This is "nn::hid::system:: | This is "nn::hid::system::NpadDeviceTypeSet". This is a BitFlagSet object for [[#DeviceType|NpadDeviceType]]. | ||
= NpadSystemPropertiesSet = | = NpadSystemPropertiesSet = | ||
Line 6,885: | Line 6,977: | ||
= NpadSystemProperties = | = NpadSystemProperties = | ||
This is "nn::hid::NpadSystemProperties". This is a 64-bit flag. | This is "nn::hid::detail::NpadSystemProperties". This is a 64-bit flag. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 7,099: | Line 7,191: | ||
= FirmwareVersion = | = FirmwareVersion = | ||
This is "nn::hid::system::FirmwareVersion". | This is "nn::hid::system::FirmwareVersion" ([1.0.0-2.3.0] "nn::hid::debug::FirmwareVersion"). | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Value | |- | ||
! Description | ! Offset | ||
! Size | |||
! Description | |||
|- | |||
| 0x0 | |||
| 0x1 | |||
| Major | |||
|- | |||
| 0x1 | |||
| 0x1 | |||
| Minor | |||
|- | |||
| 0x2 | |||
| 0x1 | |||
| Micro | |||
|- | |||
| 0x3 | |||
| 0x1 | |||
| Revision | |||
|- | |||
| 0x4 | |||
| 0xC | |||
| [3.0.0+] [[#DeviceIdentifier]] | |||
|} | |||
== DeviceIdentifier == | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| "JR" || Joy-Con right controller | |||
|- | |||
| "JL" || Joy-Con left controller | |||
|- | |||
| "FK" || Pro Controller | |||
|- | |||
| "MY" || [[#DeviceTypeInternal|DeviceType]] 4 and [[#DeviceTypeInternal|DeviceType]] 5 | |||
|- | |||
| "LC" || [[#DeviceTypeInternal|DeviceType]] 6 and [[#DeviceTypeInternal|DeviceType]] 30 | |||
|- | |||
| "HL" || Famicom left controller | |||
|- | |||
| "HR" || Famicom right controller (with microphone) | |||
|- | |||
| "NL" || NES left controller | |||
|- | |||
| "NR" || NES right controller | |||
|- | |||
| "SN" || SNES controller | |||
|- | |||
| "LT" || N64 controller | |||
|- | |||
| "LS" || Sega Genesis controller | |||
|- | |||
| "PB" || Poké Ball Plus controller | |||
|- | |||
| "SH" || SioH | |||
|- | |||
| "TS" || TouchScreen | |||
|} | |||
= AppletDetailedUiType = | |||
This is "nn::hid::system::AppletDetailedUiType". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |- | ||
| 0x00000000 || None | | 0x00000000 || None | ||
Line 7,554: | Line 7,709: | ||
| [12.0.0+] 22 || Lagon || FullKeyController || Lagon || N64 controller (USB PID 0x2019) | | [12.0.0+] 22 || Lagon || FullKeyController || Lagon || N64 controller (USB PID 0x2019) | ||
|- | |- | ||
| [12.0.0+] 23 || || || || | | [12.0.0+] 23 || || || || Joy-Con Charging Grip (USB PID 0x200E) | ||
|- | |- | ||
| [13.0.0+] 24 || || || || "Kotetsu" (Pro Controller | | [13.0.0+] 24 || || || || "Kotetsu" (Pro Controller MCU) in DFU mode (USB PID 0x200F) | ||
|- | |- | ||
| [13.0.0+] 25 || || || || Joy-Con Charging Grip (USB PID 0x2008) | | [13.0.0+] 25 || || || || "Kuina" (Joy-Con Charging Grip MCU) in DFU mode (USB PID 0x2008) | ||
|- | |- | ||
| [13.0.0+] 26 || || || || SNES controller | | [13.0.0+] 26 || || || || SNES controller MCU in DFU mode (USB PID 0x2018) | ||
|- | |- | ||
| [13.0.0+] 27 || || || || N64 controller | | [13.0.0+] 27 || || || || N64 controller MCU in DFU mode (USB PID 0x201A) | ||
|- | |- | ||
| [13.0.0+] 28 || Lager || FullKeyController || || Sega Genesis controller (USB PID 0x201E) | | [13.0.0+] 28 || Lager || FullKeyController || || Sega Genesis controller (USB PID 0x201E) | ||
|- | |- | ||
| [14.0.0+] 29 || || || || Sega Genesis controller | | [14.0.0+] 29 || || || || Sega Genesis controller MCU in DFU mode (USB PID 0x201F) | ||
|- | |- | ||
| [14.0.0+] 30 || FullKey || FullKeyController || || | | [14.0.0+] 30 || FullKey || FullKeyController || || | ||
Line 8,284: | Line 8,439: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset | ||
! Size | |||
! Description | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| 0x1 | |||
| TimeUnit | |||
|- | |- | ||
| 0x1 | | 0x1 | ||
| 0x1 | |||
| FrameCount | |||
|- | |- | ||
| 0x2 | | 0x2 | ||
| 0x1 | |||
| CycleCount | |||
|- | |- | ||
| 0x3 | | 0x3 | ||
| 0x1 | |||
| InitialBrightness | |||
|- | |- | ||
| 0x4 || | | 0x4 | ||
| 0x4 * 15 | |||
| [[#Frame|Frames]] | |||
|- | |- | ||
| | | 0x40 | ||
| 0x1 | |||
| FinalBrightness | |||
|- | |- | ||
| 0x41 | |||
| 0x1 | |||
| TimeTowardsFinalBrightness | |||
| 0x41 | |||
| | |||
|- | |- | ||
| 0x42 | |||
| 0x6 | |||
| Reserved | |||
|} | |} | ||
== Frame == | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset | ||
! Size | |||
! Description | |||
|- | |- | ||
| 0x0 || | | 0x0 | ||
| 0x1 | |||
| Brightness | |||
|- | |- | ||
| | | 0x1 | ||
| 0x1 | |||
| TimeTowards | |||
|- | |- | ||
| | | 0x2 | ||
| 0x1 | |||
| TimeToHold | |||
|- | |- | ||
| | | 0x3 | ||
| | | 0x1 | ||
| Reserved | |||
| | |||
|} | |} | ||
Line 9,010: | Line 9,056: | ||
|- | |- | ||
| 0x8 || 0x8 || [[#FeatureType|FeatureType]] | | 0x8 || 0x8 || [[#FeatureType|FeatureType]] | ||
|} | |||
= FirmwareVersionInfo = | |||
This is "nn::hidtypes::FirmwareVersionInfo". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || [[#FirmwareVersionAttribute|FirmwareVersionAttribute]] | |||
|- | |||
| 0x4 || 0x2 || | |||
|- | |||
| 0x6 || 0x2 || MajorVersion | |||
|- | |||
| 0x8 || 0x2 || MinorVersion | |||
|- | |||
| 0xA || 0x2 || | |||
|} | |||
= FirmwareVersionAttribute = | |||
This is "nn::hidtypes::FirmwareVersionAttribute". This is a 32-bit flag. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Bit | |||
! Description | |||
|- | |||
| 0 | |||
| IsCustomerCodeCorruption | |||
|- | |||
| 1 | |||
| IsIapCorrupted | |||
|} | |} | ||