Pro Controller: Difference between revisions

No edit summary
Tatsh (talk | contribs)
Start documenting the protocol
Line 1: Line 1:
The Nintendo Switch 2 Pro Controller is the new iteration of the [https://switchbrew.org/wiki/Pro_Controller Pro Controller] for the Switch 2.  
The Nintendo Switch 2 Pro Controller is the new iteration of the [https://switchbrew.org/wiki/Pro_Controller] for the Switch 2.  


= Hardware =
= Hardware =
Line 10: Line 10:
| NFC || NXP PN71602
| NFC || NXP PN71602
|}
|}
= Protocol =
Expected to be extremely similar to Switch 1. One difference is that over the wire the USB bulk out endpoint is used. Data is sent over interface 1.
Commands start with an ID. All appear to have 0x91 as the second byte.
Axis 1 (left stick up/down) and axis 3 (right stick up/down) are inverted.
== General structure ==
Little-endian. The header must be padded to 8 bytes.
=== Header ===
{| class="wikitable"
|-
! Offset !! Size !! Description
|-
| 0x0 || 0x1 || [[#CommandCode|CommandCode]]
|-
| 0x1 || 0x1 || Always 0x91
|-
| 0x2 || 0x2 || Argument 1
|-
| 0x4 || 0x2 || Argument 2
|-
| 0x6 || 0x2 || Argument 3
|-
|}
==== CommandCode ====
{| class="wikitable" border="1"
! Value
! Description
|-
| 0x2 || ReadSPI
|-
| 0x3 || Init? Also used to enable haptics
|-
| 0x7 || Unknown
|-
| 0x9 || Used to set controller LED state
|-
| 0xA || Unknown
|-
| 0xC || IMUCommand
|-
| 0x11 || Unknown
|-
| 0x15 || RequestControllerMAC / LTKRequest / unknown
|}
== Initialize ==
Required to start receiving input from the controller.
{| class="wikitable" border="1"
! Offset
! Size
! Value
! Description
|-
| 0x0 || 0x1 || 0x03 ||
|-
| 0x1 || 0x1 || 0x91 ||
|-
| 0x2 || 0x2 || 0x0 0xD ||
|-
| 0x4 || 0x2 || 0x0 0x8 ||
|-
| 0x6 || 0x2 || 0x0 0x0 ||
|-
| 0x8 || 0x2 || 0x1 0x0 ||
|-
| 0xA || 0x6 || ... || Console MAC address (can be anything)
|}
<pre>
const uint8_t INIT_CMD[] = {
  0x03,
  0x91,
  0x00, 0x0d,
  0x00, 0x08,
  0x00, 0x00,
  0x01, 0x00,
  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
</pre>