From caaedf1cd610012f944f96a53627d9702358d2f1 Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Thu, 8 Sep 2016 00:08:33 -0300 Subject: [PATCH] winejoystick.drv: Test for new joysticks in intervals of 2 seconds. Signed-off-by: Bruno Jesus <00cpxxx@gmail.com> Signed-off-by: Alexandre Julliard --- dlls/winejoystick.drv/joystick_linux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/winejoystick.drv/joystick_linux.c b/dlls/winejoystick.drv/joystick_linux.c index 289e728069b..287f4be60d7 100644 --- a/dlls/winejoystick.drv/joystick_linux.c +++ b/dlls/winejoystick.drv/joystick_linux.c @@ -163,10 +163,17 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick) { char buf[20]; int flags, fd, found_ix, i; + static DWORD last_attempt; + DWORD now; if (jstick->dev > 0) return jstick->dev; + now = GetTickCount(); + if (now - last_attempt < 2000) + return -1; + last_attempt = now; + #ifdef HAVE_LINUX_22_JOYSTICK_API flags = O_RDONLY | O_NONBLOCK; #else @@ -189,6 +196,7 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick) { TRACE("Found joystick[%d] at %s\n", jstick->joyIntf, buf); jstick->dev = fd; + last_attempt = 0; break; }