Fixed disabling the Xbox 360 wireless HIDAPI driver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 9f22a38..58dd653 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -504,7 +504,7 @@ static void SDLCALL
SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
int i;
- SDL_HIDAPI_Device *device = SDL_HIDAPI_devices;
+ SDL_HIDAPI_Device *device;
SDL_bool enabled = SDL_GetStringBoolean(hint, SDL_TRUE);
if (SDL_strcmp(name, SDL_HINT_JOYSTICK_HIDAPI) == 0) {
@@ -517,7 +517,6 @@ SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldVal
SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i];
if (SDL_strcmp(name, driver->hint) == 0) {
driver->enabled = enabled;
- break;
}
}
}
@@ -533,12 +532,11 @@ SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldVal
/* Update device list if driver availability changes */
SDL_LockJoysticks();
- while (device) {
+ for (device = SDL_HIDAPI_devices; device; device = device->next) {
if (device->driver && !device->driver->enabled) {
HIDAPI_CleanupDeviceDriver(device);
}
HIDAPI_SetupDeviceDriver(device);
- device = device->next;
}
SDL_UnlockJoysticks();
@@ -741,7 +739,7 @@ HIDAPI_AddDevice(struct hid_device_info *info)
HIDAPI_SetupDeviceDriver(device);
#ifdef DEBUG_HIDAPI
- SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s\n", device->name, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->hint : "NONE");
+ SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->hint : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED");
#endif
}