Преглед изворни кода

Fix DS5 Windows game detection: expose PS5 game mode in UI, fix bcdDevice

copilot-swe-agent[bot] пре 3 месеци
родитељ
комит
4bfc834a66
3 измењених фајлова са 8 додато и 3 уклоњено
  1. 1 1
      OpenPuck/OpenPuck.ino
  2. 5 1
      OpenPuck/mode_ps5.cpp
  3. 2 1
      docs/index.html

+ 1 - 1
OpenPuck/OpenPuck.ino

@@ -229,7 +229,7 @@ void setup()
 		"STEAM(puck)",	       "XBOX(xinput+mouse)",
 		"SWITCH(horipad)",     "LIZARD(puck kb/mouse)",
 		"SWITCH(pro+gyro)",    "PS5(dualsense)",
-		"HIDGYRO(ds4+motion)", "PS5(dualsense,game/clean)",
+		"HIDGYRO(ds4+motion)", "PS5(dualsense,games)",
 		"DS4(ds4,game/clean)", "PS3(dualshock3/sixaxis)"
 	};
 	Serial.printf("# copycat up: unit=%s board=%s, mode=%s\n", g_unit,

+ 5 - 1
OpenPuck/mode_ps5.cpp

@@ -213,7 +213,11 @@ uint8_t Ps5Controller::maxSlots() const
 void Ps5Controller::usbIdentity()
 {
 	USBDevice.setID(0x054C, 0x0CE6);
-	USBDevice.setDeviceVersion(0x0110);
+	// Clean mode (no wake mouse, no WebUSB) matches the real wired DualSense's
+	// single-HID layout -> use 0x0100 to match it. Normal MODE_PS5 (with wake
+	// mouse + WebUSB) uses 0x0110 so Windows re-reads the descriptor on
+	// a mode switch between the two (per the bcdDevice caching rule).
+	USBDevice.setDeviceVersion(modeIsCleanPS(g_usbMode) ? 0x0100 : 0x0110);
 	USBDevice.setManufacturerDescriptor("Sony Interactive Entertainment");
 	USBDevice.setProductDescriptor("DualSense Wireless Controller");
 }

+ 2 - 1
docs/index.html

@@ -84,6 +84,7 @@
         <button data-mode="3" class="modebtn">Lizard (always)</button>
         <button data-mode="4" class="modebtn">Switch Pro + gyro</button>
         <button data-mode="5" class="modebtn">PS5 DualSense</button>
+        <button data-mode="7" class="modebtn">PS5 DualSense (for games)</button>
         <button data-mode="6" class="modebtn">HID gyro (DS4)</button>
         <button data-mode="9" class="modebtn">PS3 (DualShock 3)</button>
       </div>
@@ -242,7 +243,7 @@
 </div>
 
 <script>
-const MODE_NAMES = ["Steam (puck)","Xbox 360","Switch (HORIPAD)","Lizard (always)","Switch Pro + gyro","PS5 DualSense","HID gyro (DS4)","PS5 (game/clean)","DS4 (game/clean)","PS3 (DualShock 3)"];
+const MODE_NAMES = ["Steam (puck)","Xbox 360","Switch (HORIPAD)","Lizard (always)","Switch Pro + gyro","PS5 DualSense","HID gyro (DS4)","PS5 DualSense (for games)","DS4 (game/clean)","PS3 (DualShock 3)"];
 const CHORD_FIELD = [17, 18, 19];
 let dev=null, epIn=0, epOut=0, ifNum=0, polling=false, capturing=false, backupBusy=false;
 let lastP=null; // most recent status-blob payload (config source for Export)