Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hid/hidp.c | 154 ++++++++++++++++----------------- dlls/hidclass.sys/descriptor.c | 46 +++++----- include/wine/hid.h | 7 +- 3 files changed, 101 insertions(+), 106 deletions(-)
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 3cd524d4af0..456a9d98767 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -161,7 +161,7 @@ NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAP PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT b_count = 0, r_count = 0; int i,j,u; @@ -203,8 +203,8 @@ NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAP { for (i = 0; i < report[j].elementCount && u < b_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize == 1) - ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i].caps; + if (elems[report[j].elementIdx + i].BitSize == 1) + ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i]; } }
@@ -230,10 +230,10 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData,
static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, - USHORT bit_size, WINE_HID_ELEMENT *element) + USHORT bit_size, HIDP_VALUE_CAPS *element) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i; @@ -268,16 +268,16 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT
for (i = 0; i < report->elementCount; i++) { - HIDP_VALUE_CAPS *value = &elems[report->elementIdx + i].caps; + HIDP_VALUE_CAPS *value = &elems[report->elementIdx + i];
- if ((elems[report->elementIdx + i].caps.BitSize == 1) != (bit_size == 1) || + if ((elems[report->elementIdx + i].BitSize == 1) != (bit_size == 1) || value->UsagePage != UsagePage) continue;
if (value->IsRange && value->Range.UsageMin <= Usage && Usage <= value->Range.UsageMax) { *element = elems[report->elementIdx + i]; - element->caps.StartBit += value->BitSize * (Usage - value->Range.UsageMin); + element->StartBit += value->BitSize * (Usage - value->Range.UsageMin); return HIDP_STATUS_SUCCESS; } else if (value->NotRange.Usage == Usage) @@ -290,27 +290,27 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT return HIDP_STATUS_USAGE_NOT_FOUND; }
-static LONG sign_extend(ULONG value, const WINE_HID_ELEMENT *element) +static LONG sign_extend(ULONG value, const HIDP_VALUE_CAPS *element) { - UINT bit_count = (element->caps.BitSize * element->caps.ReportCount); + UINT bit_count = (element->BitSize * element->ReportCount);
if ((value & (1 << (bit_count - 1))) - && element->caps.BitSize != 1 - && element->caps.LogicalMin < 0) + && element->BitSize != 1 + && element->LogicalMin < 0) { value -= (1 << bit_count); } return value; }
-static LONG logical_to_physical(LONG value, const WINE_HID_ELEMENT *element) +static LONG logical_to_physical(LONG value, const HIDP_VALUE_CAPS *element) { - if (element->caps.PhysicalMin || element->caps.PhysicalMax) + if (element->PhysicalMin || element->PhysicalMax) { - value = (((ULONGLONG)(value - element->caps.LogicalMin) - * (element->caps.PhysicalMax - element->caps.PhysicalMin)) - / (element->caps.LogicalMax - element->caps.LogicalMin)) - + element->caps.PhysicalMin; + value = (((ULONGLONG)(value - element->LogicalMin) + * (element->PhysicalMax - element->PhysicalMin)) + / (element->LogicalMax - element->LogicalMin)) + + element->PhysicalMin; } return value; } @@ -320,7 +320,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { NTSTATUS rc; - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength);
@@ -330,7 +330,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag { ULONG rawValue; rc = get_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, &rawValue); + element.StartBit, element.BitSize * element.ReportCount, &rawValue); if (rc != HIDP_STATUS_SUCCESS) return rc; *UsageValue = logical_to_physical(sign_extend(rawValue, &element), &element); @@ -344,7 +344,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc;
TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, @@ -355,7 +355,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return get_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, UsageValue); + element.StartBit, element.BitSize * element.ReportCount, UsageValue); }
return rc; @@ -366,7 +366,7 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage USAGE Usage, PCHAR UsageValue, USHORT UsageValueByteLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc;
TRACE("(%i, %x, %i, %i, %p, %u, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, @@ -376,11 +376,11 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage
if (rc == HIDP_STATUS_SUCCESS) { - if (element.caps.IsRange || element.caps.ReportCount <= 1 || !element.caps.BitSize || !element.caps.ReportCount) + if (element.IsRange || element.ReportCount <= 1 || !element.BitSize || !element.ReportCount) return HIDP_STATUS_NOT_VALUE_ARRAY;
- return get_report_data_array((BYTE*)Report, ReportLength, element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, - element.caps.ReportCount, UsageValue, UsageValueByteLength); + return get_report_data_array((BYTE*)Report, ReportLength, element.StartBit, element.BitSize * element.ReportCount, + element.ReportCount, UsageValue, UsageValueByteLength); }
return rc; @@ -392,7 +392,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH PCHAR Report, ULONG ReportLength) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; BOOL found = FALSE; USHORT b_count = 0, r_count = 0; @@ -433,16 +433,16 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH uCount = 0; for (i = 0; i < report->elementCount && uCount < *UsageLength; i++) { - if (elems[report->elementIdx + i].caps.BitSize == 1 && - elems[report->elementIdx + i].caps.UsagePage == UsagePage) + if (elems[report->elementIdx + i].BitSize == 1 && + elems[report->elementIdx + i].UsagePage == UsagePage) { int k; - WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) + HIDP_VALUE_CAPS *element = &elems[report->elementIdx + i]; + for (k=0; k < element->BitSize * element->ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit + k, 1, &v); + element->StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; found = TRUE; @@ -450,7 +450,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH { if (uCount == *UsageLength) return HIDP_STATUS_BUFFER_TOO_SMALL; - UsageList[uCount] = element->caps.Range.UsageMin + k; + UsageList[uCount] = element->Range.UsageMin + k; uCount++; } } @@ -470,7 +470,7 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i,j,u; @@ -512,8 +512,8 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS { for (i = 0; i < report[j].elementCount && u < v_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize != 1) - ValueCaps[u++] = elems[report[j].elementIdx + i].caps; + if (elems[report[j].elementIdx + i].BitSize != 1) + ValueCaps[u++] = elems[report[j].elementIdx + i]; } }
@@ -569,7 +569,7 @@ NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR Re 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_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; int r_count; int i; @@ -605,12 +605,12 @@ ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePag int j; for (j = 0; j < report[i].elementCount; j++) { - if (elems[report[i].elementIdx + j].caps.BitSize == 1 && - (UsagePage == 0 || elems[report[i].elementIdx + j].caps.UsagePage == UsagePage)) + if (elems[report[i].elementIdx + j].BitSize == 1 && + (UsagePage == 0 || elems[report[i].elementIdx + j].UsagePage == UsagePage)) { - if (elems[report[i].elementIdx + j].caps.IsRange) - count += (elems[report[i].elementIdx + j].caps.Range.UsageMax - - elems[report[i].elementIdx + j].caps.Range.UsageMin) + 1; + if (elems[report[i].elementIdx + j].IsRange) + count += (elems[report[i].elementIdx + j].Range.UsageMax - + elems[report[i].elementIdx + j].Range.UsageMin) + 1; else count++; } @@ -623,7 +623,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USAGE Usage, ULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc;
TRACE("(%i, %x, %i, %i, %i, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, @@ -634,7 +634,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return set_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, UsageValue); + element.StartBit, element.BitSize * element.ReportCount, UsageValue); }
return rc; @@ -645,7 +645,7 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc; ULONG i;
@@ -659,7 +659,7 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH if (rc == HIDP_STATUS_SUCCESS) { rc = set_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, -1); + element.StartBit, element.BitSize * element.ReportCount, -1); }
if (rc != HIDP_STATUS_SUCCESS) @@ -689,7 +689,7 @@ NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA*)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT b_count = 0, r_count = 0; int i,j,u; @@ -732,17 +732,17 @@ NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, { for (i = 0; i < report[j].elementCount && u < b_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize == 1 && - (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].caps.UsagePage) && - (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].caps.LinkCollection) && + if (elems[report[j].elementIdx + i].BitSize == 1 && + (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].UsagePage) && + (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].LinkCollection) && (Usage == 0 || ( - (!elems[report[j].elementIdx + i].caps.IsRange && - Usage == elems[report[j].elementIdx + i].caps.NotRange.Usage)) || - (elems[report[j].elementIdx + i].caps.IsRange && - Usage >= elems[report[j].elementIdx + i].caps.Range.UsageMin && - Usage <= elems[report[j].elementIdx + i].caps.Range.UsageMax))) + (!elems[report[j].elementIdx + i].IsRange && + Usage == elems[report[j].elementIdx + i].NotRange.Usage)) || + (elems[report[j].elementIdx + i].IsRange && + Usage >= elems[report[j].elementIdx + i].Range.UsageMin && + Usage <= elems[report[j].elementIdx + i].Range.UsageMax))) { - ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i].caps; + ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i]; } } } @@ -759,7 +759,7 @@ NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { WINE_HIDP_PREPARSED_DATA *data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i,j,u; @@ -802,12 +802,12 @@ NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, { for (i = 0; i < report[j].elementCount && u < v_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize != 1 && - (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].caps.UsagePage) && - (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].caps.LinkCollection) && - (Usage == 0 || Usage == elems[report[j].elementIdx + i].caps.NotRange.Usage)) + if (elems[report[j].elementIdx + i].BitSize != 1 && + (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].UsagePage) && + (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].LinkCollection) && + (Usage == 0 || Usage == elems[report[j].elementIdx + i].NotRange.Usage)) { - ValueCaps[u++] = elems[report[j].elementIdx + i].caps; + ValueCaps[u++] = elems[report[j].elementIdx + i]; } } } @@ -822,7 +822,7 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect ULONG *UsageLength, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength) { WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA*)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT b_count = 0, r_count = 0; int i,uCount = 0; @@ -859,23 +859,23 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect
for (i = 0; i < report->elementCount; i++) { - if (elems[report->elementIdx + i].caps.BitSize == 1) + if (elems[report->elementIdx + i].BitSize == 1) { int k; - WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) + HIDP_VALUE_CAPS *element = &elems[report->elementIdx + i]; + for (k=0; k < element->BitSize * element->ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit + k, 1, &v); + element->StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; if (v) { if (uCount < *UsageLength) { - ButtonList[uCount].Usage = element->caps.Range.UsageMin + k; - ButtonList[uCount].UsagePage = element->caps.UsagePage; + ButtonList[uCount].Usage = element->Range.UsageMin + k; + ButtonList[uCount].UsagePage = element->UsagePage; } uCount++; } @@ -919,7 +919,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U PHIDP_PREPARSED_DATA PreparsedData,CHAR *Report, ULONG ReportLength) { WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA*)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT r_count = 0; int i,uCount = 0; @@ -942,22 +942,22 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U
for (i = 0; i < report->elementCount; i++) { - WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - if (element->caps.BitSize == 1) + HIDP_VALUE_CAPS *element = &elems[report->elementIdx + i]; + if (element->BitSize == 1) { int k; - for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) + for (k=0; k < element->BitSize * element->ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit + k, 1, &v); + element->StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; if (v) { if (uCount < *DataLength) { - DataList[uCount].DataIndex = element->caps.Range.DataIndexMin + k; + DataList[uCount].DataIndex = element->Range.DataIndexMin + k; DataList[uCount].On = v; } uCount++; @@ -970,10 +970,10 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U { UINT v; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit, element->caps.BitSize * element->caps.ReportCount, &v); + element->StartBit, element->BitSize * element->ReportCount, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; - DataList[uCount].DataIndex = element->caps.NotRange.DataIndex; + DataList[uCount].DataIndex = element->NotRange.DataIndex; DataList[uCount].RawValue = v; } uCount++; diff --git a/dlls/hidclass.sys/descriptor.c b/dlls/hidclass.sys/descriptor.c index f39552c6228..f0188c4b519 100644 --- a/dlls/hidclass.sys/descriptor.c +++ b/dlls/hidclass.sys/descriptor.c @@ -186,7 +186,7 @@ static void debug_collection(struct collection *collection) static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data, WINE_HID_REPORT *report) { - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); unsigned int i; TRACE("START Report %i <<< %s report : bitSize: %i elementCount: %i\n", report->reportID, @@ -195,8 +195,8 @@ static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data, report->elementCount); for (i = 0; i < report->elementCount; i++) { - WINE_HID_ELEMENT *elem = elems + report->elementIdx + i; - TRACE("%s: %s\n", type, debugstr_hidp_value_caps(&elem->caps)); + HIDP_VALUE_CAPS *elem = elems + report->elementIdx + i; + TRACE("%s: %s\n", type, debugstr_hidp_value_caps(elem)); } TRACE(">>> END Report %i\n",report->reportID); } @@ -577,10 +577,10 @@ static int parse_descriptor(BYTE *descriptor, unsigned int index, unsigned int l return i; }
-static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems, +static void build_elements(WINE_HID_REPORT *wine_report, HIDP_VALUE_CAPS *elems, struct feature* feature, USHORT *data_index) { - WINE_HID_ELEMENT *wine_element = elems + wine_report->elementIdx + wine_report->elementCount; + HIDP_VALUE_CAPS *wine_element = elems + wine_report->elementIdx + wine_report->elementCount; ULONG index_count, bit_count;
if (!feature->isData) @@ -589,30 +589,30 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems return; }
- wine_element->caps = feature->caps; - wine_element->caps.BitField = feature->BitField; - wine_element->caps.LinkCollection = feature->collection->index; - wine_element->caps.LinkUsage = feature->collection->caps.NotRange.Usage; - wine_element->caps.LinkUsagePage = feature->collection->caps.UsagePage; - wine_element->caps.IsAbsolute = feature->IsAbsolute; - wine_element->caps.HasNull = feature->HasNull; - wine_element->caps.StartBit = wine_report->bitSize; + *wine_element = feature->caps; + wine_element->BitField = feature->BitField; + wine_element->LinkCollection = feature->collection->index; + wine_element->LinkUsage = feature->collection->caps.NotRange.Usage; + wine_element->LinkUsagePage = feature->collection->caps.UsagePage; + wine_element->IsAbsolute = feature->IsAbsolute; + wine_element->HasNull = feature->HasNull; + wine_element->StartBit = wine_report->bitSize;
- bit_count = (wine_element->caps.BitSize * wine_element->caps.ReportCount); + bit_count = (wine_element->BitSize * wine_element->ReportCount); wine_report->bitSize += bit_count;
- if (wine_element->caps.IsRange) + if (wine_element->IsRange) { - if (wine_element->caps.BitSize == 1) index_count = bit_count - 1; - else index_count = wine_element->caps.Range.UsageMax - wine_element->caps.Range.UsageMin; - wine_element->caps.Range.DataIndexMin = *data_index; - wine_element->caps.Range.DataIndexMax = *data_index + index_count; + if (wine_element->BitSize == 1) index_count = bit_count - 1; + else index_count = wine_element->Range.UsageMax - wine_element->Range.UsageMin; + wine_element->Range.DataIndexMin = *data_index; + wine_element->Range.DataIndexMax = *data_index + index_count; *data_index = *data_index + index_count + 1; } else { - wine_element->caps.NotRange.DataIndex = *data_index; - wine_element->caps.NotRange.Reserved4 = *data_index; + wine_element->NotRange.DataIndex = *data_index; + wine_element->NotRange.Reserved4 = *data_index; *data_index = *data_index + 1; }
@@ -661,7 +661,7 @@ static void create_preparse_ctx(const struct collection *base, struct preparse_c static void preparse_collection(const struct collection *root, const struct collection *base, WINE_HIDP_PREPARSED_DATA *data, struct preparse_ctx *ctx) { - WINE_HID_ELEMENT *elem = HID_ELEMS(data); + HIDP_VALUE_CAPS *elem = HID_ELEMS(data); WINE_HID_LINK_COLLECTION_NODE *nodes = HID_NODES(data); struct feature *f; struct collection *c; @@ -748,7 +748,7 @@ static WINE_HIDP_PREPARSED_DATA* build_PreparseData(struct collection *base_coll report_count = ctx.report_count[HidP_Input] + ctx.report_count[HidP_Output] + ctx.report_count[HidP_Feature]; element_off = FIELD_OFFSET(WINE_HIDP_PREPARSED_DATA, reports[report_count]); - size = element_off + (ctx.elem_count * sizeof(WINE_HID_ELEMENT)); + size = element_off + (ctx.elem_count * sizeof(HIDP_VALUE_CAPS));
nodes_offset = size; size += node_count * sizeof(WINE_HID_LINK_COLLECTION_NODE); diff --git a/include/wine/hid.h b/include/wine/hid.h index 9528e598022..15dd2cf2c0d 100644 --- a/include/wine/hid.h +++ b/include/wine/hid.h @@ -31,11 +31,6 @@
#define HID_MAGIC 0x8491759
-typedef struct __WINE_ELEMENT -{ - HIDP_VALUE_CAPS caps; -} WINE_HID_ELEMENT; - /* make sure HIDP_BUTTON_CAPS is a subset of HIDP_VALUE_CAPS */ C_ASSERT( sizeof(HIDP_BUTTON_CAPS) == sizeof(HIDP_VALUE_CAPS) );
@@ -102,7 +97,7 @@ typedef struct __WINE_HIDP_PREPARSED_DATA #define HID_INPUT_REPORTS(d) ((d)->reports) #define HID_OUTPUT_REPORTS(d) ((d)->reports + (d)->reportCount[0]) #define HID_FEATURE_REPORTS(d) ((d)->reports + (d)->reportCount[0] + (d)->reportCount[1]) -#define HID_ELEMS(d) ((WINE_HID_ELEMENT*)((BYTE*)(d) + (d)->elementOffset)) +#define HID_ELEMS(d) ((HIDP_VALUE_CAPS*)((BYTE*)(d) + (d)->elementOffset)) #define HID_NODES(d) ((WINE_HID_LINK_COLLECTION_NODE*)((BYTE*)(d) + (d)->nodesOffset))
#endif /* __WINE_PARSE_H */