MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / get_hid_report_descriptor_from_sysfs

Function get_hid_report_descriptor_from_sysfs

lib/hidapi/linux/hid.c:385–397  ·  view source on GitHub ↗

return size of the descriptor, or -1 on failure */

Source from the content-addressed store, hash-verified

383
384/* return size of the descriptor, or -1 on failure */
385static int get_hid_report_descriptor_from_sysfs(const char *sysfs_path, struct hidraw_report_descriptor *rpt_desc)
386{
387 int res = -1;
388 /* Construct <sysfs_path>/device/report_descriptor */
389 size_t rpt_path_len = strlen(sysfs_path) + 25 + 1;
390 char* rpt_path = (char*) calloc(1, rpt_path_len);
391 snprintf(rpt_path, rpt_path_len, "%s/device/report_descriptor", sysfs_path);
392
393 res = get_hid_report_descriptor(rpt_path, rpt_desc);
394 free(rpt_path);
395
396 return res;
397}
398
399/* return non-zero if successfully parsed */
400static int parse_hid_vid_pid_from_uevent(const char *uevent, unsigned *bus_type, unsigned short *vendor_id, unsigned short *product_id)

Callers 1

Calls 1

Tested by

no test coverage detected