Piotr Caban : hid: Add HidP_SetUsages implementation.

Alexandre Julliard julliard at winehq.org
Mon May 6 15:38:49 CDT 2019


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri May  3 11:59:02 2019 +0200

hid: Add HidP_SetUsages implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hid/hid.spec |  2 +-
 dlls/hid/hidp.c   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec
index 5714d6c..b50e04d 100644
--- a/dlls/hid/hid.spec
+++ b/dlls/hid/hid.spec
@@ -38,7 +38,7 @@
 @ stub HidP_SetScaledUsageValue
 @ stdcall HidP_SetUsageValue(long long long long long ptr ptr long)
 @ stub HidP_SetUsageValueArray
-@ stub HidP_SetUsages
+@ stdcall HidP_SetUsages(long long long ptr ptr ptr ptr long)
 @ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr)
 @ stub HidP_UnsetUsages
 @ stub HidP_UsageListDifference
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 7c58426..e4d4820 100644
--- a/dlls/hid/hidp.c
+++ b/dlls/hid/hidp.c
@@ -616,6 +616,38 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
 }
 
 
+NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection,
+                               PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData,
+                               PCHAR Report, ULONG ReportLength)
+{
+    WINE_HID_ELEMENT *element;
+    NTSTATUS rc;
+    ULONG i;
+
+    TRACE("(%i, %x, %i, %p, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, UsageList,
+            UsageLength, PreparsedData, Report, ReportLength);
+
+    for (i = 0; i < *UsageLength; i++)
+    {
+        rc = find_value(ReportType, UsagePage, LinkCollection,
+                UsageList[i], PreparsedData, Report, &element);
+        if (rc == HIDP_STATUS_SUCCESS)
+        {
+            rc = set_report_data((BYTE*)Report, ReportLength,
+                    element->valueStartBit, element->bitCount, -1);
+
+            if (rc != HIDP_STATUS_SUCCESS)
+            {
+                *UsageLength = i;
+                return rc;
+            }
+        }
+    }
+
+    return HIDP_STATUS_SUCCESS;
+}
+
+
 NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList,
     ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction,
     HIDP_KEYBOARD_MODIFIER_STATE *ModifierState,




More information about the wine-cvs mailing list