Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
dd174c54
Commit
dd174c54
authored
Apr 18, 2006
by
Mike Frysinger
Committed by
Alexandre Julliard
Apr 19, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
joystick: Search for /dev/input/js as well as /dev/js.
parent
162d9cb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
joystick_linux.c
dlls/dinput/joystick_linux.c
+18
-8
joystick.c
dlls/winmm/joystick/joystick.c
+6
-2
No files found.
dlls/dinput/joystick_linux.c
View file @
dd174c54
...
@@ -69,7 +69,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
...
@@ -69,7 +69,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#ifdef HAVE_LINUX_22_JOYSTICK_API
#ifdef HAVE_LINUX_22_JOYSTICK_API
#define JOYDEV "/dev/js"
#define JOYDEV_NEW "/dev/input/js"
#define JOYDEV_OLD "/dev/js"
typedef
struct
{
typedef
struct
{
LONG
lMin
;
LONG
lMin
;
...
@@ -148,6 +149,19 @@ static void _dump_DIDEVCAPS(LPDIDEVCAPS lpDIDevCaps)
...
@@ -148,6 +149,19 @@ static void _dump_DIDEVCAPS(LPDIDEVCAPS 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
)
static
BOOL
joydev_enum_deviceA
(
DWORD
dwDevType
,
DWORD
dwFlags
,
LPDIDEVICEINSTANCEA
lpddi
,
DWORD
version
,
int
id
)
{
{
int
fd
=
-
1
;
int
fd
=
-
1
;
...
@@ -162,8 +176,7 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
...
@@ -162,8 +176,7 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
/* check whether we have a joystick */
/* check whether we have a joystick */
sprintf
(
dev
,
"%s%d"
,
JOYDEV
,
id
);
if
((
fd
=
joydev_get_device
(
dev
,
id
))
<
0
)
{
if
((
fd
=
open
(
dev
,
O_RDONLY
))
<
0
)
{
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
dev
,
strerror
(
errno
));
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
dev
,
strerror
(
errno
));
return
FALSE
;
return
FALSE
;
}
}
...
@@ -212,8 +225,7 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
...
@@ -212,8 +225,7 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
/* check whether we have a joystick */
/* check whether we have a joystick */
sprintf
(
dev
,
"%s%d"
,
JOYDEV
,
id
);
if
((
fd
=
joydev_get_device
(
dev
,
id
))
<
0
)
{
if
((
fd
=
open
(
dev
,
O_RDONLY
))
<
0
)
{
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
dev
,
strerror
(
errno
));
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
dev
,
strerror
(
errno
));
return
FALSE
;
return
FALSE
;
}
}
...
@@ -450,9 +462,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
...
@@ -450,9 +462,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
return
DIERR_OUTOFMEMORY
;
return
DIERR_OUTOFMEMORY
;
}
}
sprintf
(
newDevice
->
dev
,
"%s%d"
,
JOYDEV
,
rguid
->
Data3
);
if
((
newDevice
->
joyfd
=
joydev_get_device
(
newDevice
->
dev
,
rguid
->
Data3
))
<
0
)
{
if
((
newDevice
->
joyfd
=
open
(
newDevice
->
dev
,
O_RDONLY
))
<
0
)
{
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
newDevice
->
dev
,
strerror
(
errno
));
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
newDevice
->
dev
,
strerror
(
errno
));
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
DIERR_DEVICENOTREG
;
return
DIERR_DEVICENOTREG
;
...
...
dlls/winmm/joystick/joystick.c
View file @
dd174c54
...
@@ -54,7 +54,8 @@
...
@@ -54,7 +54,8 @@
#endif
#endif
#ifdef HAVE_LINUX_JOYSTICK_H
#ifdef HAVE_LINUX_JOYSTICK_H
#include <linux/joystick.h>
#include <linux/joystick.h>
#define JOYDEV "/dev/js%d"
#define JOYDEV_NEW "/dev/input/js%d"
#define JOYDEV_OLD "/dev/js%d"
#endif
#endif
#ifdef HAVE_SYS_ERRNO_H
#ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#include <sys/errno.h>
...
@@ -166,12 +167,15 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick)
...
@@ -166,12 +167,15 @@ static int JSTCK_OpenDevice(WINE_JSTCK* jstick)
if
(
jstick
->
dev
>
0
)
if
(
jstick
->
dev
>
0
)
return
jstick
->
dev
;
return
jstick
->
dev
;
sprintf
(
buf
,
JOYDEV
,
jstick
->
joyIntf
);
sprintf
(
buf
,
JOYDEV
_NEW
,
jstick
->
joyIntf
);
#ifdef HAVE_LINUX_22_JOYSTICK_API
#ifdef HAVE_LINUX_22_JOYSTICK_API
flags
=
O_RDONLY
|
O_NONBLOCK
;
flags
=
O_RDONLY
|
O_NONBLOCK
;
#else
#else
flags
=
O_RDONLY
;
flags
=
O_RDONLY
;
#endif
#endif
if
((
jstick
->
dev
=
open
(
buf
,
flags
))
<
0
)
{
sprintf
(
buf
,
JOYDEV_OLD
,
jstick
->
joyIntf
);
}
return
(
jstick
->
dev
=
open
(
buf
,
flags
));
return
(
jstick
->
dev
=
open
(
buf
,
flags
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment