Index: dlls/dinput/joystick_linux.c =================================================================== RCS file: /home/wine/wine/dlls/dinput/joystick_linux.c,v retrieving revision 1.35 diff -u -p -r1.35 joystick_linux.c --- dlls/dinput/joystick_linux.c 5 Apr 2006 09:47:05 -0000 1.35 +++ dlls/dinput/joystick_linux.c 17 Apr 2006 15:46:32 -0000 @@ -69,7 +69,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #ifdef HAVE_LINUX_22_JOYSTICK_API -#define JOYDEV "/dev/js" +#define JOYDEV_NEW "/dev/input/js" +#define JOYDEV_OLD "/dev/js" typedef struct { LONG lMin; @@ -148,6 +149,19 @@ static void _dump_DIDEVCAPS(LPDIDEVCAPS } } +static int joydev_get_device(char *dev, int id) +{ + int ret; + sprintf(dev, "%s%d", JOYDEV_NEW, id); + if ((ret = open(dev, O_RDONLY)) < 0) { + sprintf(dev, "%s%d", JOYDEV_OLD, id); + if ((ret = open(dev, O_RDONLY)) < 0) { + return -1; + } + } + return ret; +} + static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) { int fd = -1; @@ -162,8 +176,7 @@ static BOOL joydev_enum_deviceA(DWORD dw ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) { /* check whether we have a joystick */ - sprintf(dev, "%s%d", JOYDEV, id); - if ((fd = open(dev,O_RDONLY)) < 0) { + if ((fd = joydev_get_device(dev, id)) < 0) { WARN("open(%s,O_RDONLY) failed: %s\n", dev, strerror(errno)); return FALSE; } @@ -212,8 +225,7 @@ static BOOL joydev_enum_deviceW(DWORD dw ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) { /* check whether we have a joystick */ - sprintf(dev, "%s%d", JOYDEV, id); - if ((fd = open(dev,O_RDONLY)) < 0) { + if ((fd = joydev_get_device(dev, id)) < 0) { WARN("open(%s,O_RDONLY) failed: %s\n", dev, strerror(errno)); return FALSE; } @@ -450,9 +462,7 @@ static HRESULT alloc_device(REFGUID rgui return DIERR_OUTOFMEMORY; } - sprintf(newDevice->dev, "%s%d", JOYDEV, rguid->Data3); - - if ((newDevice->joyfd = open(newDevice->dev,O_RDONLY)) < 0) { + if ((newDevice->joyfd = joydev_get_device(newDevice->dev, rguid->Data3)) < 0) { WARN("open(%s,O_RDONLY) failed: %s\n", newDevice->dev, strerror(errno)); HeapFree(GetProcessHeap(), 0, newDevice); return DIERR_DEVICENOTREG; Index: dlls/winmm/joystick/joystick.c =================================================================== RCS file: /home/wine/wine/dlls/winmm/joystick/joystick.c,v retrieving revision 1.21 diff -u -p -r1.21 joystick.c --- dlls/winmm/joystick/joystick.c 28 Nov 2005 20:12:34 -0000 1.21 +++ dlls/winmm/joystick/joystick.c 17 Apr 2006 15:46:33 -0000 @@ -54,7 +54,8 @@ #endif #ifdef HAVE_LINUX_JOYSTICK_H #include -#define JOYDEV "/dev/js%d" +#define JOYDEV_NEW "/dev/input/js%d" +#define JOYDEV_OLD "/dev/js%d" #endif #ifdef HAVE_SYS_ERRNO_H #include @@ -166,12 +167,15 @@ static int JSTCK_OpenDevice(WINE_JSTCK* if (jstick->dev > 0) return jstick->dev; - sprintf(buf, JOYDEV, jstick->joyIntf); + sprintf(buf, JOYDEV_NEW, jstick->joyIntf); #ifdef HAVE_LINUX_22_JOYSTICK_API flags = O_RDONLY | O_NONBLOCK; #else flags = O_RDONLY; #endif + if ((jstick->dev = open(buf, flags)) < 0) { + sprintf(buf, JOYDEV_OLD, jstick->joyIntf); + } return (jstick->dev = open(buf, flags)); }