소스 검색

more fixes

Jariullah Safi 4 달 전
부모
커밋
9876a3ced8
1개의 변경된 파일과 5개의 추가작업 그리고 12개의 파일을 삭제
  1. 5 12
      OpenPuck/puck_hid.cpp

+ 5 - 12
OpenPuck/puck_hid.cpp

@@ -432,18 +432,11 @@ void SteamPuckController::onAuxReport(int slot, uint8_t rid,
 		return;
 	if (slot < 0 || slot >= NSLOT)
 		return;
-	if (!(g_slot[slot].used && hid[slot].ready()))
-		return;
-	// macOS/Steam DROP an input report shorter than its descriptor-declared length, so pad to it
-	// (zero-filled tail). Declared payload lengths excl. report ID: 0x43 = 14, 0x44 = 5. The
-	// controller often sends a compact 0x43; without this pad Steam never reads battery.
-	uint8_t declared = (rid == 0x43) ? 14u : (rid == 0x44) ? 5u : n;
-	uint8_t buf[16];
-	if (declared > sizeof buf)
-		declared = sizeof buf;
-	memset(buf, 0, declared);
-	memcpy(buf, data, (n < declared) ? n : declared);
-	hid[slot].sendReport(rid, buf, declared);
+	// Forward the controller's status report VERBATIM (the real puck does this; it's how the host reads
+	// battery). Padding the report to the descriptor-declared length broke battery in both lizard and
+	// Steam, so it's reverted -- send exactly what the controller sent.
+	if (g_slot[slot].used && hid[slot].ready())
+		hid[slot].sendReport(rid, data, n);
 }
 
 // wake nudge: a bare USB resume signal is NOT enough to wake some hosts (Windows in particular) -- they only