Skip to content

Commit

Permalink
drivers/libhid.c: HIDGetItemData(): debug-trace failures due to strin…
Browse files Browse the repository at this point in the history
…g_to_path() or FindObject_with_Path() [#2816]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Feb 25, 2025
1 parent f6a3749 commit 38e63d3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/libhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 38e63d3

Please sign in to comment.