mode_switch_pro.h 870 B

12345678910111213141516
  1. // mode_switch_pro.h -- Nintendo Switch Pro Controller personality (MODE_SW_PRO): 057E:2009, report 0x30 + IMU.
  2. //
  3. // The genuine Pro Controller requires a USB handshake + subcommand exchange (device info, SPI calibration reads,
  4. // set-report-mode) before any host (or Steam) will bind it. jcSet() answers that handshake from the USB ISR by
  5. // enqueuing canonical 0x81/0x21 replies; task() drains them (and, once the host selects report mode 0x30, streams
  6. // the standard input report with gyro). Linux hid-nintendo hardcodes the 0x30 layout, so we follow it exactly.
  7. // macOS drops input reports shorter than the descriptor length, so every reply is padded to the full 63 bytes.
  8. #pragma once
  9. #include "controllers.h"
  10. class SwitchProController : public IController {
  11. public:
  12. void begin() override;
  13. void task() override;
  14. };
  15. extern SwitchProController g_switchPro;