mode_switch_pro.h 1.0 KB

123456789101112131415161718192021222324
  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. bool dynamicMount() const override
  15. {
  16. return true;
  17. }
  18. uint8_t maxSlots() const override;
  19. void usbIdentity() override;
  20. void beginPool() override;
  21. void mountSlots(uint8_t k) override;
  22. };
  23. extern SwitchProController g_switchPro;