Lines Matching defs:hid
161 static void uhid_destroy(struct __test_metadata *_metadata, struct uhid_device *hid)
168 uhid_write(_metadata, hid->uhid_fd, &ev);
296 static int uhid_send_event(struct __test_metadata *_metadata, struct uhid_device *hid,
310 return uhid_write(_metadata, hid->uhid_fd, &ev);
313 static bool match_sysfs_device(struct uhid_device *hid, const char *workdir, struct dirent *dir)
322 snprintf(target, sizeof(target), "%04X:%04X:%04X.*", hid->bus, hid->vid, hid->pid);
334 sprintf(phys, "PHYS=%d", hid->dev_id);
345 static int get_hid_id(struct uhid_device *hid)
360 if (!match_sysfs_device(hid, workdir, dir))
377 static int get_hidraw(struct uhid_device *hid)
394 if (!match_sysfs_device(hid, workdir, dir))
421 static int open_hidraw(struct uhid_device *hid)
426 hidraw_number = get_hidraw(hid);
435 static int setup_uhid(struct __test_metadata *_metadata, struct uhid_device *hid,
445 hid->dev_id = rand() % 1024;
446 hid->bus = bus;
447 hid->vid = vid;
448 hid->pid = pid;
450 hid->uhid_fd = open(path, O_RDWR | O_CLOEXEC);
451 ASSERT_GE(hid->uhid_fd, 0) TH_LOG("open uhid-cdev failed; %d", hid->uhid_fd);
453 ret = uhid_create(_metadata, hid->uhid_fd, hid->dev_id, bus, vid, pid,
457 close(hid->uhid_fd);
462 hid->hid_id = get_hid_id(hid);
463 ASSERT_GT(hid->hid_id, 0)
464 TH_LOG("Could not locate uhid device id: %d", hid->hid_id);
466 ret = uhid_start_listener(_metadata, &hid->tid, hid->uhid_fd);
469 close(hid->uhid_fd);