Aric Stewart : hid: Implement HidP_InitializeReportForID.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 1 09:06:24 CDT 2015
Module: wine
Branch: master
Commit: 30480a236956d5e1c96d5368b4b418ead1e45d08
URL: http://source.winehq.org/git/wine.git/?a=commit;h=30480a236956d5e1c96d5368b4b418ead1e45d08
Author: Aric Stewart <aric at codeweavers.com>
Date: Tue Jun 30 07:40:10 2015 -0500
hid: Implement HidP_InitializeReportForID.
---
dlls/hid/hid.spec | 2 +-
dlls/hid/hidp.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
include/ddk/hidpi.h | 1 +
3 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec
index b8b4e7f..5659a88 100644
--- a/dlls/hid/hid.spec
+++ b/dlls/hid/hid.spec
@@ -31,7 +31,7 @@
@ stdcall HidP_GetUsages(long long long ptr ptr ptr ptr long)
@ stub HidP_GetUsagesEx
@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
-@ stub HidP_InitializeReportForID
+@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
@ stub HidP_MaxDataListLength
@ stub HidP_MaxUsageListLength
@ stub HidP_SetData
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 07c82cf..d680f78 100644
--- a/dlls/hid/hidp.c
+++ b/dlls/hid/hidp.c
@@ -358,3 +358,66 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS
*ValueCapsLength = v_count;
return HIDP_STATUS_SUCCESS;
}
+
+NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID,
+ PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report,
+ ULONG ReportLength)
+{
+ int size;
+ PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData;
+ WINE_HID_REPORT *report = NULL;
+ BOOL found=FALSE;
+ int r_count;
+ int i;
+
+ TRACE("(%i, %i, %p, %p, %i)\n",ReportType, ReportID, PreparsedData, Report, ReportLength);
+
+ if (data->magic != HID_MAGIC)
+ return HIDP_STATUS_INVALID_PREPARSED_DATA;
+
+ switch(ReportType)
+ {
+ case HidP_Input:
+ size = data->caps.InputReportByteLength;
+ report = HID_INPUT_REPORTS(data);
+ r_count = data->dwInputReportCount;
+ break;
+ case HidP_Output:
+ size = data->caps.OutputReportByteLength;
+ report = HID_OUTPUT_REPORTS(data);
+ r_count = data->dwOutputReportCount;
+ break;
+ case HidP_Feature:
+ size = data->caps.FeatureReportByteLength;
+ report = HID_FEATURE_REPORTS(data);
+ r_count = data->dwFeatureReportCount;
+ break;
+ default:
+ return HIDP_STATUS_INVALID_REPORT_TYPE;
+ }
+
+ if (!r_count || !size || !report)
+ return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
+
+ if (size != ReportLength)
+ return HIDP_STATUS_INVALID_REPORT_LENGTH;
+
+ ZeroMemory(Report, size);
+
+ for (i = 0; i < r_count; i++)
+ {
+ if (report->reportID == ReportID)
+ {
+ found = TRUE;
+ if (report->reportID)
+ Report[0] = ReportID;
+ /* TODO: Handle null and default values */
+ }
+ report = HID_NEXT_REPORT(data, report);
+ }
+
+ if (!found)
+ return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
+
+ return HIDP_STATUS_SUCCESS;
+}
diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h
index 45361d2..f4da89d 100644
--- a/include/ddk/hidpi.h
+++ b/include/ddk/hidpi.h
@@ -141,6 +141,7 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capa
NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
+NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
#ifndef FACILITY_HID_ERROR_CODE
More information about the wine-cvs
mailing list