Skip to content

Commit c83f881

Browse files
committed
windows-reconstructor: add fallback estimation for report item bit offset
HidP_SetUsageValueArray() fails with HIDP_STATUS_NOT_IMPLEMENTED when supplied with: HID_USAGE_XXX, HID_COLLECTION_LOGICAL( HID_USAGE_YYY, HID_REPORT_SIZE(8), HID_REPORT_COUNT(1), HID_LOGICAL_MIN_8(0), HID_LOGICAL_MAX_8(0xFF), HID_OUTPUT(Data_Var_Abs | Volatile_Flag), HID_USAGE_ZZZ, HID_REPORT_SIZE(2), HID_REPORT_COUNT(16), HID_LOGICAL_MIN_8(-1), HID_LOGICAL_MAX_8(1), HID_OUTPUT(Data_Var_Rel | NullState_Flag | Volatile_Flag), ), particularly the second item. With this patch the report descriptor is parsed correctly though. Signed-off-by: Benedek Kupper <kupper.benedek@gmail.com>
1 parent 534131c commit c83f881

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

HidSharp/Platform/Windows/WinHidDevice.ReportDescriptorReconstructor.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,18 @@ the capability array contains only one capability structure that describes one b
168168
}
169169
else
170170
{
171-
throw new NotImplementedException();
171+
// TODO need to set the usage value array here instead
172+
173+
// but we only want to find the bit offset, let's just do an educated guess
174+
if (reportItemIndex == 0)
175+
{
176+
reportItem.BitOffset = 0;
177+
}
178+
else
179+
{
180+
var prevItem = reportItemList[reportItemIndex - 1];
181+
reportItem.BitOffset = prevItem.BitOffset + prevItem.ReportCount * prevItem.ReportSize;
182+
}
172183
}
173184
}
174185
else

0 commit comments

Comments
 (0)