[PATCH] winejoystick.drv: Test for new joysticks in intervals of 2 seconds
Bruno Jesus
00cpxxx at gmail.com
Wed Sep 7 22:08:33 CDT 2016
Simplified attempt that still fixes bug https://bugs.winehq.org/show_bug.cgi?id=41217
Superseeds 126293 and 126184.
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
---
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;
}
--
2.9.3
More information about the wine-patches
mailing list