소스 검색

enable previously suppressed haptics reports

Jariullah Safi 4 달 전
부모
커밋
0310fbb355
2개의 변경된 파일과 16개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 6
      OpenPuck/OpenPuck.ino
  2. 7 1
      docs/PROTOCOL.md

+ 9 - 6
OpenPuck/OpenPuck.ino

@@ -357,23 +357,26 @@ static void rfConnFlushRelay(uint8_t ch){
 
 // ---- command channel; `slot` is the interface index (interface N == bond slot N) ----
 static void handleSet(int slot, uint8_t rid, hid_report_type_t type, uint8_t const *b, uint16_t n) {
-  if (type == HID_REPORT_TYPE_OUTPUT) {   // Steam OUTPUT reports 0x80-0x89. ONLY the haptic (0x82) is relayed to
-    // the controller, and ONLY when it arrives on the CONNECTED slot's interface. We have one controller but
-    // expose 4 puck slots; forwarding the other 0x80-0x89 reports (LED/config), or a haptic Steam aimed at a
-    // different slot, made the controller buzz at random. The real puck (4 independent slots) never does that.
+  if (type == HID_REPORT_TYPE_OUTPUT) {   // Steam OUTPUT reports 0x80-0x89. The haptic/actuator reports (0x80-0x86)
+    // are relayed to the controller, and ONLY when they arrive on the CONNECTED slot's interface. We have one
+    // controller but expose 4 puck slots, and a report aimed at a DIFFERENT slot made the controller buzz at
+    // random -> that is what the slot gate below fixes. (This used to also clamp to 0x82-ONLY, which silently
+    // dropped the ping / grip / test haptics: those ride other report IDs such as 0x85/0x86, so they never
+    // reached the controller.) The 63-byte settings/config reports 0x87/0x88/0x89 are NOT haptics and are not
+    // pushed here — 0x87 (lizard-off/settings) reaches the controller through the feature-0x01 passthrough path.
     if (rid >= 0x80 && rid <= 0x89) {
       hapLogAdd((uint8_t)slot, rid, b, n);   // capture ALL OUTPUT reports (even un-relayed) for the 'H' dump
       g_steamAliveMs = millis();   // ANY Steam OUTPUT report (not just the 0x87 heartbeat) means Steam is present and
                                    // driving -> leave lizard for gamepad NOW, so a haptic that arrives before the
                                    // first 0x87 doesn't get relayed while we're still presenting lizard (-> buzz loop).
     }
-    if (rid == 0x82 && n >= 1 && hapticRelaySlotOk(slot) && !lizardActive()) {  // wrap as a SET sub-TLV like the report-01 path
+    if (rid >= 0x80 && rid <= 0x86 && n >= 1 && hapticRelaySlotOk(slot) && !lizardActive()) {  // wrap as a SET sub-TLV like the report-01 path
       if (!haptic82Blocked()) {
         uint8_t m = n > (uint16_t)(sizeof g_relayBuf - 2) ? (sizeof g_relayBuf - 2) : n;
         g_relayBuf[0] = rid; g_relayBuf[1] = m; memcpy(g_relayBuf + 2, b, m);
         g_relayN = m + 2; g_relayPend = true;
       }
-      haptic82HostReport(b, n);  // track on/off for the stuck-haptic watchdog
+      if (rid == 0x82) haptic82HostReport(b, n);  // on/off tracking is only meaningful for the 0x82 stream
     }
     if (Serial.availableForWrite() > 80) {                      // log so we can see what Steam actually sends (e.g. glide haptics)
       Serial.printf("# OUT if%d rid=%02X n=%u:", slot, rid, n);

+ 7 - 1
docs/PROTOCOL.md

@@ -295,9 +295,15 @@ does a `detach -> rebuild -> attach` so the host re-reads the descriptor cleanly
   lizard-off heartbeat, LED, or a `0x82` haptic) refreshes the watchdog — not just `0x87`. This makes
   the puck leave lizard for gamepad on Steam's **first** contact, even if that first packet is a haptic
   that arrives before the heartbeat.
-- **Haptics are gated on this decision**: a `0x82` haptic is **never** relayed to the controller while
+- **Haptics are gated on this decision**: haptic reports are **never** relayed to the controller while
   the puck is presenting lizard. Relaying haptics while Steam isn't reading `0x45` back made Steam loop
   the same command, leaving the controller buzzing; suppressing them keeps the lizard state clean.
+- **Which OUTPUT reports are relayed**: the haptic/actuator reports `0x80`–`0x86` are forwarded to the
+  **connected slot only** (the slot gate is what stops a haptic aimed at another of the four exposed
+  slots from buzzing the single controller). The 63-byte settings/config reports `0x87`/`0x88`/`0x89`
+  are not haptics and are not pushed on this path (`0x87` lizard-off reaches the controller via the
+  feature `0x01` passthrough). Restricting this to `0x82` alone silently dropped the ping/grip/test
+  haptics, which use other report IDs.
 
 ### 9.2 Xbox mode