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
a27708dc
Commit
a27708dc
authored
Sep 24, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Add haptics rumble support for UDEV lnxev devices.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e42f11d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
2 deletions
+60
-2
bus_udev.c
dlls/winebus.sys/bus_udev.c
+60
-2
No files found.
dlls/winebus.sys/bus_udev.c
View file @
a27708dc
...
@@ -126,6 +126,8 @@ struct lnxev_device
...
@@ -126,6 +126,8 @@ struct lnxev_device
BYTE
rel_map
[
HID_REL_MAX
];
BYTE
rel_map
[
HID_REL_MAX
];
BYTE
hat_map
[
8
];
BYTE
hat_map
[
8
];
BYTE
button_map
[
KEY_MAX
];
BYTE
button_map
[
KEY_MAX
];
int
haptic_effect_id
;
};
};
static
inline
struct
base_device
*
impl_from_unix_device
(
struct
unix_device
*
iface
)
static
inline
struct
base_device
*
impl_from_unix_device
(
struct
unix_device
*
iface
)
...
@@ -372,6 +374,8 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d
...
@@ -372,6 +374,8 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d
struct
input_absinfo
abs_info
[
HID_ABS_MAX
];
struct
input_absinfo
abs_info
[
HID_ABS_MAX
];
BYTE
absbits
[(
ABS_MAX
+
7
)
/
8
];
BYTE
absbits
[(
ABS_MAX
+
7
)
/
8
];
BYTE
relbits
[(
REL_MAX
+
7
)
/
8
];
BYTE
relbits
[(
REL_MAX
+
7
)
/
8
];
BYTE
ffbits
[(
FF_MAX
+
7
)
/
8
];
struct
ff_effect
effect
;
USAGE_AND_PAGE
usage
;
USAGE_AND_PAGE
usage
;
INT
i
,
button_count
,
abs_count
,
rel_count
,
hat_count
;
INT
i
,
button_count
,
abs_count
,
rel_count
,
hat_count
;
const
BYTE
*
device_usage
=
what_am_I
(
dev
);
const
BYTE
*
device_usage
=
what_am_I
(
dev
);
...
@@ -387,6 +391,11 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d
...
@@ -387,6 +391,11 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d
WARN
(
"ioctl(EVIOCGBIT, EV_ABS) failed: %d %s
\n
"
,
errno
,
strerror
(
errno
));
WARN
(
"ioctl(EVIOCGBIT, EV_ABS) failed: %d %s
\n
"
,
errno
,
strerror
(
errno
));
memset
(
absbits
,
0
,
sizeof
(
absbits
));
memset
(
absbits
,
0
,
sizeof
(
absbits
));
}
}
if
(
ioctl
(
impl
->
base
.
device_fd
,
EVIOCGBIT
(
EV_FF
,
sizeof
(
ffbits
)),
ffbits
)
==
-
1
)
{
WARN
(
"ioctl(EVIOCGBIT, EV_FF) failed: %d %s
\n
"
,
errno
,
strerror
(
errno
));
memset
(
ffbits
,
0
,
sizeof
(
ffbits
));
}
if
(
!
hid_device_begin_report_descriptor
(
iface
,
device_usage
[
0
],
device_usage
[
1
]))
if
(
!
hid_device_begin_report_descriptor
(
iface
,
device_usage
[
0
],
device_usage
[
1
]))
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
...
@@ -443,6 +452,23 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d
...
@@ -443,6 +452,23 @@ static NTSTATUS build_report_descriptor(struct unix_device *iface, struct udev_d
if
(
!
hid_device_end_input_report
(
iface
))
if
(
!
hid_device_end_input_report
(
iface
))
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
impl
->
haptic_effect_id
=
-
1
;
if
(
test_bit
(
ffbits
,
FF_RUMBLE
))
{
effect
.
id
=
-
1
;
effect
.
type
=
FF_RUMBLE
;
effect
.
replay
.
length
=
0
;
effect
.
u
.
rumble
.
strong_magnitude
=
0
;
effect
.
u
.
rumble
.
weak_magnitude
=
0
;
if
(
ioctl
(
impl
->
base
.
device_fd
,
EVIOCSFF
,
&
effect
)
==
-
1
)
WARN
(
"couldn't allocate rumble effect for haptics: %d %s
\n
"
,
errno
,
strerror
(
errno
));
else
if
(
!
hid_device_add_haptics
(
iface
))
return
FALSE
;
else
impl
->
haptic_effect_id
=
effect
.
id
;
}
if
(
!
hid_device_end_report_descriptor
(
iface
))
if
(
!
hid_device_end_report_descriptor
(
iface
))
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
...
@@ -737,10 +763,42 @@ static void lnxev_device_read_report(struct unix_device *iface)
...
@@ -737,10 +763,42 @@ static void lnxev_device_read_report(struct unix_device *iface)
static
NTSTATUS
lnxev_device_haptics_start
(
struct
unix_device
*
iface
,
DWORD
duration_ms
,
static
NTSTATUS
lnxev_device_haptics_start
(
struct
unix_device
*
iface
,
DWORD
duration_ms
,
USHORT
rumble_intensity
,
USHORT
buzz_intensity
)
USHORT
rumble_intensity
,
USHORT
buzz_intensity
)
{
{
FIXME
(
"iface %p, duration_ms %u, rumble_intensity %u, buzz_intensity %u stub!
\n
"
,
iface
,
struct
lnxev_device
*
impl
=
lnxev_impl_from_unix_device
(
iface
);
struct
ff_effect
effect
=
{
.
id
=
impl
->
haptic_effect_id
,
.
type
=
FF_RUMBLE
,
};
struct
input_event
event
;
TRACE
(
"iface %p, duration_ms %u, rumble_intensity %u, buzz_intensity %u stub!
\n
"
,
iface
,
duration_ms
,
rumble_intensity
,
buzz_intensity
);
duration_ms
,
rumble_intensity
,
buzz_intensity
);
return
STATUS_NOT_IMPLEMENTED
;
effect
.
replay
.
length
=
duration_ms
;
effect
.
u
.
rumble
.
strong_magnitude
=
rumble_intensity
;
effect
.
u
.
rumble
.
weak_magnitude
=
buzz_intensity
;
if
(
ioctl
(
impl
->
base
.
device_fd
,
EVIOCSFF
,
&
effect
)
==
-
1
)
{
effect
.
id
=
-
1
;
if
(
ioctl
(
impl
->
base
.
device_fd
,
EVIOCSFF
,
&
effect
)
==
1
)
{
WARN
(
"couldn't re-allocate rumble effect for haptics: %d %s
\n
"
,
errno
,
strerror
(
errno
));
return
STATUS_UNSUCCESSFUL
;
}
impl
->
haptic_effect_id
=
effect
.
id
;
}
event
.
type
=
EV_FF
;
event
.
code
=
effect
.
id
;
event
.
value
=
1
;
if
(
write
(
impl
->
base
.
device_fd
,
&
event
,
sizeof
(
event
))
==
-
1
)
{
WARN
(
"couldn't start haptics rumble effect: %d %s
\n
"
,
errno
,
strerror
(
errno
));
return
STATUS_UNSUCCESSFUL
;
}
return
STATUS_SUCCESS
;
}
}
static
const
struct
hid_device_vtbl
lnxev_device_vtbl
=
static
const
struct
hid_device_vtbl
lnxev_device_vtbl
=
...
...
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