Commit 1db7d33dc4455990b1d157914beea6a0bad1ea92

Sam Lantinga 2022-08-09T17:04:26

Recover from Bluetooth devices temporarily out of range

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 8907adb..69e8488 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -1111,6 +1111,8 @@ HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
     hwdata->device = device;
 
     if (!device->driver->OpenJoystick(device, joystick)) {
+        /* The open failed, mark this device as disconnected and update devices */
+        HIDAPI_JoystickDisconnected(device, joystickID);
         SDL_free(hwdata);
         return -1;
     }