From 38e63d382b84c8c250548ab72056689c8d409c74 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Feb 2025 20:03:42 +0100 Subject: [PATCH] drivers/libhid.c: HIDGetItemData(): debug-trace failures due to string_to_path() or FindObject_with_Path() [#2816] Signed-off-by: Jim Klimov --- drivers/libhid.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/libhid.c b/drivers/libhid.c index a0e7f975d9..711d4623d6 100644 --- a/drivers/libhid.c +++ b/drivers/libhid.c @@ -487,15 +487,22 @@ const char *HIDDataType(const HIDData_t *hiddata) HIDData_t *HIDGetItemData(const char *hidpath, usage_tables_t *utab) { int r; - HIDPath_t Path; + HIDPath_t Path; + HIDData_t *p; r = string_to_path(hidpath, &Path, utab); if (r <= 0) { + upsdebugx(4, "%s: string_to_path() failed to decipher '%s'", __func__, hidpath); return NULL; } /* Get info on object (reportID, offset and size) */ - return FindObject_with_Path(pDesc, &Path, interrupt_only ? ITEM_INPUT:ITEM_FEATURE); + p = FindObject_with_Path(pDesc, &Path, interrupt_only ? ITEM_INPUT:ITEM_FEATURE); + + if (!p) + upsdebugx(4, "%s: FindObject_with_Path() failed to locate '%s'", __func__, hidpath); + + return p; } char *HIDGetDataItem(const HIDData_t *hiddata, usage_tables_t *utab)