Wait for devices to finish initializing when inserted, before using them. Fixes hotplug issue with XBox 360 game controller.
authorSam Lantinga <slouken@libsdl.org>
Mon, 25 May 2015 16:22:09 -0700
changeset 9616eb2a8d9cfb74
parent 9615 54a796c13658
child 9617 062bfde7330a
Wait for devices to finish initializing when inserted, before using them. Fixes hotplug issue with XBox 360 game controller.
src/core/linux/SDL_udev.c
     1.1 --- a/src/core/linux/SDL_udev.c	Mon May 25 14:52:41 2015 -0700
     1.2 +++ b/src/core/linux/SDL_udev.c	Mon May 25 16:22:09 2015 -0700
     1.3 @@ -469,6 +469,9 @@
     1.4          action = _this->udev_device_get_action(dev);
     1.5  
     1.6          if (SDL_strcmp(action, "add") == 0) {
     1.7 +            /* Wait for the device to finish initialization */
     1.8 +            SDL_Delay(100);
     1.9 +
    1.10              device_event(SDL_UDEV_DEVICEADDED, dev);
    1.11          } else if (SDL_strcmp(action, "remove") == 0) {
    1.12              device_event(SDL_UDEV_DEVICEREMOVED, dev);