Commit caaedf1c authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

winejoystick.drv: Test for new joysticks in intervals of 2 seconds.

parent 4f114ad6
...@@ -163,10 +163,17 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick) ...@@ -163,10 +163,17 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick)
{ {
char buf[20]; char buf[20];
int flags, fd, found_ix, i; int flags, fd, found_ix, i;
static DWORD last_attempt;
DWORD now;
if (jstick->dev > 0) if (jstick->dev > 0)
return jstick->dev; return jstick->dev;
now = GetTickCount();
if (now - last_attempt < 2000)
return -1;
last_attempt = now;
#ifdef HAVE_LINUX_22_JOYSTICK_API #ifdef HAVE_LINUX_22_JOYSTICK_API
flags = O_RDONLY | O_NONBLOCK; flags = O_RDONLY | O_NONBLOCK;
#else #else
...@@ -189,6 +196,7 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick) ...@@ -189,6 +196,7 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick)
{ {
TRACE("Found joystick[%d] at %s\n", jstick->joyIntf, buf); TRACE("Found joystick[%d] at %s\n", jstick->joyIntf, buf);
jstick->dev = fd; jstick->dev = fd;
last_attempt = 0;
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment