• Home
  • Raw
  • Download

Lines Matching full:device

105 parse_udev_flag(struct evdev_device *device,  in parse_udev_flag()  argument
117 evdev_log_error(device, in parse_udev_flag()
128 evdev_update_key_down_count(struct evdev_device *device, in evdev_update_key_down_count() argument
136 key_count = ++device->key_count[code]; in evdev_update_key_down_count()
138 if (device->key_count[code] > 0) { in evdev_update_key_down_count()
139 key_count = --device->key_count[code]; in evdev_update_key_down_count()
141 evdev_log_bug_libinput(device, in evdev_update_key_down_count()
144 device->key_count[code]); in evdev_update_key_down_count()
149 evdev_log_bug_libinput(device, in evdev_update_key_down_count()
158 evdev_device_switch_get_state(struct evdev_device *device, in evdev_device_switch_get_state() argument
161 struct evdev_dispatch *dispatch = device->dispatch; in evdev_device_switch_get_state()
169 evdev_pointer_notify_physical_button(struct evdev_device *device, in evdev_pointer_notify_physical_button() argument
174 if (evdev_middlebutton_filter_button(device, in evdev_pointer_notify_physical_button()
180 evdev_pointer_notify_button(device, in evdev_pointer_notify_physical_button()
187 evdev_pointer_post_button(struct evdev_device *device, in evdev_pointer_post_button() argument
194 down_count = evdev_update_key_down_count(device, button, state); in evdev_pointer_post_button()
198 pointer_notify_button(&device->base, time, button, state); in evdev_pointer_post_button()
201 if (device->left_handed.change_to_enabled) in evdev_pointer_post_button()
202 device->left_handed.change_to_enabled(device); in evdev_pointer_post_button()
204 if (device->scroll.change_scroll_method) in evdev_pointer_post_button()
205 device->scroll.change_scroll_method(device); in evdev_pointer_post_button()
214 struct evdev_device *device = data; in evdev_button_scroll_timeout() local
216 device->scroll.button_scroll_state = BUTTONSCROLL_READY; in evdev_button_scroll_timeout()
220 evdev_button_scroll_button(struct evdev_device *device, in evdev_button_scroll_button() argument
226 switch (device->scroll.lock_state) { in evdev_button_scroll_button()
231 device->scroll.lock_state = BUTTONSCROLL_LOCK_FIRSTDOWN; in evdev_button_scroll_button()
232 evdev_log_debug(device, "scroll lock: first down\n"); in evdev_button_scroll_button()
236 device->scroll.lock_state = BUTTONSCROLL_LOCK_FIRSTUP; in evdev_button_scroll_button()
237 evdev_log_debug(device, "scroll lock: first up\n"); in evdev_button_scroll_button()
241 device->scroll.lock_state = BUTTONSCROLL_LOCK_SECONDDOWN; in evdev_button_scroll_button()
242 evdev_log_debug(device, "scroll lock: second down\n"); in evdev_button_scroll_button()
246 device->scroll.lock_state = BUTTONSCROLL_LOCK_IDLE; in evdev_button_scroll_button()
247 evdev_log_debug(device, "scroll lock: idle\n"); in evdev_button_scroll_button()
252 if (device->scroll.button < BTN_MOUSE + 5) { in evdev_button_scroll_button()
257 device->scroll.button_scroll_state = BUTTONSCROLL_BUTTON_DOWN; in evdev_button_scroll_button()
266 if (device->middlebutton.enabled && in evdev_button_scroll_button()
267 (device->scroll.button == BTN_LEFT || in evdev_button_scroll_button()
268 device->scroll.button == BTN_RIGHT)) { in evdev_button_scroll_button()
272 libinput_timer_set_flags(&device->scroll.timer, in evdev_button_scroll_button()
279 device->scroll.button_scroll_state = BUTTONSCROLL_READY; in evdev_button_scroll_button()
281 device->scroll.button_down_time = time; in evdev_button_scroll_button()
282 evdev_log_debug(device, "btnscroll: down\n"); in evdev_button_scroll_button()
284 libinput_timer_cancel(&device->scroll.timer); in evdev_button_scroll_button()
285 switch(device->scroll.button_scroll_state) { in evdev_button_scroll_button()
287 evdev_log_bug_libinput(device, in evdev_button_scroll_button()
292 evdev_log_debug(device, "btnscroll: cancel\n"); in evdev_button_scroll_button()
297 evdev_pointer_post_button(device, in evdev_button_scroll_button()
298 device->scroll.button_down_time, in evdev_button_scroll_button()
299 device->scroll.button, in evdev_button_scroll_button()
301 evdev_pointer_post_button(device, time, in evdev_button_scroll_button()
302 device->scroll.button, in evdev_button_scroll_button()
306 evdev_log_debug(device, "btnscroll: up\n"); in evdev_button_scroll_button()
307 evdev_stop_scroll(device, time, in evdev_button_scroll_button()
312 device->scroll.button_scroll_state = BUTTONSCROLL_IDLE; in evdev_button_scroll_button()
317 evdev_pointer_notify_button(struct evdev_device *device, in evdev_pointer_notify_button() argument
322 if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN && in evdev_pointer_notify_button()
323 button == device->scroll.button) { in evdev_pointer_notify_button()
324 evdev_button_scroll_button(device, time, state); in evdev_pointer_notify_button()
328 evdev_pointer_post_button(device, time, button, state); in evdev_pointer_notify_button()
332 evdev_device_led_update(struct evdev_device *device, enum libinput_led leds) in evdev_device_led_update() argument
345 if (!(device->seat_caps & EVDEV_DEVICE_KEYBOARD)) in evdev_device_led_update()
357 i = write(device->fd, ev, sizeof ev); in evdev_device_led_update()
362 evdev_transform_absolute(struct evdev_device *device, in evdev_transform_absolute() argument
365 if (!device->abs.apply_calibration) in evdev_transform_absolute()
368 matrix_mult_vec(&device->abs.calibration, &point->x, &point->y); in evdev_transform_absolute()
372 evdev_transform_relative(struct evdev_device *device, in evdev_transform_relative() argument
377 if (!device->abs.apply_calibration) in evdev_transform_relative()
380 matrix_to_relative(&rel_matrix, &device->abs.calibration); in evdev_transform_relative()
391 evdev_device_transform_x(struct evdev_device *device, in evdev_device_transform_x() argument
395 return scale_axis(device->abs.absinfo_x, x, width); in evdev_device_transform_x()
399 evdev_device_transform_y(struct evdev_device *device, in evdev_device_transform_y() argument
403 return scale_axis(device->abs.absinfo_y, y, height); in evdev_device_transform_y()
407 evdev_notify_axis_legacy_wheel(struct evdev_device *device, in evdev_notify_axis_legacy_wheel() argument
416 if (device->scroll.invert_horizontal_scrolling) { in evdev_notify_axis_legacy_wheel()
421 if (device->scroll.natural_scrolling_enabled) { in evdev_notify_axis_legacy_wheel()
428 pointer_notify_axis_legacy_wheel(&device->base, in evdev_notify_axis_legacy_wheel()
436 evdev_notify_axis_wheel(struct evdev_device *device, in evdev_notify_axis_wheel() argument
445 if (device->scroll.invert_horizontal_scrolling) { in evdev_notify_axis_wheel()
450 if (device->scroll.natural_scrolling_enabled) { in evdev_notify_axis_wheel()
457 pointer_notify_axis_wheel(&device->base, in evdev_notify_axis_wheel()
465 evdev_notify_axis_finger(struct evdev_device *device, in evdev_notify_axis_finger() argument
472 if (device->scroll.natural_scrolling_enabled) { in evdev_notify_axis_finger()
477 pointer_notify_axis_finger(&device->base, in evdev_notify_axis_finger()
484 evdev_notify_axis_continous(struct evdev_device *device, in evdev_notify_axis_continous() argument
491 if (device->scroll.natural_scrolling_enabled) { in evdev_notify_axis_continous()
496 pointer_notify_axis_continuous(&device->base, in evdev_notify_axis_continous()
503 evdev_tag_external_mouse(struct evdev_device *device, in evdev_tag_external_mouse() argument
508 bustype = libevdev_get_id_bustype(device->evdev); in evdev_tag_external_mouse()
510 device->tags |= EVDEV_TAG_EXTERNAL_MOUSE; in evdev_tag_external_mouse()
514 evdev_tag_trackpoint(struct evdev_device *device, in evdev_tag_trackpoint() argument
521 if (!libevdev_has_property(device->evdev, in evdev_tag_trackpoint()
523 !parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK")) in evdev_tag_trackpoint()
526 device->tags |= EVDEV_TAG_TRACKPOINT; in evdev_tag_trackpoint()
528 quirks = evdev_libinput_context(device)->quirks; in evdev_tag_trackpoint()
529 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_tag_trackpoint()
534 device->tags |= EVDEV_TAG_EXTERNAL_MOUSE; in evdev_tag_trackpoint()
535 evdev_log_info(device, in evdev_tag_trackpoint()
538 evdev_log_info(device, in evdev_tag_trackpoint()
548 evdev_tag_keyboard_internal(struct evdev_device *device) in evdev_tag_keyboard_internal() argument
550 device->tags |= EVDEV_TAG_INTERNAL_KEYBOARD; in evdev_tag_keyboard_internal()
551 device->tags &= ~EVDEV_TAG_EXTERNAL_KEYBOARD; in evdev_tag_keyboard_internal()
555 evdev_tag_keyboard_external(struct evdev_device *device) in evdev_tag_keyboard_external() argument
557 device->tags |= EVDEV_TAG_EXTERNAL_KEYBOARD; in evdev_tag_keyboard_external()
558 device->tags &= ~EVDEV_TAG_INTERNAL_KEYBOARD; in evdev_tag_keyboard_external()
562 evdev_tag_keyboard(struct evdev_device *device, in evdev_tag_keyboard() argument
570 if (!libevdev_has_event_type(device->evdev, EV_KEY)) in evdev_tag_keyboard()
574 if (!libevdev_has_event_code(device->evdev, in evdev_tag_keyboard()
580 quirks = evdev_libinput_context(device)->quirks; in evdev_tag_keyboard()
581 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_tag_keyboard()
584 evdev_tag_keyboard_internal(device); in evdev_tag_keyboard()
586 evdev_tag_keyboard_external(device); in evdev_tag_keyboard()
588 evdev_log_info(device, in evdev_tag_keyboard()
596 device->tags |= EVDEV_TAG_KEYBOARD; in evdev_tag_keyboard()
600 evdev_tag_tablet_touchpad(struct evdev_device *device) in evdev_tag_tablet_touchpad() argument
602 device->tags |= EVDEV_TAG_TABLET_TOUCHPAD; in evdev_tag_tablet_touchpad()
608 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_has_matrix() local
610 return device->abs.absinfo_x && device->abs.absinfo_y; in evdev_calibration_has_matrix()
617 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_set_matrix() local
619 evdev_device_calibrate(device, matrix); in evdev_calibration_set_matrix()
628 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_get_matrix() local
630 matrix_to_farray6(&device->abs.usermatrix, matrix); in evdev_calibration_get_matrix()
632 return !matrix_is_identity(&device->abs.usermatrix); in evdev_calibration_get_matrix()
639 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_get_default_matrix() local
641 matrix_to_farray6(&device->abs.default_calibration, matrix); in evdev_calibration_get_default_matrix()
643 return !matrix_is_identity(&device->abs.default_calibration); in evdev_calibration_get_default_matrix()
647 evdev_sendevents_get_modes(struct libinput_device *device) in evdev_sendevents_get_modes() argument
653 evdev_sendevents_set_mode(struct libinput_device *device, in evdev_sendevents_set_mode() argument
656 struct evdev_device *evdev = evdev_device(device); in evdev_sendevents_set_mode()
679 evdev_sendevents_get_mode(struct libinput_device *device) in evdev_sendevents_get_mode() argument
681 struct evdev_device *evdev = evdev_device(device); in evdev_sendevents_get_mode()
688 evdev_sendevents_get_default_mode(struct libinput_device *device) in evdev_sendevents_get_default_mode() argument
694 evdev_left_handed_has(struct libinput_device *device) in evdev_left_handed_has() argument
702 evdev_left_handed_set(struct libinput_device *device, int left_handed) in evdev_left_handed_set() argument
704 struct evdev_device *evdev = evdev_device(device); in evdev_left_handed_set()
714 evdev_left_handed_get(struct libinput_device *device) in evdev_left_handed_get() argument
716 struct evdev_device *evdev = evdev_device(device); in evdev_left_handed_get()
724 evdev_left_handed_get_default(struct libinput_device *device) in evdev_left_handed_get_default() argument
730 evdev_init_left_handed(struct evdev_device *device, in evdev_init_left_handed() argument
733 device->left_handed.config.has = evdev_left_handed_has; in evdev_init_left_handed()
734 device->left_handed.config.set = evdev_left_handed_set; in evdev_init_left_handed()
735 device->left_handed.config.get = evdev_left_handed_get; in evdev_init_left_handed()
736 device->left_handed.config.get_default = evdev_left_handed_get_default; in evdev_init_left_handed()
737 device->base.config.left_handed = &device->left_handed.config; in evdev_init_left_handed()
738 device->left_handed.enabled = false; in evdev_init_left_handed()
739 device->left_handed.want_enabled = false; in evdev_init_left_handed()
740 device->left_handed.change_to_enabled = change_to_left_handed; in evdev_init_left_handed()
744 evdev_scroll_get_methods(struct libinput_device *device) in evdev_scroll_get_methods() argument
750 evdev_scroll_set_method(struct libinput_device *device, in evdev_scroll_set_method() argument
753 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_set_method()
762 evdev_scroll_get_method(struct libinput_device *device) in evdev_scroll_get_method() argument
764 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_method()
772 evdev_scroll_get_default_method(struct libinput_device *device) in evdev_scroll_get_default_method() argument
774 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_default_method()
790 evdev_scroll_set_button(struct libinput_device *device, in evdev_scroll_set_button() argument
793 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_set_button()
802 evdev_scroll_get_button(struct libinput_device *device) in evdev_scroll_get_button() argument
804 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_button()
812 evdev_scroll_get_default_button(struct libinput_device *device) in evdev_scroll_get_default_button() argument
814 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_default_button()
832 evdev_scroll_set_button_lock(struct libinput_device *device, in evdev_scroll_set_button_lock() argument
835 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_set_button_lock()
854 evdev_scroll_get_button_lock(struct libinput_device *device) in evdev_scroll_get_button_lock() argument
856 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_button_lock()
865 evdev_scroll_get_default_button_lock(struct libinput_device *device) in evdev_scroll_get_default_button_lock() argument
871 evdev_set_button_scroll_lock_enabled(struct evdev_device *device, in evdev_set_button_scroll_lock_enabled() argument
875 device->scroll.lock_state = BUTTONSCROLL_LOCK_IDLE; in evdev_set_button_scroll_lock_enabled()
877 device->scroll.lock_state = BUTTONSCROLL_LOCK_DISABLED; in evdev_set_button_scroll_lock_enabled()
881 evdev_init_button_scroll(struct evdev_device *device, in evdev_init_button_scroll() argument
889 evdev_device_get_sysname(device)); in evdev_init_button_scroll()
890 libinput_timer_init(&device->scroll.timer, in evdev_init_button_scroll()
891 evdev_libinput_context(device), in evdev_init_button_scroll()
893 evdev_button_scroll_timeout, device); in evdev_init_button_scroll()
894 device->scroll.config.get_methods = evdev_scroll_get_methods; in evdev_init_button_scroll()
895 device->scroll.config.set_method = evdev_scroll_set_method; in evdev_init_button_scroll()
896 device->scroll.config.get_method = evdev_scroll_get_method; in evdev_init_button_scroll()
897 device->scroll.config.get_default_method = evdev_scroll_get_default_method; in evdev_init_button_scroll()
898 device->scroll.config.set_button = evdev_scroll_set_button; in evdev_init_button_scroll()
899 device->scroll.config.get_button = evdev_scroll_get_button; in evdev_init_button_scroll()
900 device->scroll.config.get_default_button = evdev_scroll_get_default_button; in evdev_init_button_scroll()
901 device->scroll.config.set_button_lock = evdev_scroll_set_button_lock; in evdev_init_button_scroll()
902 device->scroll.config.get_button_lock = evdev_scroll_get_button_lock; in evdev_init_button_scroll()
903 device->scroll.config.get_default_button_lock = evdev_scroll_get_default_button_lock; in evdev_init_button_scroll()
904 device->base.config.scroll_method = &device->scroll.config; in evdev_init_button_scroll()
905 device->scroll.method = evdev_scroll_get_default_method((struct libinput_device *)device); in evdev_init_button_scroll()
906 device->scroll.want_method = device->scroll.method; in evdev_init_button_scroll()
907 device->scroll.button = evdev_scroll_get_default_button((struct libinput_device *)device); in evdev_init_button_scroll()
908 device->scroll.want_button = device->scroll.button; in evdev_init_button_scroll()
909 device->scroll.change_scroll_method = change_scroll_method; in evdev_init_button_scroll()
913 evdev_init_calibration(struct evdev_device *device, in evdev_init_calibration() argument
916 device->base.config.calibration = calibration; in evdev_init_calibration()
925 evdev_init_sendevents(struct evdev_device *device, in evdev_init_sendevents() argument
928 device->base.config.sendevents = &dispatch->sendevents.config; in evdev_init_sendevents()
938 evdev_scroll_config_natural_has(struct libinput_device *device) in evdev_scroll_config_natural_has() argument
944 evdev_scroll_config_natural_set(struct libinput_device *device, in evdev_scroll_config_natural_set() argument
947 struct evdev_device *dev = evdev_device(device); in evdev_scroll_config_natural_set()
955 evdev_scroll_config_natural_get(struct libinput_device *device) in evdev_scroll_config_natural_get() argument
957 struct evdev_device *dev = evdev_device(device); in evdev_scroll_config_natural_get()
963 evdev_scroll_config_natural_get_default(struct libinput_device *device) in evdev_scroll_config_natural_get_default() argument
970 evdev_init_natural_scroll(struct evdev_device *device) in evdev_init_natural_scroll() argument
972 device->scroll.config_natural.has = evdev_scroll_config_natural_has; in evdev_init_natural_scroll()
973 device->scroll.config_natural.set_enabled = evdev_scroll_config_natural_set; in evdev_init_natural_scroll()
974 device->scroll.config_natural.get_enabled = evdev_scroll_config_natural_get; in evdev_init_natural_scroll()
975 device->scroll.config_natural.get_default_enabled = evdev_scroll_config_natural_get_default; in evdev_init_natural_scroll()
976 device->scroll.natural_scrolling_enabled = false; in evdev_init_natural_scroll()
977 device->base.config.natural_scroll = &device->scroll.config_natural; in evdev_init_natural_scroll()
981 evdev_need_mtdev(struct evdev_device *device) in evdev_need_mtdev() argument
983 struct libevdev *evdev = device->evdev; in evdev_need_mtdev()
994 evdev_is_fake_mt_device(struct evdev_device *device) in evdev_is_fake_mt_device() argument
996 struct libevdev *evdev = device->evdev; in evdev_is_fake_mt_device()
1003 evdev_read_switch_reliability_prop(struct evdev_device *device) in evdev_read_switch_reliability_prop() argument
1010 quirks = evdev_libinput_context(device)->quirks; in evdev_read_switch_reliability_prop()
1011 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_switch_reliability_prop()
1015 evdev_log_error(device, in evdev_read_switch_reliability_prop()
1017 device->devname, in evdev_read_switch_reliability_prop()
1021 evdev_log_info(device, "will write switch open events\n"); in evdev_read_switch_reliability_prop()
1031 evdev_print_event(struct evdev_device *device, in evdev_print_event() argument
1046 evdev_log_debug(device, in evdev_print_event()
1054 evdev_log_debug(device, in evdev_print_event()
1065 evdev_process_event(struct evdev_device *device, struct input_event *e) in evdev_process_event() argument
1067 struct evdev_dispatch *dispatch = device->dispatch; in evdev_process_event()
1071 evdev_print_event(device, e); in evdev_process_event()
1074 libinput_timer_flush(evdev_libinput_context(device), time); in evdev_process_event()
1076 dispatch->interface->process(dispatch, device, e, time); in evdev_process_event()
1080 evdev_device_dispatch_one(struct evdev_device *device, in evdev_device_dispatch_one() argument
1083 if (!device->mtdev) { in evdev_device_dispatch_one()
1084 evdev_process_event(device, ev); in evdev_device_dispatch_one()
1086 mtdev_put_event(device->mtdev, ev); in evdev_device_dispatch_one()
1088 while (!mtdev_empty(device->mtdev)) { in evdev_device_dispatch_one()
1090 mtdev_get_event(device->mtdev, &e); in evdev_device_dispatch_one()
1091 evdev_process_event(device, &e); in evdev_device_dispatch_one()
1098 evdev_sync_device(struct evdev_device *device) in evdev_sync_device() argument
1104 rc = libevdev_next_event(device->evdev, in evdev_sync_device()
1108 evdev_device_dispatch_one(device, &ev); in evdev_sync_device()
1115 evdev_note_time_delay(struct evdev_device *device, in evdev_note_time_delay() argument
1118 struct libinput *libinput = evdev_libinput_context(device); in evdev_note_time_delay()
1134 evdev_log_bug_client_ratelimit(device, in evdev_note_time_delay()
1135 &device->delay_warning_limit, in evdev_note_time_delay()
1144 struct evdev_device *device = data; in evdev_device_dispatch() local
1145 struct libinput *libinput = evdev_libinput_context(device); in evdev_device_dispatch()
1154 rc = libevdev_next_event(device->evdev, in evdev_device_dispatch()
1157 evdev_log_info_ratelimit(device, in evdev_device_dispatch()
1158 &device->syn_drop_limit, in evdev_device_dispatch()
1165 evdev_device_dispatch_one(device, &ev); in evdev_device_dispatch()
1167 rc = evdev_sync_device(device); in evdev_device_dispatch()
1172 evdev_note_time_delay(device, &ev); in evdev_device_dispatch()
1175 evdev_device_dispatch_one(device, &ev); in evdev_device_dispatch()
1177 evdev_device_remove(device); in evdev_device_dispatch()
1183 libinput_remove_source(libinput, device->source); in evdev_device_dispatch()
1184 device->source = NULL; in evdev_device_dispatch()
1189 evdev_init_accel(struct evdev_device *device, in evdev_init_accel() argument
1196 else if (device->tags & EVDEV_TAG_TRACKPOINT) { in evdev_init_accel()
1198 filter = create_pointer_accelerator_filter_trackpoint_flat(device->trackpoint_multiplier); in evdev_init_accel()
1200 filter = create_pointer_accelerator_filter_trackpoint(device->trackpoint_multiplier, in evdev_init_accel()
1201 device->use_velocity_averaging); in evdev_init_accel()
1204 filter = create_pointer_accelerator_filter_flat(device->dpi); in evdev_init_accel()
1205 else if (device->dpi < DEFAULT_MOUSE_DPI) in evdev_init_accel()
1206 filter = create_pointer_accelerator_filter_linear_low_dpi(device->dpi, in evdev_init_accel()
1207 device->use_velocity_averaging); in evdev_init_accel()
1211 filter = create_pointer_accelerator_filter_linear(device->dpi, in evdev_init_accel()
1212 device->use_velocity_averaging); in evdev_init_accel()
1217 evdev_device_init_pointer_acceleration(device, filter); in evdev_init_accel()
1223 evdev_accel_config_available(struct libinput_device *device) in evdev_accel_config_available() argument
1231 evdev_accel_config_set_speed(struct libinput_device *device, double speed) in evdev_accel_config_set_speed() argument
1233 struct evdev_device *dev = evdev_device(device); in evdev_accel_config_set_speed()
1242 evdev_accel_config_get_speed(struct libinput_device *device) in evdev_accel_config_get_speed() argument
1244 struct evdev_device *dev = evdev_device(device); in evdev_accel_config_get_speed()
1250 evdev_accel_config_get_default_speed(struct libinput_device *device) in evdev_accel_config_get_default_speed() argument
1258 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_get_profiles() local
1260 if (!device->pointer.filter) in evdev_accel_config_get_profiles()
1272 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_set_profile() local
1276 filter = device->pointer.filter; in evdev_accel_config_set_profile()
1281 device->pointer.filter = NULL; in evdev_accel_config_set_profile()
1283 if (evdev_init_accel(device, profile)) { in evdev_accel_config_set_profile()
1287 device->pointer.filter = filter; in evdev_accel_config_set_profile()
1297 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_get_profile() local
1299 return filter_get_type(device->pointer.filter); in evdev_accel_config_get_profile()
1305 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_get_default_profile() local
1307 if (!device->pointer.filter) in evdev_accel_config_get_default_profile()
1310 /* No device has a flat profile as default */ in evdev_accel_config_get_default_profile()
1329 evdev_device_init_pointer_acceleration(struct evdev_device *device, in evdev_device_init_pointer_acceleration() argument
1332 device->pointer.filter = filter; in evdev_device_init_pointer_acceleration()
1334 if (device->base.config.accel == NULL) { in evdev_device_init_pointer_acceleration()
1337 device->pointer.config.available = evdev_accel_config_available; in evdev_device_init_pointer_acceleration()
1338 device->pointer.config.set_speed = evdev_accel_config_set_speed; in evdev_device_init_pointer_acceleration()
1339 device->pointer.config.get_speed = evdev_accel_config_get_speed; in evdev_device_init_pointer_acceleration()
1340 device->pointer.config.get_default_speed = evdev_accel_config_get_default_speed; in evdev_device_init_pointer_acceleration()
1341 device->pointer.config.get_profiles = evdev_accel_config_get_profiles; in evdev_device_init_pointer_acceleration()
1342 device->pointer.config.set_profile = evdev_accel_config_set_profile; in evdev_device_init_pointer_acceleration()
1343 device->pointer.config.get_profile = evdev_accel_config_get_profile; in evdev_device_init_pointer_acceleration()
1344 device->pointer.config.get_default_profile = evdev_accel_config_get_default_profile; in evdev_device_init_pointer_acceleration()
1345 device->pointer.config.set_accel_config = evdev_set_accel_config; in evdev_device_init_pointer_acceleration()
1346 device->base.config.accel = &device->pointer.config; in evdev_device_init_pointer_acceleration()
1348 default_speed = evdev_accel_config_get_default_speed(&device->base); in evdev_device_init_pointer_acceleration()
1349 evdev_accel_config_set_speed(&device->base, default_speed); in evdev_device_init_pointer_acceleration()
1354 evdev_read_wheel_click_prop(struct evdev_device *device, in evdev_read_wheel_click_prop() argument
1361 prop = udev_device_get_property_value(device->udev_device, prop); in evdev_read_wheel_click_prop()
1371 evdev_log_error(device, in evdev_read_wheel_click_prop()
1380 evdev_read_wheel_click_count_prop(struct evdev_device *device, in evdev_read_wheel_click_count_prop() argument
1386 prop = udev_device_get_property_value(device->udev_device, prop); in evdev_read_wheel_click_count_prop()
1396 evdev_log_error(device, in evdev_read_wheel_click_count_prop()
1406 evdev_read_wheel_click_props(struct evdev_device *device) in evdev_read_wheel_click_props() argument
1415 if (evdev_read_wheel_click_count_prop(device, wheel_count, &angles.y) || in evdev_read_wheel_click_props()
1416 evdev_read_wheel_click_prop(device, wheel_angle, &angles.y)) { in evdev_read_wheel_click_props()
1417 evdev_log_debug(device, in evdev_read_wheel_click_props()
1420 if (evdev_read_wheel_click_count_prop(device, hwheel_count, &angles.x) || in evdev_read_wheel_click_props()
1421 evdev_read_wheel_click_prop(device, hwheel_angle, &angles.x)) { in evdev_read_wheel_click_props()
1422 evdev_log_debug(device, in evdev_read_wheel_click_props()
1432 evdev_get_trackpoint_multiplier(struct evdev_device *device) in evdev_get_trackpoint_multiplier() argument
1438 if (!(device->tags & EVDEV_TAG_TRACKPOINT)) in evdev_get_trackpoint_multiplier()
1441 quirks = evdev_libinput_context(device)->quirks; in evdev_get_trackpoint_multiplier()
1442 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_get_trackpoint_multiplier()
1449 evdev_log_bug_libinput(device, in evdev_get_trackpoint_multiplier()
1456 evdev_log_info(device, in evdev_get_trackpoint_multiplier()
1464 evdev_need_velocity_averaging(struct evdev_device *device) in evdev_need_velocity_averaging() argument
1470 quirks = evdev_libinput_context(device)->quirks; in evdev_need_velocity_averaging()
1471 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_need_velocity_averaging()
1480 evdev_log_info(device, in evdev_need_velocity_averaging()
1487 evdev_read_dpi_prop(struct evdev_device *device) in evdev_read_dpi_prop() argument
1492 if (device->tags & EVDEV_TAG_TRACKPOINT) in evdev_read_dpi_prop()
1495 mouse_dpi = udev_device_get_property_value(device->udev_device, in evdev_read_dpi_prop()
1500 evdev_log_error(device, in evdev_read_dpi_prop()
1506 evdev_log_info(device, in evdev_read_dpi_prop()
1507 "device set to %d DPI\n", in evdev_read_dpi_prop()
1515 evdev_read_model_flags(struct evdev_device *device) in evdev_read_model_flags() argument
1538 quirks = evdev_libinput_context(device)->quirks; in evdev_read_model_flags()
1539 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_model_flags()
1550 evdev_log_debug(device, in evdev_read_model_flags()
1555 evdev_log_debug(device, in evdev_read_model_flags()
1567 if (parse_udev_flag(device, in evdev_read_model_flags()
1568 device->udev_device, in evdev_read_model_flags()
1570 evdev_log_debug(device, "tagged as trackball\n"); in evdev_read_model_flags()
1575 * Device is 6 years old at the time of writing this and this was in evdev_read_model_flags()
1579 if (parse_udev_flag(device, in evdev_read_model_flags()
1580 device->udev_device, in evdev_read_model_flags()
1582 evdev_log_debug(device, "tagged as trackball\n"); in evdev_read_model_flags()
1586 if (parse_udev_flag(device, device->udev_device, in evdev_read_model_flags()
1588 evdev_log_debug(device, "is a test device\n"); in evdev_read_model_flags()
1596 evdev_read_attr_res_prop(struct evdev_device *device, in evdev_read_attr_res_prop() argument
1605 quirks = evdev_libinput_context(device)->quirks; in evdev_read_attr_res_prop()
1606 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_attr_res_prop()
1622 evdev_read_attr_size_prop(struct evdev_device *device, in evdev_read_attr_size_prop() argument
1631 quirks = evdev_libinput_context(device)->quirks; in evdev_read_attr_size_prop()
1632 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_attr_size_prop()
1647 /* Return 1 if the device is set to the fake resolution or 0 otherwise */
1649 evdev_fix_abs_resolution(struct evdev_device *device, in evdev_fix_abs_resolution() argument
1653 struct libevdev *evdev = device->evdev; in evdev_fix_abs_resolution()
1661 evdev_log_bug_libinput(device, in evdev_fix_abs_resolution()
1675 * If a device needs this, add it to 60-evdev.hwdb. The libinput in evdev_fix_abs_resolution()
1679 if (!evdev_read_attr_res_prop(device, &xres, &yres) && in evdev_fix_abs_resolution()
1680 evdev_read_attr_size_prop(device, &widthmm, &heightmm)) { in evdev_fix_abs_resolution()
1694 evdev_device_get_udev_tags(struct evdev_device *device, in evdev_device_get_udev_tags() argument
1704 if (parse_udev_flag(device, in evdev_device_get_udev_tags()
1716 evdev_fix_android_mt(struct evdev_device *device) in evdev_fix_android_mt() argument
1718 struct libevdev *evdev = device->evdev; in evdev_fix_android_mt()
1726 evdev_is_fake_mt_device(device)) in evdev_fix_android_mt()
1736 evdev_check_min_max(struct evdev_device *device, unsigned int code) in evdev_check_min_max() argument
1738 struct libevdev *evdev = device->evdev; in evdev_check_min_max()
1753 evdev_log_info(device, in evdev_check_min_max()
1754 "disabling EV_ABS %#x on device (min == max == 0)\n", in evdev_check_min_max()
1756 libevdev_disable_event_code(device->evdev, in evdev_check_min_max()
1760 evdev_log_bug_kernel(device, in evdev_check_min_max()
1761 "device has min == max on %s\n", in evdev_check_min_max()
1771 evdev_reject_device(struct evdev_device *device) in evdev_reject_device() argument
1773 struct libevdev *evdev = device->evdev; in evdev_reject_device()
1785 if (!evdev_is_fake_mt_device(device) && in evdev_reject_device()
1795 evdev_log_bug_kernel(device, in evdev_reject_device()
1801 if (!evdev_is_fake_mt_device(device) && in evdev_reject_device()
1807 evdev_log_bug_kernel(device, in evdev_reject_device()
1820 if (!evdev_check_min_max(device, code)) in evdev_reject_device()
1829 evdev_extract_abs_axes(struct evdev_device *device, in evdev_extract_abs_axes() argument
1832 struct libevdev *evdev = device->evdev; in evdev_extract_abs_axes()
1839 if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) in evdev_extract_abs_axes()
1840 device->abs.is_fake_resolution = true; in evdev_extract_abs_axes()
1843 fuzz = evdev_read_fuzz_prop(device, ABS_X); in evdev_extract_abs_axes()
1845 fuzz = evdev_read_fuzz_prop(device, ABS_Y); in evdev_extract_abs_axes()
1849 device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); in evdev_extract_abs_axes()
1850 device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); in evdev_extract_abs_axes()
1851 device->abs.dimensions.x = abs((int)absinfo_range(device->abs.absinfo_x)); in evdev_extract_abs_axes()
1852 device->abs.dimensions.y = abs((int)absinfo_range(device->abs.absinfo_y)); in evdev_extract_abs_axes()
1854 if (evdev_is_fake_mt_device(device) || in evdev_extract_abs_axes()
1859 if (evdev_fix_abs_resolution(device, in evdev_extract_abs_axes()
1862 device->abs.is_fake_resolution = true; in evdev_extract_abs_axes()
1864 if ((fuzz = evdev_read_fuzz_prop(device, ABS_MT_POSITION_X))) in evdev_extract_abs_axes()
1866 if ((fuzz = evdev_read_fuzz_prop(device, ABS_MT_POSITION_Y))) in evdev_extract_abs_axes()
1869 device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); in evdev_extract_abs_axes()
1870 device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y); in evdev_extract_abs_axes()
1871 device->abs.dimensions.x = abs((int)absinfo_range(device->abs.absinfo_x)); in evdev_extract_abs_axes()
1872 device->abs.dimensions.y = abs((int)absinfo_range(device->abs.absinfo_y)); in evdev_extract_abs_axes()
1873 device->is_mt = 1; in evdev_extract_abs_axes()
1877 evdev_disable_accelerometer_axes(struct evdev_device *device) in evdev_disable_accelerometer_axes() argument
1879 struct libevdev *evdev = device->evdev; in evdev_disable_accelerometer_axes()
1891 evdev_device_is_joystick_or_gamepad(struct evdev_device *device) in evdev_device_is_joystick_or_gamepad() argument
1895 struct libevdev *evdev = device->evdev; in evdev_device_is_joystick_or_gamepad()
1906 * 1. The device is tagged as joystick but not as tablet in evdev_device_is_joystick_or_gamepad()
1907 * 2. The device doesn't have 4 well-known keyboard keys in evdev_device_is_joystick_or_gamepad()
1911 udev_tags = evdev_device_get_udev_tags(device, device->udev_device); in evdev_device_is_joystick_or_gamepad()
1969 evdev_configure_device(struct evdev_device *device) in evdev_configure_device() argument
1971 struct libevdev *evdev = device->evdev; in evdev_configure_device()
1976 udev_tags = evdev_device_get_udev_tags(device, device->udev_device); in evdev_configure_device()
1980 evdev_log_info(device, in evdev_configure_device()
1981 "not tagged as supported input device\n"); in evdev_configure_device()
1985 evdev_log_info(device, in evdev_configure_device()
2002 evdev_log_info(device, in evdev_configure_device()
2003 "device is an accelerometer, ignoring\n"); in evdev_configure_device()
2008 evdev_disable_accelerometer_axes(device); in evdev_configure_device()
2011 if (evdev_device_is_joystick_or_gamepad(device)) { in evdev_configure_device()
2012 evdev_log_info(device, in evdev_configure_device()
2013 "device is a joystick or a gamepad, ignoring\n"); in evdev_configure_device()
2017 if (evdev_reject_device(device)) { in evdev_configure_device()
2018 evdev_log_info(device, "was rejected\n"); in evdev_configure_device()
2022 if (!evdev_is_fake_mt_device(device)) in evdev_configure_device()
2023 evdev_fix_android_mt(device); in evdev_configure_device()
2026 evdev_extract_abs_axes(device, udev_tags); in evdev_configure_device()
2028 if (evdev_is_fake_mt_device(device)) in evdev_configure_device()
2032 if (evdev_device_has_model_quirk(device, in evdev_configure_device()
2034 dispatch = evdev_totem_create(device); in evdev_configure_device()
2035 device->seat_caps |= EVDEV_DEVICE_TABLET; in evdev_configure_device()
2036 evdev_log_info(device, "device is a totem\n"); in evdev_configure_device()
2042 interface for the touch device */ in evdev_configure_device()
2049 dispatch = evdev_tablet_pad_create(device); in evdev_configure_device()
2050 device->seat_caps |= EVDEV_DEVICE_TABLET_PAD; in evdev_configure_device()
2051 evdev_log_info(device, "device is a tablet pad\n"); in evdev_configure_device()
2057 dispatch = evdev_tablet_create(device); in evdev_configure_device()
2058 device->seat_caps |= EVDEV_DEVICE_TABLET; in evdev_configure_device()
2059 evdev_log_info(device, "device is a tablet\n"); in evdev_configure_device()
2065 evdev_tag_tablet_touchpad(device); in evdev_configure_device()
2067 device->use_velocity_averaging = evdev_need_velocity_averaging(device); in evdev_configure_device()
2068 dispatch = evdev_mt_touchpad_create(device); in evdev_configure_device()
2069 evdev_log_info(device, "device is a touchpad\n"); in evdev_configure_device()
2075 evdev_tag_external_mouse(device, device->udev_device); in evdev_configure_device()
2076 evdev_tag_trackpoint(device, device->udev_device); in evdev_configure_device()
2077 if (device->tags & EVDEV_TAG_TRACKPOINT) in evdev_configure_device()
2078 device->trackpoint_multiplier = evdev_get_trackpoint_multiplier(device); in evdev_configure_device()
2080 device->dpi = evdev_read_dpi_prop(device); in evdev_configure_device()
2082 device->use_velocity_averaging = evdev_need_velocity_averaging(device); in evdev_configure_device()
2084 device->seat_caps |= EVDEV_DEVICE_POINTER; in evdev_configure_device()
2086 evdev_log_info(device, "device is a pointer\n"); in evdev_configure_device()
2089 device->left_handed.want_enabled = true; in evdev_configure_device()
2091 device->scroll.natural_scrolling_enabled = true; in evdev_configure_device()
2095 device->scroll.want_button = 1; in evdev_configure_device()
2099 device->seat_caps |= EVDEV_DEVICE_KEYBOARD; in evdev_configure_device()
2100 evdev_log_info(device, "device is a keyboard\n"); in evdev_configure_device()
2105 device->scroll.natural_scrolling_enabled = true; in evdev_configure_device()
2106 device->seat_caps |= EVDEV_DEVICE_POINTER; in evdev_configure_device()
2109 evdev_tag_keyboard(device, device->udev_device); in evdev_configure_device()
2113 device->seat_caps |= EVDEV_DEVICE_TOUCH; in evdev_configure_device()
2114 evdev_log_info(device, "device is a touch device\n"); in evdev_configure_device()
2119 device->seat_caps |= EVDEV_DEVICE_SWITCH; in evdev_configure_device()
2120 device->tags |= EVDEV_TAG_LID_SWITCH; in evdev_configure_device()
2124 if (evdev_device_has_model_quirk(device, in evdev_configure_device()
2126 evdev_log_info(device, in evdev_configure_device()
2127 "device is an unreliable tablet mode switch, filtering events.\n"); in evdev_configure_device()
2128 libevdev_disable_event_code(device->evdev, in evdev_configure_device()
2132 device->tags |= EVDEV_TAG_TABLET_MODE_SWITCH; in evdev_configure_device()
2133 device->seat_caps |= EVDEV_DEVICE_SWITCH; in evdev_configure_device()
2137 if (device->seat_caps & EVDEV_DEVICE_SWITCH) in evdev_configure_device()
2138 evdev_log_info(device, "device is a switch device\n"); in evdev_configure_device()
2141 if (device->seat_caps & EVDEV_DEVICE_POINTER && in evdev_configure_device()
2144 !evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)) { in evdev_configure_device()
2145 evdev_log_error(device, in evdev_configure_device()
2150 if (evdev_device_has_model_quirk(device, QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING)) { in evdev_configure_device()
2151 device->scroll.invert_horizontal_scrolling = true; in evdev_configure_device()
2154 return fallback_dispatch_create(&device->base); in evdev_configure_device()
2158 evdev_notify_added_device(struct evdev_device *device) in evdev_notify_added_device() argument
2162 list_for_each(dev, &device->base.seat->devices_list, link) { in evdev_notify_added_device()
2164 if (dev == &device->base) in evdev_notify_added_device()
2167 /* Notify existing device d about addition of device */ in evdev_notify_added_device()
2169 d->dispatch->interface->device_added(d, device); in evdev_notify_added_device()
2171 /* Notify new device about existing device d */ in evdev_notify_added_device()
2172 if (device->dispatch->interface->device_added) in evdev_notify_added_device()
2173 device->dispatch->interface->device_added(device, d); in evdev_notify_added_device()
2175 /* Notify new device if existing device d is suspended */ in evdev_notify_added_device()
2177 device->dispatch->interface->device_suspended) in evdev_notify_added_device()
2178 device->dispatch->interface->device_suspended(device, d); in evdev_notify_added_device()
2181 notify_added_device(&device->base); in evdev_notify_added_device()
2183 if (device->dispatch->interface->post_added) in evdev_notify_added_device()
2184 device->dispatch->interface->post_added(device, in evdev_notify_added_device()
2185 device->dispatch); in evdev_notify_added_device()
2212 evdev_set_device_group(struct evdev_device *device, in evdev_set_device_group() argument
2215 struct libinput *libinput = evdev_libinput_context(device); in evdev_set_device_group()
2228 libinput_device_set_device_group(&device->base, group); in evdev_set_device_group()
2231 libinput_device_set_device_group(&device->base, group); in evdev_set_device_group()
2249 evdev_pre_configure_model_quirks(struct evdev_device *device) in evdev_pre_configure_model_quirks() argument
2258 if (evdev_device_has_model_quirk(device, QUIRK_MODEL_HP_ZBOOK_STUDIO_G3)) in evdev_pre_configure_model_quirks()
2259 libevdev_set_abs_maximum(device->evdev, ABS_MT_SLOT, 1); in evdev_pre_configure_model_quirks()
2264 quirks = evdev_libinput_context(device)->quirks; in evdev_pre_configure_model_quirks()
2265 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_pre_configure_model_quirks()
2269 libevdev_disable_event_code(device->evdev, EV_MSC, MSC_TIMESTAMP); in evdev_pre_configure_model_quirks()
2285 libevdev_enable_event_type(device->evdev, type); in evdev_pre_configure_model_quirks()
2287 libevdev_disable_event_type(device->evdev, type); in evdev_pre_configure_model_quirks()
2290 libevdev_enable_event_code(device->evdev, in evdev_pre_configure_model_quirks()
2295 libevdev_disable_event_code(device->evdev, in evdev_pre_configure_model_quirks()
2299 evdev_log_debug(device, in evdev_pre_configure_model_quirks()
2315 libevdev_enable_property(device->evdev, p); in evdev_pre_configure_model_quirks()
2319 libevdev_disable_property(device->evdev, p); in evdev_pre_configure_model_quirks()
2321 evdev_log_error(device, in evdev_pre_configure_model_quirks()
2322 "quirks: a quirk for this device requires newer libevdev than installed\n"); in evdev_pre_configure_model_quirks()
2325 evdev_log_debug(device, in evdev_pre_configure_model_quirks()
2387 struct evdev_device *device = NULL; in evdev_device_create() local
2395 log_info(libinput, "%s: no device node associated\n", sysname); in evdev_device_create()
2400 log_debug(libinput, "%s: device is ignored\n", sysname); in evdev_device_create()
2411 "%s: opening input device '%s' failed (%s).\n", in evdev_device_create()
2421 device = zalloc(sizeof *device); in evdev_device_create()
2422 device->sysname = sysname; in evdev_device_create()
2425 libinput_device_init(&device->base, seat); in evdev_device_create()
2430 rc = libevdev_new_from_fd(fd, &device->evdev); in evdev_device_create()
2434 libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC); in evdev_device_create()
2435 libevdev_set_device_log_function(device->evdev, in evdev_device_create()
2439 device->seat_caps = 0; in evdev_device_create()
2440 device->is_mt = 0; in evdev_device_create()
2441 device->mtdev = NULL; in evdev_device_create()
2442 device->udev_device = udev_device_ref(udev_device); in evdev_device_create()
2443 device->dispatch = NULL; in evdev_device_create()
2444 device->fd = fd; in evdev_device_create()
2445 device->devname = libevdev_get_name(device->evdev); in evdev_device_create()
2448 device->log_prefix_name = str_sanitize(device->devname); in evdev_device_create()
2449 device->scroll.threshold = 5.0; /* Default may be overridden */ in evdev_device_create()
2450 device->scroll.direction_lock_threshold = 5.0; /* Default may be overridden */ in evdev_device_create()
2451 device->scroll.direction = 0; in evdev_device_create()
2452 device->scroll.wheel_click_angle = in evdev_device_create()
2453 evdev_read_wheel_click_props(device); in evdev_device_create()
2454 device->model_flags = evdev_read_model_flags(device); in evdev_device_create()
2455 device->dpi = DEFAULT_MOUSE_DPI; in evdev_device_create()
2458 ratelimit_init(&device->syn_drop_limit, s2us(30), 5); in evdev_device_create()
2460 ratelimit_init(&device->delay_warning_limit, s2us(60 * 60), 5); in evdev_device_create()
2462 ratelimit_init(&device->nonpointer_rel_limit, s2us(5), 5); in evdev_device_create()
2464 matrix_init_identity(&device->abs.calibration); in evdev_device_create()
2465 matrix_init_identity(&device->abs.usermatrix); in evdev_device_create()
2466 matrix_init_identity(&device->abs.default_calibration); in evdev_device_create()
2468 evdev_pre_configure_model_quirks(device); in evdev_device_create()
2470 device->dispatch = evdev_configure_device(device); in evdev_device_create()
2471 if (device->dispatch == NULL || device->seat_caps == 0) in evdev_device_create()
2474 device->source = in evdev_device_create()
2475 libinput_add_fd(libinput, fd, evdev_device_dispatch, device); in evdev_device_create()
2476 if (!device->source) in evdev_device_create()
2479 if (!evdev_set_device_group(device, udev_device)) in evdev_device_create()
2482 list_insert(seat->devices_list.prev, &device->base.link); in evdev_device_create()
2484 evdev_notify_added_device(device); in evdev_device_create()
2486 return device; in evdev_device_create()
2491 if (device) { in evdev_device_create()
2492 unhandled_device = device->seat_caps == 0; in evdev_device_create()
2493 evdev_device_destroy(device); in evdev_device_create()
2503 evdev_device_get_output(struct evdev_device *device) in evdev_device_get_output() argument
2505 return device->output_name; in evdev_device_get_output()
2509 evdev_device_get_sysname(struct evdev_device *device) in evdev_device_get_sysname() argument
2511 return device->sysname; in evdev_device_get_sysname()
2515 evdev_device_get_name(struct evdev_device *device) in evdev_device_get_name() argument
2517 return device->devname; in evdev_device_get_name()
2521 evdev_device_get_id_product(struct evdev_device *device) in evdev_device_get_id_product() argument
2523 return libevdev_get_id_product(device->evdev); in evdev_device_get_id_product()
2527 evdev_device_get_id_vendor(struct evdev_device *device) in evdev_device_get_id_vendor() argument
2529 return libevdev_get_id_vendor(device->evdev); in evdev_device_get_id_vendor()
2533 evdev_device_get_udev_device(struct evdev_device *device) in evdev_device_get_udev_device() argument
2535 return udev_device_ref(device->udev_device); in evdev_device_get_udev_device()
2539 evdev_device_set_default_calibration(struct evdev_device *device, in evdev_device_set_default_calibration() argument
2542 matrix_from_farray6(&device->abs.default_calibration, calibration); in evdev_device_set_default_calibration()
2543 evdev_device_calibrate(device, calibration); in evdev_device_set_default_calibration()
2547 evdev_device_calibrate(struct evdev_device *device, in evdev_device_calibrate() argument
2556 device->abs.apply_calibration = !matrix_is_identity(&transform); in evdev_device_calibrate()
2559 matrix_from_farray6(&device->abs.usermatrix, calibration); in evdev_device_calibrate()
2561 if (!device->abs.apply_calibration) { in evdev_device_calibrate()
2562 matrix_init_identity(&device->abs.calibration); in evdev_device_calibrate()
2566 sx = absinfo_range(device->abs.absinfo_x); in evdev_device_calibrate()
2567 sy = absinfo_range(device->abs.absinfo_y); in evdev_device_calibrate()
2576 * normalized to multiples of the device width and height, in evdev_device_calibrate()
2577 * respectively. e.g. c == 1 shifts one device-width to the right. in evdev_device_calibrate()
2582 * Normalize: scales the device coordinates to [0,1] in evdev_device_calibrate()
2584 * Un-Normalize: scales back up to device coordinates in evdev_device_calibrate()
2591 device->abs.absinfo_x->minimum, in evdev_device_calibrate()
2592 device->abs.absinfo_y->minimum); in evdev_device_calibrate()
2601 -device->abs.absinfo_x->minimum/sx, in evdev_device_calibrate()
2602 -device->abs.absinfo_y->minimum/sy); in evdev_device_calibrate()
2606 /* store final matrix in device */ in evdev_device_calibrate()
2607 matrix_mult(&device->abs.calibration, &transform, &scale); in evdev_device_calibrate()
2611 evdev_read_calibration_prop(struct evdev_device *device) in evdev_read_calibration_prop() argument
2616 prop = udev_device_get_property_value(device->udev_device, in evdev_read_calibration_prop()
2622 if (!device->abs.absinfo_x || !device->abs.absinfo_y) in evdev_read_calibration_prop()
2628 evdev_device_set_default_calibration(device, calibration); in evdev_read_calibration_prop()
2629 evdev_log_info(device, in evdev_read_calibration_prop()
2640 evdev_read_fuzz_prop(struct evdev_device *device, unsigned int code) in evdev_read_fuzz_prop() argument
2652 prop = udev_device_get_property_value(device->udev_device, name); in evdev_read_fuzz_prop()
2654 evdev_log_bug_libinput(device, in evdev_read_fuzz_prop()
2663 * device. Otherwise, the kernel will use the nonzero fuzz, we then in evdev_read_fuzz_prop()
2667 abs = libevdev_get_abs_info(device->evdev, code); in evdev_read_fuzz_prop()
2672 evdev_log_bug_libinput(device, in evdev_read_fuzz_prop()
2677 evdev_log_bug_libinput(device, in evdev_read_fuzz_prop()
2687 evdev_device_has_capability(struct evdev_device *device, in evdev_device_has_capability() argument
2692 return !!(device->seat_caps & EVDEV_DEVICE_POINTER); in evdev_device_has_capability()
2694 return !!(device->seat_caps & EVDEV_DEVICE_KEYBOARD); in evdev_device_has_capability()
2696 return !!(device->seat_caps & EVDEV_DEVICE_TOUCH); in evdev_device_has_capability()
2698 return !!(device->seat_caps & EVDEV_DEVICE_GESTURE); in evdev_device_has_capability()
2700 return !!(device->seat_caps & EVDEV_DEVICE_TABLET); in evdev_device_has_capability()
2702 return !!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD); in evdev_device_has_capability()
2704 return !!(device->seat_caps & EVDEV_DEVICE_SWITCH); in evdev_device_has_capability()
2711 evdev_device_get_size(const struct evdev_device *device, in evdev_device_get_size() argument
2717 x = libevdev_get_abs_info(device->evdev, ABS_X); in evdev_device_get_size()
2718 y = libevdev_get_abs_info(device->evdev, ABS_Y); in evdev_device_get_size()
2720 if (!x || !y || device->abs.is_fake_resolution || in evdev_device_get_size()
2731 evdev_device_has_button(struct evdev_device *device, uint32_t code) in evdev_device_has_button() argument
2733 if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) in evdev_device_has_button()
2736 return libevdev_has_event_code(device->evdev, EV_KEY, code); in evdev_device_has_button()
2740 evdev_device_has_key(struct evdev_device *device, uint32_t code) in evdev_device_has_key() argument
2742 if (!(device->seat_caps & EVDEV_DEVICE_KEYBOARD)) in evdev_device_has_key()
2745 return libevdev_has_event_code(device->evdev, EV_KEY, code); in evdev_device_has_key()
2749 evdev_device_get_touch_count(struct evdev_device *device) in evdev_device_get_touch_count() argument
2753 if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) in evdev_device_get_touch_count()
2756 ntouches = libevdev_get_num_slots(device->evdev); in evdev_device_get_touch_count()
2759 * how many. Otherwise, any touch device with num_slots of in evdev_device_get_touch_count()
2760 * -1 is a single-touch device */ in evdev_device_get_touch_count()
2761 if (device->mtdev) in evdev_device_get_touch_count()
2771 evdev_device_has_switch(struct evdev_device *device, in evdev_device_has_switch() argument
2776 if (!(device->seat_caps & EVDEV_DEVICE_SWITCH)) in evdev_device_has_switch()
2790 return libevdev_has_event_code(device->evdev, EV_SW, code); in evdev_device_has_switch()
2794 evdev_is_scrolling(const struct evdev_device *device, in evdev_is_scrolling() argument
2800 return (device->scroll.direction & bit(axis)) != 0; in evdev_is_scrolling()
2804 evdev_start_scrolling(struct evdev_device *device, in evdev_start_scrolling() argument
2810 device->scroll.direction |= bit(axis); in evdev_start_scrolling()
2814 evdev_post_scroll(struct evdev_device *device, in evdev_post_scroll() argument
2822 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2824 device->scroll.buildup.y += delta->y; in evdev_post_scroll()
2825 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2827 device->scroll.buildup.x += delta->x; in evdev_post_scroll()
2829 trigger = &device->scroll.buildup; in evdev_post_scroll()
2833 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2835 !evdev_is_scrolling(device, in evdev_post_scroll()
2837 if (fabs(trigger->y) >= device->scroll.threshold) in evdev_post_scroll()
2838 evdev_start_scrolling(device, in evdev_post_scroll()
2840 if (fabs(trigger->x) >= device->scroll.threshold) in evdev_post_scroll()
2841 evdev_start_scrolling(device, in evdev_post_scroll()
2845 } else if (!evdev_is_scrolling(device, in evdev_post_scroll()
2847 if (fabs(delta->y) >= device->scroll.direction_lock_threshold) in evdev_post_scroll()
2848 evdev_start_scrolling(device, in evdev_post_scroll()
2850 } else if (!evdev_is_scrolling(device, in evdev_post_scroll()
2852 if (fabs(delta->x) >= device->scroll.direction_lock_threshold) in evdev_post_scroll()
2853 evdev_start_scrolling(device, in evdev_post_scroll()
2862 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2866 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2871 uint32_t axes = device->scroll.direction; in evdev_post_scroll()
2880 evdev_notify_axis_finger(device, time, axes, &event); in evdev_post_scroll()
2883 evdev_notify_axis_continous(device, time, axes, &event); in evdev_post_scroll()
2886 evdev_log_bug_libinput(device, in evdev_post_scroll()
2895 evdev_stop_scroll(struct evdev_device *device, in evdev_stop_scroll() argument
2902 if (device->scroll.direction != 0) { in evdev_stop_scroll()
2905 pointer_notify_axis_finger(&device->base, in evdev_stop_scroll()
2907 device->scroll.direction, in evdev_stop_scroll()
2911 pointer_notify_axis_continuous(&device->base, in evdev_stop_scroll()
2913 device->scroll.direction, in evdev_stop_scroll()
2917 evdev_log_bug_libinput(device, in evdev_stop_scroll()
2924 device->scroll.buildup.x = 0; in evdev_stop_scroll()
2925 device->scroll.buildup.y = 0; in evdev_stop_scroll()
2926 device->scroll.direction = 0; in evdev_stop_scroll()
2930 evdev_notify_suspended_device(struct evdev_device *device) in evdev_notify_suspended_device() argument
2934 if (device->is_suspended) in evdev_notify_suspended_device()
2937 list_for_each(it, &device->base.seat->devices_list, link) { in evdev_notify_suspended_device()
2939 if (it == &device->base) in evdev_notify_suspended_device()
2943 d->dispatch->interface->device_suspended(d, device); in evdev_notify_suspended_device()
2946 device->is_suspended = true; in evdev_notify_suspended_device()
2950 evdev_notify_resumed_device(struct evdev_device *device) in evdev_notify_resumed_device() argument
2954 if (!device->is_suspended) in evdev_notify_resumed_device()
2957 list_for_each(it, &device->base.seat->devices_list, link) { in evdev_notify_resumed_device()
2959 if (it == &device->base) in evdev_notify_resumed_device()
2963 d->dispatch->interface->device_resumed(d, device); in evdev_notify_resumed_device()
2966 device->is_suspended = false; in evdev_notify_resumed_device()
2970 evdev_device_suspend(struct evdev_device *device) in evdev_device_suspend() argument
2972 struct libinput *libinput = evdev_libinput_context(device); in evdev_device_suspend()
2974 evdev_notify_suspended_device(device); in evdev_device_suspend()
2976 if (device->dispatch->interface->suspend) in evdev_device_suspend()
2977 device->dispatch->interface->suspend(device->dispatch, in evdev_device_suspend()
2978 device); in evdev_device_suspend()
2980 if (device->source) { in evdev_device_suspend()
2981 libinput_remove_source(libinput, device->source); in evdev_device_suspend()
2982 device->source = NULL; in evdev_device_suspend()
2985 if (device->mtdev) { in evdev_device_suspend()
2986 mtdev_close_delete(device->mtdev); in evdev_device_suspend()
2987 device->mtdev = NULL; in evdev_device_suspend()
2990 if (device->fd != -1) { in evdev_device_suspend()
2991 close_restricted(libinput, device->fd); in evdev_device_suspend()
2992 device->fd = -1; in evdev_device_suspend()
2997 evdev_device_resume(struct evdev_device *device) in evdev_device_resume() argument
2999 struct libinput *libinput = evdev_libinput_context(device); in evdev_device_resume()
3005 if (device->fd != -1) in evdev_device_resume()
3008 if (device->was_removed) in evdev_device_resume()
3011 devnode = udev_device_get_devnode(device->udev_device); in evdev_device_resume()
3021 if (!evdev_device_have_same_syspath(device->udev_device, fd)) { in evdev_device_resume()
3028 device->fd = fd; in evdev_device_resume()
3030 if (evdev_need_mtdev(device)) { in evdev_device_resume()
3031 device->mtdev = mtdev_new_open(device->fd); in evdev_device_resume()
3032 if (!device->mtdev) in evdev_device_resume()
3036 libevdev_change_fd(device->evdev, fd); in evdev_device_resume()
3037 libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC); in evdev_device_resume()
3039 /* re-sync libevdev's view of the device, but discard the actual in evdev_device_resume()
3040 events. Our device is in a neutral state already */ in evdev_device_resume()
3041 libevdev_next_event(device->evdev, in evdev_device_resume()
3045 status = libevdev_next_event(device->evdev, in evdev_device_resume()
3050 device->source = in evdev_device_resume()
3051 libinput_add_fd(libinput, fd, evdev_device_dispatch, device); in evdev_device_resume()
3052 if (!device->source) { in evdev_device_resume()
3053 mtdev_close_delete(device->mtdev); in evdev_device_resume()
3057 evdev_notify_resumed_device(device); in evdev_device_resume()
3063 evdev_device_remove(struct evdev_device *device) in evdev_device_remove() argument
3067 evdev_log_info(device, "device removed\n"); in evdev_device_remove()
3069 libinput_timer_cancel(&device->scroll.timer); in evdev_device_remove()
3070 libinput_timer_cancel(&device->middlebutton.timer); in evdev_device_remove()
3072 list_for_each(dev, &device->base.seat->devices_list, link) { in evdev_device_remove()
3074 if (dev == &device->base) in evdev_device_remove()
3078 d->dispatch->interface->device_removed(d, device); in evdev_device_remove()
3081 evdev_device_suspend(device); in evdev_device_remove()
3083 if (device->dispatch->interface->remove) in evdev_device_remove()
3084 device->dispatch->interface->remove(device->dispatch); in evdev_device_remove()
3086 /* A device may be removed while suspended, mark it to in evdev_device_remove()
3087 * skip re-opening a different device with the same node */ in evdev_device_remove()
3088 device->was_removed = true; in evdev_device_remove()
3090 list_remove(&device->base.link); in evdev_device_remove()
3092 notify_removed_device(&device->base); in evdev_device_remove()
3093 libinput_device_unref(&device->base); in evdev_device_remove()
3097 evdev_device_destroy(struct evdev_device *device) in evdev_device_destroy() argument
3101 dispatch = device->dispatch; in evdev_device_destroy()
3105 if (device->base.group) in evdev_device_destroy()
3106 libinput_device_group_unref(device->base.group); in evdev_device_destroy()
3108 free(device->log_prefix_name); in evdev_device_destroy()
3109 free(device->sysname); in evdev_device_destroy()
3110 free(device->output_name); in evdev_device_destroy()
3111 filter_destroy(device->pointer.filter); in evdev_device_destroy()
3112 libinput_timer_destroy(&device->scroll.timer); in evdev_device_destroy()
3113 libinput_timer_destroy(&device->middlebutton.timer); in evdev_device_destroy()
3114 libinput_seat_unref(device->base.seat); in evdev_device_destroy()
3115 libevdev_free(device->evdev); in evdev_device_destroy()
3116 udev_device_unref(device->udev_device); in evdev_device_destroy()
3117 free(device); in evdev_device_destroy()
3121 evdev_tablet_has_left_handed(struct evdev_device *device) in evdev_tablet_has_left_handed() argument
3125 struct libinput *li = evdev_libinput_context(device); in evdev_tablet_has_left_handed()
3136 devnode = udev_device_get_devnode(device->udev_device); in evdev_tablet_has_left_handed()
3146 evdev_log_info(device, in evdev_tablet_has_left_handed()
3148 device->devname); in evdev_tablet_has_left_handed()
3150 evdev_log_error(device, in evdev_tablet_has_left_handed()