Skip to content

Commit

Permalink
Fixed disabling the Xbox 360 wireless HIDAPI driver
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 26, 2020
1 parent ce7c51a commit adb53d0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/joystick/hidapi/SDL_hidapijoystick.c
Expand Up @@ -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) {
Expand All @@ -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;
}
}
}
Expand All @@ -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();
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit adb53d0

Please sign in to comment.