Rémi Bernon : xinput1_3: Use the implicit None waveform to trigger both waveforms.

Alexandre Julliard julliard at winehq.org
Tue Feb 15 16:07:20 CST 2022


Module: wine
Branch: master
Commit: 7b72d09f59a943bc73128a567a518f9a03634062
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7b72d09f59a943bc73128a567a518f9a03634062

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Feb 15 09:03:41 2022 +0100

xinput1_3: Use the implicit None waveform to trigger both waveforms.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/xinput1_3/main.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c
index bc0baa21ebf..2966028491e 100644
--- a/dlls/xinput1_3/main.c
+++ b/dlls/xinput1_3/main.c
@@ -321,7 +321,7 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO
                                 controller->hid.haptics_rumble_ordinal, preparsed, report_buf, report_len);
     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);
+                                0, 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))
     {
@@ -338,6 +338,21 @@ 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,
                                 controller->hid.haptics_buzz_ordinal, preparsed, report_buf, report_len);
     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,
+                                0, 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))
+    {
+        WARN("HidD_SetOutputReport failed with error %lu\n", GetLastError());
+        return GetLastError();
+    }
+
+    /* trigger haptics waveforms */
+    status = HidP_InitializeReportForID(HidP_Output, report_id, preparsed, report_buf, report_len);
+    if (status != HIDP_STATUS_SUCCESS) WARN("HidP_InitializeReportForID returned %#lx\n", status);
+    status = HidP_SetUsageValue(HidP_Output, HID_USAGE_PAGE_HAPTICS, 0, HID_USAGE_HAPTICS_MANUAL_TRIGGER,
+                                controller->hid.haptics_none_ordinal, preparsed, report_buf, report_len);
+    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);




More information about the wine-cvs mailing list