return non-zero if successfully read/parsed */
| 468 | |
| 469 | /* return non-zero if successfully read/parsed */ |
| 470 | static int parse_hid_vid_pid_from_sysfs(const char *sysfs_path, unsigned *bus_type, unsigned short *vendor_id, unsigned short *product_id) |
| 471 | { |
| 472 | int res = 0; |
| 473 | /* Construct <sysfs_path>/device/uevent */ |
| 474 | size_t uevent_path_len = strlen(sysfs_path) + 14 + 1; |
| 475 | char* uevent_path = (char*) calloc(1, uevent_path_len); |
| 476 | snprintf(uevent_path, uevent_path_len, "%s/device/uevent", sysfs_path); |
| 477 | |
| 478 | res = parse_hid_vid_pid_from_uevent_path(uevent_path, bus_type, vendor_id, product_id); |
| 479 | free(uevent_path); |
| 480 | |
| 481 | return res; |
| 482 | } |
| 483 | |
| 484 | static int get_hid_report_descriptor_from_hidraw(hid_device *dev, struct hidraw_report_descriptor *rpt_desc) |
| 485 | { |
no test coverage detected