puck_hid.h 1.5 KB

123456789101112131415161718192021222324252627
  1. // puck_hid.h -- the Steam Controller puck personality (MODE_STEAM + MODE_LIZARD).
  2. //
  3. // This is the controller that wears Valve's identity (28DE:1304) and exposes the four puck HID slot interfaces
  4. // (interface N owns bond slot N). It implements:
  5. // - the puck feature COMMAND CHANNEL (handleSet/handleGet): reports 0x83/0xAE/0xB4/0xAD/0xA2/0xA3 the host
  6. // uses to read attributes/serials and read/write/clear bond slots, plus the host->controller haptic relay
  7. // ride-along on OUTPUT reports 0x80-0x86 and feature passthrough (report 0x01).
  8. // - the seamless LIZARD decision: when Steam is driving the gamepad (recent OUTPUT/heartbeat) we forward the
  9. // gamepad report 0x45; when Steam is closed we present keyboard+mouse on the SAME interface. lizardActive()
  10. // is the single source of truth, shared with the haptic gate so we never buzz while Steam isn't reading.
  11. // - the USB connection-state presentation (reports 0x79 / 0x7B) Steam reads to mark the controller connected.
  12. #pragma once
  13. #include "controllers.h"
  14. #include <stdint.h>
  15. // Steam mode: forward report 0x45 only when the seq advanced (dedupe like the real puck). Sending stale
  16. // repeats makes Steam's trackpad smoothing stair-step. Toggle to A/B (WebUSB field 14).
  17. extern uint8_t g_fwdNewOnly;
  18. class SteamPuckController : public IController {
  19. public:
  20. void begin() override;
  21. void onReport45(const uint8_t* rep, bool fresh, uint8_t bodyTlen) override;
  22. void task() override;
  23. bool isPuck() const override { return true; }
  24. };
  25. extern SteamPuckController g_steamPuck;