Lines Matching refs:dev

34 switch_has_lid(struct litest_device *dev)
36 return libinput_device_switch_has_switch(dev->libinput_device,
41 switch_has_tablet_mode(struct litest_device *dev)
43 return libinput_device_switch_has_switch(dev->libinput_device,
49 struct litest_device *dev = litest_current_device();
53 if (dev->which == LITEST_TABLET_MODE_UNRELIABLE) {
54 ck_assert(!libinput_device_has_capability(dev->libinput_device,
59 ck_assert(libinput_device_has_capability(dev->libinput_device,
67 struct litest_device *dev = litest_current_device();
69 if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_LID))
72 ck_assert_int_eq(libinput_device_switch_has_switch(dev->libinput_device,
79 tablet_mode_switch_is_reliable(struct litest_device *dev)
83 quirks_get_bool(dev->quirks,
92 struct litest_device *dev = litest_current_device();
95 if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_TABLET_MODE))
98 has_switch = libinput_device_switch_has_switch(dev->libinput_device,
101 if (!tablet_mode_switch_is_reliable(dev))
110 struct litest_device *dev = litest_current_device();
111 struct libinput *li = dev->libinput;
117 litest_grab_device(dev);
118 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON);
121 if (libinput_device_switch_has_switch(dev->libinput_device, sw) > 0) {
129 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_OFF);
132 if (libinput_device_switch_has_switch(dev->libinput_device, sw) > 0) {
139 litest_ungrab_device(dev);
145 struct litest_device *dev = litest_current_device();
146 struct libinput *li = dev->libinput;
150 if (libinput_device_switch_has_switch(dev->libinput_device, sw) <= 0)
155 litest_grab_device(dev);
156 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON);
165 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON);
169 litest_ungrab_device(dev);
174 lid_switch_is_reliable(struct litest_device *dev)
179 if (quirks_get_string(dev->quirks,
191 struct litest_device *dev = litest_current_device();
196 if (libinput_device_switch_has_switch(dev->libinput_device, sw) <= 0)
199 if (sw == LIBINPUT_SWITCH_LID && !lid_switch_is_reliable(dev))
202 litest_grab_device(dev);
203 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON);
204 litest_ungrab_device(dev);
209 libevdev_uinput_get_devnode(dev->uinput));
223 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_OFF);
236 struct litest_device *dev = litest_current_device();
241 if (libinput_device_switch_has_switch(dev->libinput_device, sw) <= 0)
244 if (sw == LIBINPUT_SWITCH_LID && lid_switch_is_reliable(dev))
247 litest_grab_device(dev);
248 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON);
249 litest_ungrab_device(dev);
254 libevdev_uinput_get_devnode(dev->uinput));
263 litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_OFF);