winebus.sys: Add a repeat count value to haptics output report.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-02-15 09:03:40 +01:00 committed by Alexandre Julliard
parent c2c730a330
commit b65a76de53
2 changed files with 16 additions and 1 deletions

View File

@ -314,6 +314,7 @@ struct hid_haptics_waveform
{ {
UINT16 intensity; UINT16 intensity;
BYTE manual_trigger; BYTE manual_trigger;
BYTE repeat_count;
}; };
#include "poppack.h" #include "poppack.h"
@ -373,6 +374,13 @@ BOOL hid_device_add_haptics(struct unix_device *iface)
REPORT_SIZE(1, 8), REPORT_SIZE(1, 8),
REPORT_COUNT(1, 1), REPORT_COUNT(1, 1),
OUTPUT(1, Data|Var|Abs), OUTPUT(1, Data|Var|Abs),
USAGE(1, HID_USAGE_HAPTICS_REPEAT_COUNT),
LOGICAL_MINIMUM(1, 0),
LOGICAL_MAXIMUM(1, 1),
REPORT_SIZE(1, 8),
REPORT_COUNT(1, 1),
OUTPUT(1, Data|Var|Abs),
END_COLLECTION, END_COLLECTION,
}; };
@ -1066,7 +1074,8 @@ static void hid_device_set_output_report(struct unix_device *iface, HID_XFER_PAC
{ {
haptics->waveform_intensity[report->manual_trigger] = report->intensity; haptics->waveform_intensity[report->manual_trigger] = report->intensity;
duration_ms = haptics->features.waveform_cutoff_time_ms; duration_ms = haptics->features.waveform_cutoff_time_ms;
io->Status = iface->hid_vtbl->haptics_start(iface, duration_ms, *rumble_intensity, *buzz_intensity); if (!report->repeat_count) io->Status = STATUS_SUCCESS;
else io->Status = iface->hid_vtbl->haptics_start(iface, duration_ms, *rumble_intensity, *buzz_intensity);
} }
} }
} }

View File

@ -320,6 +320,9 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_MANUAL_TRIGGER, status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_MANUAL_TRIGGER,
controller->hid.haptics_rumble_ordinal, preparsed, report_buf, report_len); controller->hid.haptics_rumble_ordinal, preparsed, report_buf, report_len);
if (status != HIDP_STATUS_SUCCESS) WARN("HidP_SetUsageValue MANUAL_TRIGGER returned %#lx\n", status); if (status != HIDP_STATUS_SUCCESS) WARN("HidP_SetUsageValue MANUAL_TRIGGER returned %#lx\n", status);
status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_REPEAT_COUNT,
1, preparsed, report_buf, report_len);
if (status != HIDP_STATUS_SUCCESS) WARN("HidP_SetUsageValue REPEAT_COUNT returned %#lx\n", status);
if (!HidD_SetOutputReport(controller->device, report_buf, report_len)) if (!HidD_SetOutputReport(controller->device, report_buf, report_len))
{ {
WARN("HidD_SetOutputReport failed with error %lu\n", GetLastError()); WARN("HidD_SetOutputReport failed with error %lu\n", GetLastError());
@ -335,6 +338,9 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_MANUAL_TRIGGER, status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_MANUAL_TRIGGER,
controller->hid.haptics_buzz_ordinal, preparsed, report_buf, report_len); controller->hid.haptics_buzz_ordinal, preparsed, report_buf, report_len);
if (status != HIDP_STATUS_SUCCESS) WARN("HidP_SetUsageValue MANUAL_TRIGGER returned %#lx\n", status); if (status != HIDP_STATUS_SUCCESS) WARN("HidP_SetUsageValue MANUAL_TRIGGER returned %#lx\n", status);
status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_REPEAT_COUNT,
1, preparsed, report_buf, report_len);
if (status != HIDP_STATUS_SUCCESS) WARN("HidP_SetUsageValue REPEAT_COUNT returned %#lx\n", status);
if (!HidD_SetOutputReport(controller->device, report_buf, report_len)) if (!HidD_SetOutputReport(controller->device, report_buf, report_len))
{ {
WARN("HidD_SetOutputReport failed with error %lu\n", GetLastError()); WARN("HidD_SetOutputReport failed with error %lu\n", GetLastError());