return size of the descriptor, or -1 on failure */
| 383 | |
| 384 | /* return size of the descriptor, or -1 on failure */ |
| 385 | static 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 */ |
| 400 | static int parse_hid_vid_pid_from_uevent(const char *uevent, unsigned *bus_type, unsigned short *vendor_id, unsigned short *product_id) |
no test coverage detected