Better fix for rescanning devices after read failure
This commit is contained in:
parent
483a010f0c
commit
6d012b2a5d
@ -555,6 +555,9 @@ HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Rescan the device list in case device state has changed */
|
||||||
|
SDL_HIDAPI_change_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1003,10 +1006,7 @@ HIDAPI_UpdateDevices(void)
|
|||||||
if (device->driver) {
|
if (device->driver) {
|
||||||
if (SDL_TryLockMutex(device->dev_lock) == 0) {
|
if (SDL_TryLockMutex(device->dev_lock) == 0) {
|
||||||
device->updating = SDL_TRUE;
|
device->updating = SDL_TRUE;
|
||||||
if (!device->driver->UpdateDevice(device)) {
|
device->driver->UpdateDevice(device);
|
||||||
/* Try re-enumerating the device if it fails */
|
|
||||||
SDL_HIDAPI_change_count = 0;
|
|
||||||
}
|
|
||||||
device->updating = SDL_FALSE;
|
device->updating = SDL_FALSE;
|
||||||
SDL_UnlockMutex(device->dev_lock);
|
SDL_UnlockMutex(device->dev_lock);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user