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
d48e2508
Commit
d48e2508
authored
Mar 19, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus: Add HID usages in the device descriptor when possible.
As a hint for the frontend to decide whether to use hidraw. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56450
parent
eac5ad2a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
7 deletions
+16
-7
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+4
-5
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+4
-0
bus_udev.c
dlls/winebus.sys/bus_udev.c
+3
-0
unixlib.h
dlls/winebus.sys/unixlib.h
+5
-2
No files found.
dlls/winebus.sys/bus_iohid.c
View file @
d48e2508
...
...
@@ -276,18 +276,17 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
};
struct
iohid_device
*
impl
;
CFStringRef
str
;
UINT
usage_page
,
usage
;
usage_p
age
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDPrimaryUsagePageKey
)));
u
sage
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDPrimaryUsageKey
)));
desc
.
usages
.
UsageP
age
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDPrimaryUsagePageKey
)));
desc
.
usages
.
U
sage
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDPrimaryUsageKey
)));
desc
.
vid
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDVendorIDKey
)));
desc
.
pid
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDProductIDKey
)));
desc
.
version
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDVersionNumberKey
)));
desc
.
uid
=
CFNumberToDWORD
(
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDLocationIDKey
)));
if
(
usage_p
age
!=
HID_USAGE_PAGE_GENERIC
||
!
(
usage
==
HID_USAGE_GENERIC_JOYSTICK
||
u
sage
==
HID_USAGE_GENERIC_GAMEPAD
))
if
(
desc
.
usages
.
UsageP
age
!=
HID_USAGE_PAGE_GENERIC
||
!
(
desc
.
usages
.
Usage
==
HID_USAGE_GENERIC_JOYSTICK
||
desc
.
usages
.
U
sage
==
HID_USAGE_GENERIC_GAMEPAD
))
{
/* winebus isn't currently meant to handle anything but these, and
* opening keyboards, mice, or the Touch Bar on older MacBooks triggers
...
...
dlls/winebus.sys/bus_sdl.c
View file @
d48e2508
...
...
@@ -990,6 +990,8 @@ static void sdl_add_device(unsigned int index)
if
(
controller
)
{
desc
.
is_gamepad
=
TRUE
;
desc
.
usages
.
UsagePage
=
HID_USAGE_PAGE_GENERIC
;
desc
.
usages
.
Usage
=
HID_USAGE_GENERIC_GAMEPAD
;
axis_count
=
6
;
}
else
...
...
@@ -997,6 +999,8 @@ static void sdl_add_device(unsigned int index)
int
button_count
=
pSDL_JoystickNumButtons
(
joystick
);
axis_count
=
pSDL_JoystickNumAxes
(
joystick
);
desc
.
is_gamepad
=
(
axis_count
==
6
&&
button_count
>=
14
);
desc
.
usages
.
UsagePage
=
HID_USAGE_PAGE_GENERIC
;
desc
.
usages
.
Usage
=
HID_USAGE_GENERIC_JOYSTICK
;
}
for
(
axis_offset
=
0
;
axis_offset
<
axis_count
;
axis_offset
+=
(
options
.
split_controllers
?
6
:
axis_count
))
...
...
dlls/winebus.sys/bus_udev.c
View file @
d48e2508
...
...
@@ -1332,6 +1332,7 @@ static void udev_add_device(struct udev_device *dev, int fd)
#ifdef HAS_PROPER_INPUT_HEADER
else
if
(
!
strcmp
(
subsystem
,
"input"
))
{
const
USAGE_AND_PAGE
device_usage
=
*
what_am_I
(
dev
,
fd
);
static
const
WCHAR
evdev
[]
=
{
'e'
,
'v'
,
'd'
,
'e'
,
'v'
,
0
};
struct
input_id
device_id
=
{
0
};
char
buffer
[
MAX_PATH
];
...
...
@@ -1352,6 +1353,8 @@ static void udev_add_device(struct udev_device *dev, int fd)
if
(
!
desc
.
serialnumber
[
0
]
&&
ioctl
(
fd
,
EVIOCGUNIQ
(
sizeof
(
buffer
)),
buffer
)
>=
0
)
ntdll_umbstowcs
(
buffer
,
strlen
(
buffer
)
+
1
,
desc
.
serialnumber
,
ARRAY_SIZE
(
desc
.
serialnumber
));
desc
.
usages
=
device_usage
;
}
#endif
...
...
dlls/winebus.sys/unixlib.h
View file @
d48e2508
...
...
@@ -25,6 +25,7 @@
#include <winbase.h>
#include <winternl.h>
#include <ddk/hidclass.h>
#include <ddk/hidpi.h>
#include <hidusage.h>
#include "wine/debug.h"
...
...
@@ -37,6 +38,7 @@ struct device_desc
UINT
version
;
UINT
input
;
UINT
uid
;
USAGE_AND_PAGE
usages
;
BOOL
is_gamepad
;
BOOL
is_hidraw
;
...
...
@@ -148,8 +150,9 @@ enum unix_funcs
static
inline
const
char
*
debugstr_device_desc
(
struct
device_desc
*
desc
)
{
if
(
!
desc
)
return
"(null)"
;
return
wine_dbg_sprintf
(
"{vid %04x, pid %04x, version %04x, input %d, uid %08x, is_gamepad %u, is_hidraw %u}"
,
desc
->
vid
,
desc
->
pid
,
desc
->
version
,
desc
->
input
,
desc
->
uid
,
desc
->
is_gamepad
,
desc
->
is_hidraw
);
return
wine_dbg_sprintf
(
"{vid %04x, pid %04x, version %04x, input %d, uid %08x, usage %04x:%04x, is_gamepad %u, is_hidraw %u}"
,
desc
->
vid
,
desc
->
pid
,
desc
->
version
,
desc
->
input
,
desc
->
uid
,
desc
->
usages
.
UsagePage
,
desc
->
usages
.
Usage
,
desc
->
is_gamepad
,
desc
->
is_hidraw
);
}
static
inline
BOOL
is_xbox_gamepad
(
WORD
vid
,
WORD
pid
)
...
...
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