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);
302 static int uhid_send_event(struct __test_metadata *_metadata, struct uhid_device *hid,
316 return uhid_write(_metadata, hid->uhid_fd, &ev);
319 static bool match_sysfs_device(struct uhid_device *hid, const char *workdir, struct dirent *dir)
328 snprintf(target, sizeof(target), "%04X:%04X:%04X.*", hid->bus, hid->vid, hid->pid);
340 sprintf(phys, "PHYS=%d", hid->dev_id);
351 static int get_hid_id(struct uhid_device *hid)
366 if (!match_sysfs_device(hid, workdir, dir))
383 static int get_hidraw(struct uhid_device *hid)
400 if (!match_sysfs_device(hid, workdir, dir))
427 static int open_hidraw(struct uhid_device *hid)
432 hidraw_number = get_hidraw(hid);
441 static int setup_uhid(struct __test_metadata *_metadata, struct uhid_device *hid,
451 hid->dev_id = rand() % 1024;
452 hid->bus = bus;
453 hid->vid = vid;
454 hid->pid = pid;
456 hid->uhid_fd = open(path, O_RDWR | O_CLOEXEC);
457 ASSERT_GE(hid->uhid_fd, 0) TH_LOG("open uhid-cdev failed; %d", hid->uhid_fd);
459 ret = uhid_create(_metadata, hid->uhid_fd, hid->dev_id, bus, vid, pid,
463 close(hid->uhid_fd);
468 hid->hid_id = get_hid_id(hid);
469 ASSERT_GT(hid->hid_id, 0)
470 TH_LOG("Could not locate uhid device id: %d", hid->hid_id);
472 ret = uhid_start_listener(_metadata, &hid->tid, hid->uhid_fd);
475 close(hid->uhid_fd);