Commit 42be0b77 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

hid: Set button values in HidP_SetUsages function.

parent f57b8691
...@@ -190,9 +190,9 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, ...@@ -190,9 +190,9 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData,
return HIDP_STATUS_SUCCESS; return HIDP_STATUS_SUCCESS;
} }
static NTSTATUS find_value(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection,
USAGE Usage, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, USAGE Usage, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report,
WINE_HID_ELEMENT *element) WINE_ELEMENT_TYPE ElementType, WINE_HID_ELEMENT *element)
{ {
PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData;
WINE_HID_ELEMENT *elems = HID_ELEMS(data); WINE_HID_ELEMENT *elems = HID_ELEMS(data);
...@@ -232,7 +232,7 @@ static NTSTATUS find_value(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT ...@@ -232,7 +232,7 @@ static NTSTATUS find_value(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT
{ {
HIDP_VALUE_CAPS *value = &elems[report->elementIdx + i].caps.value; HIDP_VALUE_CAPS *value = &elems[report->elementIdx + i].caps.value;
if (elems[report->elementIdx + i].ElementType != ValueElement || if (elems[report->elementIdx + i].ElementType != ElementType ||
value->UsagePage != UsagePage) value->UsagePage != UsagePage)
continue; continue;
...@@ -240,13 +240,13 @@ static NTSTATUS find_value(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT ...@@ -240,13 +240,13 @@ static NTSTATUS find_value(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT
{ {
*element = elems[report->elementIdx + i]; *element = elems[report->elementIdx + i];
element->valueStartBit += value->BitSize * (Usage - value->u.Range.UsageMin); element->valueStartBit += value->BitSize * (Usage - value->u.Range.UsageMin);
element->bitCount = value->BitSize; element->bitCount = elems[report->elementIdx + i].ElementType == ValueElement ? value->BitSize: 1;
return HIDP_STATUS_SUCCESS; return HIDP_STATUS_SUCCESS;
} }
else if (value->u.NotRange.Usage == Usage) else if (value->u.NotRange.Usage == Usage)
{ {
*element = elems[report->elementIdx + i]; *element = elems[report->elementIdx + i];
element->bitCount = value->BitSize; element->bitCount = elems[report->elementIdx + i].ElementType == ValueElement ? value->BitSize : 1;
return HIDP_STATUS_SUCCESS; return HIDP_STATUS_SUCCESS;
} }
} }
...@@ -288,7 +288,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag ...@@ -288,7 +288,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag
TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue,
PreparsedData, Report, ReportLength); PreparsedData, Report, ReportLength);
rc = find_value(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, &element); rc = find_usage(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, ValueElement, &element);
if (rc == HIDP_STATUS_SUCCESS) if (rc == HIDP_STATUS_SUCCESS)
{ {
...@@ -314,7 +314,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, ...@@ -314,7 +314,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue,
PreparsedData, Report, ReportLength); PreparsedData, Report, ReportLength);
rc = find_value(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, &element); rc = find_usage(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, ValueElement, &element);
if (rc == HIDP_STATUS_SUCCESS) if (rc == HIDP_STATUS_SUCCESS)
{ {
...@@ -568,7 +568,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, ...@@ -568,7 +568,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
TRACE("(%i, %x, %i, %i, %i, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, TRACE("(%i, %x, %i, %i, %i, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue,
PreparsedData, Report, ReportLength); PreparsedData, Report, ReportLength);
rc = find_value(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, &element); rc = find_usage(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, ValueElement, &element);
if (rc == HIDP_STATUS_SUCCESS) if (rc == HIDP_STATUS_SUCCESS)
{ {
...@@ -593,8 +593,8 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH ...@@ -593,8 +593,8 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH
for (i = 0; i < *UsageLength; i++) for (i = 0; i < *UsageLength; i++)
{ {
rc = find_value(ReportType, UsagePage, LinkCollection, rc = find_usage(ReportType, UsagePage, LinkCollection,
UsageList[i], PreparsedData, Report, &element); UsageList[i], PreparsedData, Report, ButtonElement, &element);
if (rc == HIDP_STATUS_SUCCESS) if (rc == HIDP_STATUS_SUCCESS)
{ {
rc = set_report_data((BYTE*)Report, ReportLength, rc = set_report_data((BYTE*)Report, ReportLength,
......
...@@ -187,6 +187,9 @@ NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR Re ...@@ -187,6 +187,9 @@ NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR Re
ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData); ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData);
NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, ULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength); NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, ULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength,
PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext); NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext);
NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
......
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