It's only going to be used for internal HID preparsed data, to save a
custom struct.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
v2: Fix test failures caused by wine_report->bitSize which was updated
before setting the StartBit in the previous version.
dlls/hid/hidp.c | 20 ++++++++++----------
dlls/hidclass.sys/descriptor.c | 17 ++++++++---------
include/ddk/hidpi.h | 5 +++++
include/wine/hid.h | 1 -
4 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 2933c2ff7ef..4532f656008 100644
--- a/dlls/hid/hidp.c
+++ b/dlls/hid/hidp.c
@@ -277,7 +277,7 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT
if (value->IsRange && value->Range.UsageMin <= Usage && Usage <= value->Range.UsageMax)
{
*element = elems[report->elementIdx + i];
- element->valueStartBit += value->BitSize * (Usage - value->Range.UsageMin);
+ element->caps.StartBit += value->BitSize * (Usage - value->Range.UsageMin);
element->bitCount = elems[report->elementIdx + i].caps.BitSize;
return HIDP_STATUS_SUCCESS;
}
@@ -332,7 +332,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag
{
ULONG rawValue;
rc = get_report_data((BYTE*)Report, ReportLength,
- element.valueStartBit, element.bitCount, &rawValue);
+ element.caps.StartBit, element.bitCount, &rawValue);
if (rc != HIDP_STATUS_SUCCESS)
return rc;
*UsageValue = logical_to_physical(sign_extend(rawValue, &element), &element);
@@ -357,7 +357,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
if (rc == HIDP_STATUS_SUCCESS)
{
return get_report_data((BYTE*)Report, ReportLength,
- element.valueStartBit, element.bitCount, UsageValue);
+ element.caps.StartBit, element.bitCount, UsageValue);
}
return rc;
@@ -381,7 +381,7 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage
if (element.caps.IsRange || element.caps.ReportCount <= 1 || !element.bitCount)
return HIDP_STATUS_NOT_VALUE_ARRAY;
- return get_report_data_array((BYTE*)Report, ReportLength, element.valueStartBit, element.bitCount,
+ return get_report_data_array((BYTE*)Report, ReportLength, element.caps.StartBit, element.bitCount,
element.caps.ReportCount, UsageValue, UsageValueByteLength);
}
@@ -444,7 +444,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH
{
UINT v = 0;
NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength,
- element->valueStartBit + k, 1, &v);
+ element->caps.StartBit + k, 1, &v);
if (rc != HIDP_STATUS_SUCCESS)
return rc;
found = TRUE;
@@ -636,7 +636,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
if (rc == HIDP_STATUS_SUCCESS)
{
return set_report_data((BYTE*)Report, ReportLength,
- element.valueStartBit, element.bitCount, UsageValue);
+ element.caps.StartBit, element.bitCount, UsageValue);
}
return rc;
@@ -661,7 +661,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.valueStartBit, element.bitCount, -1);
+ element.caps.StartBit, element.bitCount, -1);
}
if (rc != HIDP_STATUS_SUCCESS)
@@ -869,7 +869,7 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect
{
UINT v = 0;
NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength,
- element->valueStartBit + k, 1, &v);
+ element->caps.StartBit + k, 1, &v);
if (rc != HIDP_STATUS_SUCCESS)
return rc;
if (v)
@@ -952,7 +952,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U
{
UINT v = 0;
NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength,
- element->valueStartBit + k, 1, &v);
+ element->caps.StartBit + k, 1, &v);
if (rc != HIDP_STATUS_SUCCESS)
return rc;
if (v)
@@ -972,7 +972,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U
{
UINT v;
NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength,
- element->valueStartBit, element->bitCount, &v);
+ element->caps.StartBit, element->bitCount, &v);
if (rc != HIDP_STATUS_SUCCESS)
return rc;
DataList[uCount].DataIndex = element->caps.NotRange.DataIndex;
diff --git a/dlls/hidclass.sys/descriptor.c b/dlls/hidclass.sys/descriptor.c
index 65c2f9aadae..9cf6f311fca 100644
--- a/dlls/hidclass.sys/descriptor.c
+++ b/dlls/hidclass.sys/descriptor.c
@@ -137,12 +137,12 @@ static inline const char *debugstr_hidp_value_caps( HIDP_VALUE_CAPS *caps )
{
if (!caps) return "(null)";
return wine_dbg_sprintf( "RId %d, Usg %02x:%02x-%02x Dat %02x-%02x (%d), Str %d-%d (%d), Des %d-%d (%d), "
- "Bits %02x, Als %d, Abs %d, Nul %d, LCol %d LUsg %02x:%02x, BitSz %d, RCnt %d, "
+ "Bits %02x, Als %d, Abs %d, Nul %d, LCol %d LUsg %02x:%02x, BitStrt %d, BitSz %d, RCnt %d, "
"Unit %x E%+d, Log %+d-%+d, Phy %+d-%+d",
caps->ReportID, caps->UsagePage, caps->Range.UsageMin, caps->Range.UsageMax, caps->Range.DataIndexMin, caps->Range.DataIndexMax, caps->IsRange,
caps->Range.StringMin, caps->Range.StringMax, caps->IsStringRange, caps->Range.DesignatorMin, caps->Range.DesignatorMax, caps->IsDesignatorRange,
- caps->BitField, caps->IsAlias, caps->IsAbsolute, caps->HasNull, caps->LinkCollection, caps->LinkUsagePage, caps->LinkUsage, caps->BitSize, caps->ReportCount,
- caps->Units, caps->UnitsExp, caps->LogicalMin, caps->LogicalMax, caps->PhysicalMin, caps->PhysicalMax );
+ caps->BitField, caps->IsAlias, caps->IsAbsolute, caps->HasNull, caps->LinkCollection, caps->LinkUsagePage, caps->LinkUsage, caps->StartBit,
+ caps->BitSize, caps->ReportCount, caps->Units, caps->UnitsExp, caps->LogicalMin, caps->LogicalMax, caps->PhysicalMin, caps->PhysicalMax );
}
static void debug_feature(struct feature *feature)
@@ -196,7 +196,7 @@ static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data,
for (i = 0; i < report->elementCount; i++)
{
WINE_HID_ELEMENT *elem = elems + report->elementIdx + i;
- TRACE("%s: %s, StartBit %d, BitCount %d\n", type, debugstr_hidp_value_caps(&elem->caps), elem->valueStartBit, elem->bitCount);
+ TRACE("%s: %s, BitCount %d\n", type, debugstr_hidp_value_caps(&elem->caps), elem->bitCount);
}
TRACE(">>> END Report %i\n",report->reportID);
}
@@ -589,11 +589,6 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems
return;
}
- wine_element->valueStartBit = wine_report->bitSize;
-
- wine_element->bitCount = (feature->caps.BitSize * feature->caps.ReportCount);
- wine_report->bitSize += wine_element->bitCount;
-
wine_element->caps = feature->caps;
wine_element->caps.BitField = feature->BitField;
wine_element->caps.LinkCollection = feature->collection->index;
@@ -601,6 +596,10 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems
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->bitCount = (wine_element->caps.BitSize * wine_element->caps.ReportCount);
+ wine_report->bitSize += wine_element->bitCount;
if (wine_element->caps.IsRange)
{
diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h
index fb497f3282f..9da84f38531 100644
--- a/include/ddk/hidpi.h
+++ b/include/ddk/hidpi.h
@@ -83,7 +83,12 @@ typedef struct _HIDP_VALUE_CAPS
UCHAR Reserved;
USHORT BitSize;
USHORT ReportCount;
+#ifdef __WINESRC__
+ USHORT Reserved2[3];
+ ULONG StartBit;
+#else
USHORT Reserved2[5];
+#endif
ULONG UnitsExp;
ULONG Units;
LONG LogicalMin;
diff --git a/include/wine/hid.h b/include/wine/hid.h
index cfb4f389eb9..0c0d3fdca99 100644
--- a/include/wine/hid.h
+++ b/include/wine/hid.h
@@ -33,7 +33,6 @@
typedef struct __WINE_ELEMENT
{
- UINT valueStartBit;
UINT bitCount;
HIDP_VALUE_CAPS caps;
} WINE_HID_ELEMENT;
--
2.31.0