Commit 507157abdbbc1c133eac9b02f5958563517621a3

Sam Lantinga 2015-05-25T16:22:09

Wait for devices to finish initializing when inserted, before using them. Fixes hotplug issue with XBox 360 game controller.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c
index b1310bc..4ef81a8 100644
--- a/src/core/linux/SDL_udev.c
+++ b/src/core/linux/SDL_udev.c
@@ -469,6 +469,9 @@ SDL_UDEV_Poll(void)
         action = _this->udev_device_get_action(dev);
 
         if (SDL_strcmp(action, "add") == 0) {
+            /* Wait for the device to finish initialization */
+            SDL_Delay(100);
+
             device_event(SDL_UDEV_DEVICEADDED, dev);
         } else if (SDL_strcmp(action, "remove") == 0) {
             device_event(SDL_UDEV_DEVICEREMOVED, dev);