[Nut-upsdev] [PATCH 1/3] Skip non-feature HID reports
Russell King
rmk at armlinux.org.uk
Sun Feb 4 00:19:14 UTC 2018
Input and Output reports are used for interrupt endpoints rather than
control endpoints. HIDGetItemData() only ever requests feature
report IDs, and requesting non-feature report IDs as feature IDs may
lead to undesirable results and errors.
---
drivers/libhid.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/libhid.c b/drivers/libhid.c
index f6ec644..1cec74a 100644
--- a/drivers/libhid.c
+++ b/drivers/libhid.c
@@ -301,6 +301,13 @@ void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab)
continue;
}
#else
+ /* Skip non-feature reports, primarily for OpenUPS - but
+ * as HIDGetItemData() only cares about feature items,
+ * do it for all.
+ */
+ if (pData->Type != ITEM_FEATURE)
+ continue;
+
if ((vendorID == 0x0463) || (vendorID == 0x047c)) {
if ((pData->ReportID == 254) || (pData->ReportID == 255)) {
continue;
--
2.7.4
--
Russell King
More information about the Nut-upsdev
mailing list