[PATCH] winejoystick.drv: Revert 62876f3fc5feb1ca23d27a6de5adca580d963d0c

Bruno Jesus 00cpxxx at gmail.com
Sat Sep 3 15:21:41 CDT 2016


Copy & paste fail on the commit ID in previous email, sorry.

With Aric's intensive steps into commiting HID code it is simpler to revert this patch (which caused a regression) instead of trying alterantive ways to fix it. Specially because HID will change this whole file anyway.

Superseeds 126184.

Fixes https://bugs.winehq.org/show_bug.cgi?id=41217

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
---
 dlls/winejoystick.drv/joystick_linux.c | 35 ++++++++--------------------------
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/dlls/winejoystick.drv/joystick_linux.c b/dlls/winejoystick.drv/joystick_linux.c
index 289e728..b8fda4f 100644
--- a/dlls/winejoystick.drv/joystick_linux.c
+++ b/dlls/winejoystick.drv/joystick_linux.c
@@ -126,7 +126,6 @@ LRESULT driver_open(LPSTR str, DWORD dwIntf)
 	return 0;
 
     JSTCK_Data[dwIntf].joyIntf = dwIntf;
-    JSTCK_Data[dwIntf].dev = -1;
     JSTCK_Data[dwIntf].in_use = TRUE;
     return (LRESULT)&JSTCK_Data[dwIntf];
 }
@@ -161,43 +160,25 @@ struct js_status
  */
 static	int	JSTCK_OpenDevice(WINE_JSTCK* jstick)
 {
-    char  buf[20];
-    int   flags, fd, found_ix, i;
+    char	buf[20];
+    int		flags;
 
     if (jstick->dev > 0)
       return jstick->dev;
 
+    sprintf(buf, JOYDEV_NEW, jstick->joyIntf);
 #ifdef HAVE_LINUX_22_JOYSTICK_API
     flags = O_RDONLY | O_NONBLOCK;
 #else
     flags = O_RDONLY;
 #endif
-
-    /* The first joystick may not be at /dev/input/js0, find the correct
-     * first or second device. For example the driver for XBOX 360 wireless
-     * receiver creates entries starting at 20.
-     */
-    for (found_ix = i = 0; i < MAXJOYSTICK; i++) {
-        sprintf(buf, JOYDEV_NEW, i);
-        if ((fd = open(buf, flags)) < 0) {
-            sprintf(buf, JOYDEV_OLD, i);
-            if ((fd = open(buf, flags)) < 0)
-                continue;
-        }
-
-        if (found_ix++ == jstick->joyIntf)
-        {
-            TRACE("Found joystick[%d] at %s\n", jstick->joyIntf, buf);
-            jstick->dev = fd;
-            break;
-        }
-
-        close(fd);
+    if ((jstick->dev = open(buf, flags)) < 0) {
+        sprintf(buf, JOYDEV_OLD, jstick->joyIntf);
+        if ((jstick->dev = open(buf, flags)) < 0)
+            return jstick->dev;
     }
-
 #ifdef HAVE_LINUX_22_JOYSTICK_API
-    if (jstick->dev > 0)
-        ioctl(jstick->dev, JSIOCGAXMAP, jstick->axesMap);
+    ioctl(jstick->dev, JSIOCGAXMAP, jstick->axesMap);
 #endif
     return jstick->dev;
 }
-- 
2.9.3




More information about the wine-patches mailing list