Commit 1174fc63 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

hid: Implement HidP_MaxUsageListLength.

parent 674080da
......@@ -33,7 +33,7 @@
@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
@ stub HidP_MaxDataListLength
@ stub HidP_MaxUsageListLength
@ stdcall HidP_MaxUsageListLength(long long ptr)
@ stub HidP_SetData
@ stub HidP_SetScaledUsageValue
@ stub HidP_SetUsageValue
......
......@@ -421,3 +421,56 @@ NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR Re
return HIDP_STATUS_SUCCESS;
}
ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData)
{
PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData;
WINE_HID_REPORT *report = NULL;
int r_count;
int i;
int count = 0;
TRACE("(%i, %x, %p)\n", ReportType, UsagePage, PreparsedData);
if (data->magic != HID_MAGIC)
return 0;
switch(ReportType)
{
case HidP_Input:
report = HID_INPUT_REPORTS(data);
r_count = data->dwInputReportCount;
break;
case HidP_Output:
report = HID_OUTPUT_REPORTS(data);
r_count = data->dwOutputReportCount;
break;
case HidP_Feature:
report = HID_FEATURE_REPORTS(data);
r_count = data->dwFeatureReportCount;
break;
default:
return HIDP_STATUS_INVALID_REPORT_TYPE;
}
if (!r_count || !report)
return 0;
for (i = 0; i < r_count; i++)
{
int j;
for (j = 0; j < report->elementCount; j++)
{
if (report->Elements[j].caps.button.UsagePage == UsagePage)
{
if (report->Elements[j].caps.button.IsRange)
count += (report->Elements[j].caps.button.u.Range.UsageMax -
report->Elements[j].caps.button.u.Range.UsageMin) + 1;
else
count++;
}
}
report = HID_NEXT_REPORT(data, report);
}
return count;
}
......@@ -142,7 +142,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH
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);
ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData);
#ifndef FACILITY_HID_ERROR_CODE
#define FACILITY_HID_ERROR_CODE 0x11
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment