Quellcode durchsuchen

Don't wait a long time for zombie Bluetooth controllers

If a Nintendo Switch Pro controller is turned off, it will leave the controller connected in Windows, but not responding to reports. Don't wait a really long time trying to get information from a controller in this state.
Sam Lantinga vor 3 Jahren
Ursprung
Commit
67fa6a935f
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      src/joystick/hidapi/SDL_hidapi_switch.c

+ 1 - 1
src/joystick/hidapi/SDL_hidapi_switch.c

@@ -937,7 +937,7 @@ static ESwitchDeviceInfoControllerType
 ReadJoyConControllerType(SDL_HIDAPI_Device *device)
 ReadJoyConControllerType(SDL_HIDAPI_Device *device)
 {
 {
     ESwitchDeviceInfoControllerType eControllerType = k_eSwitchDeviceInfoControllerType_Unknown;
     ESwitchDeviceInfoControllerType eControllerType = k_eSwitchDeviceInfoControllerType_Unknown;
-    const int MAX_ATTEMPTS = 20;
+    const int MAX_ATTEMPTS = 1; /* Don't try too long, in case this is a zombie Bluetooth controller */
     int attempts = 0;
     int attempts = 0;
 
 
     /* Create enough of a context to read the controller type from the device */
     /* Create enough of a context to read the controller type from the device */