Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
62876f3f
Commit
62876f3f
authored
Aug 15, 2016
by
Bruno Jesus
Committed by
Alexandre Julliard
Aug 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winejoystick.drv: Don't assume the first joystick is at the first device on Linux.
Signed-off-by:
Bruno Jesus
<
00cpxxx@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
977ba497
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
joystick_linux.c
dlls/winejoystick.drv/joystick_linux.c
+27
-8
No files found.
dlls/winejoystick.drv/joystick_linux.c
View file @
62876f3f
...
@@ -126,6 +126,7 @@ LRESULT driver_open(LPSTR str, DWORD dwIntf)
...
@@ -126,6 +126,7 @@ LRESULT driver_open(LPSTR str, DWORD dwIntf)
return
0
;
return
0
;
JSTCK_Data
[
dwIntf
].
joyIntf
=
dwIntf
;
JSTCK_Data
[
dwIntf
].
joyIntf
=
dwIntf
;
JSTCK_Data
[
dwIntf
].
dev
=
-
1
;
JSTCK_Data
[
dwIntf
].
in_use
=
TRUE
;
JSTCK_Data
[
dwIntf
].
in_use
=
TRUE
;
return
(
LRESULT
)
&
JSTCK_Data
[
dwIntf
];
return
(
LRESULT
)
&
JSTCK_Data
[
dwIntf
];
}
}
...
@@ -160,25 +161,43 @@ struct js_status
...
@@ -160,25 +161,43 @@ struct js_status
*/
*/
static
int
JSTCK_OpenDevice
(
WINE_JSTCK
*
jstick
)
static
int
JSTCK_OpenDevice
(
WINE_JSTCK
*
jstick
)
{
{
char
buf
[
20
];
char
buf
[
20
];
int
flags
;
int
flags
,
fd
,
found_ix
,
i
;
if
(
jstick
->
dev
>
0
)
if
(
jstick
->
dev
>
0
)
return
jstick
->
dev
;
return
jstick
->
dev
;
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
);
/* The first joystick may not be at /dev/input/js0, find the correct
if
((
jstick
->
dev
=
open
(
buf
,
flags
))
<
0
)
* first or second device. For example the driver for XBOX 360 wireless
return
jstick
->
dev
;
* 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
);
}
}
#ifdef HAVE_LINUX_22_JOYSTICK_API
#ifdef HAVE_LINUX_22_JOYSTICK_API
ioctl
(
jstick
->
dev
,
JSIOCGAXMAP
,
jstick
->
axesMap
);
if
(
jstick
->
dev
>
0
)
ioctl
(
jstick
->
dev
,
JSIOCGAXMAP
,
jstick
->
axesMap
);
#endif
#endif
return
jstick
->
dev
;
return
jstick
->
dev
;
}
}
...
...
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