hid: Implement HidP_GetButtonCaps.
This commit is contained in:
parent
1e1599d961
commit
b183dc3d6e
|
@ -18,7 +18,7 @@
|
|||
@ stdcall HidD_SetFeature(long ptr long)
|
||||
@ stub HidD_SetNumInputBuffers
|
||||
@ stub HidD_SetOutputReport
|
||||
@ stub HidP_GetButtonCaps
|
||||
@ stdcall HidP_GetButtonCaps(long ptr ptr ptr)
|
||||
@ stdcall HidP_GetCaps(ptr ptr)
|
||||
@ stub HidP_GetData
|
||||
@ stub HidP_GetExtendedAttributes
|
||||
|
|
|
@ -37,6 +37,64 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(hidp);
|
||||
|
||||
NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps,
|
||||
PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData)
|
||||
{
|
||||
PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData;
|
||||
WINE_HID_REPORT *report = NULL;
|
||||
USHORT b_count = 0, r_count = 0;
|
||||
int i,j,u;
|
||||
|
||||
TRACE("(%i, %p, %p, %p)\n",ReportType, ButtonCaps, ButtonCapsLength, PreparsedData);
|
||||
|
||||
if (data->magic != HID_MAGIC)
|
||||
return HIDP_STATUS_INVALID_PREPARSED_DATA;
|
||||
|
||||
switch(ReportType)
|
||||
{
|
||||
case HidP_Input:
|
||||
b_count = data->caps.NumberInputButtonCaps;
|
||||
r_count = data->dwInputReportCount;
|
||||
report = HID_INPUT_REPORTS(data);
|
||||
break;
|
||||
case HidP_Output:
|
||||
b_count = data->caps.NumberOutputButtonCaps;
|
||||
r_count = data->dwOutputReportCount;
|
||||
report = HID_OUTPUT_REPORTS(data);
|
||||
break;
|
||||
case HidP_Feature:
|
||||
b_count = data->caps.NumberFeatureButtonCaps;
|
||||
r_count = data->dwFeatureReportCount;
|
||||
report = HID_FEATURE_REPORTS(data);
|
||||
break;
|
||||
default:
|
||||
return HIDP_STATUS_INVALID_REPORT_TYPE;
|
||||
}
|
||||
|
||||
if (!r_count || !b_count || !report)
|
||||
{
|
||||
*ButtonCapsLength = 0;
|
||||
return HIDP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
b_count = min(b_count, *ButtonCapsLength);
|
||||
|
||||
u = 0;
|
||||
for (j = 0; j < r_count && u < b_count; j++)
|
||||
{
|
||||
for (i = 0; i < report->elementCount && u < b_count; i++)
|
||||
{
|
||||
if (report->Elements[i].ElementType == ButtonElement)
|
||||
ButtonCaps[u++] = report->Elements[i].caps.button;
|
||||
}
|
||||
report = HID_NEXT_REPORT(data, report);
|
||||
}
|
||||
|
||||
*ButtonCapsLength = b_count;
|
||||
return HIDP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData,
|
||||
PHIDP_CAPS Capabilities)
|
||||
{
|
||||
|
|
|
@ -136,6 +136,7 @@ typedef struct _HIDP_CAPS
|
|||
USHORT NumberFeatureDataIndices;
|
||||
} HIDP_CAPS, *PHIDP_CAPS;
|
||||
|
||||
NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
|
||||
NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities);
|
||||
|
||||
#ifndef FACILITY_HID_ERROR_CODE
|
||||
|
|
Loading…
Reference in New Issue