Module: wine Branch: master Commit: caaedf1cd610012f944f96a53627d9702358d2f1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=caaedf1cd610012f944f96a536...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Thu Sep 8 00:08:33 2016 -0300
winejoystick.drv: Test for new joysticks in intervals of 2 seconds.
Signed-off-by: Bruno Jesus 00cpxxx@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 289e728..287f4be 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; }