• Home
  • Raw
  • Download

Lines Matching refs:device

94 parse_udev_flag(struct evdev_device *device,  in parse_udev_flag()  argument
107 evdev_log_error(device, in parse_udev_flag()
115 evdev_update_key_down_count(struct evdev_device *device, in evdev_update_key_down_count() argument
123 key_count = ++device->key_count[code]; in evdev_update_key_down_count()
125 assert(device->key_count[code] > 0); in evdev_update_key_down_count()
126 key_count = --device->key_count[code]; in evdev_update_key_down_count()
130 evdev_log_bug_libinput(device, in evdev_update_key_down_count()
139 evdev_device_switch_get_state(struct evdev_device *device, in evdev_device_switch_get_state() argument
142 struct evdev_dispatch *dispatch = device->dispatch; in evdev_device_switch_get_state()
150 evdev_pointer_notify_physical_button(struct evdev_device *device, in evdev_pointer_notify_physical_button() argument
155 if (evdev_middlebutton_filter_button(device, in evdev_pointer_notify_physical_button()
161 evdev_pointer_notify_button(device, in evdev_pointer_notify_physical_button()
168 evdev_pointer_post_button(struct evdev_device *device, in evdev_pointer_post_button() argument
175 down_count = evdev_update_key_down_count(device, button, state); in evdev_pointer_post_button()
179 pointer_notify_button(&device->base, time, button, state); in evdev_pointer_post_button()
182 if (device->left_handed.change_to_enabled) in evdev_pointer_post_button()
183 device->left_handed.change_to_enabled(device); in evdev_pointer_post_button()
185 if (device->scroll.change_scroll_method) in evdev_pointer_post_button()
186 device->scroll.change_scroll_method(device); in evdev_pointer_post_button()
195 struct evdev_device *device = data; in evdev_button_scroll_timeout() local
197 device->scroll.button_scroll_state = BUTTONSCROLL_READY; in evdev_button_scroll_timeout()
201 evdev_button_scroll_button(struct evdev_device *device, in evdev_button_scroll_button() argument
207 switch (device->scroll.lock_state) { in evdev_button_scroll_button()
212 device->scroll.lock_state = BUTTONSCROLL_LOCK_FIRSTDOWN; in evdev_button_scroll_button()
213 evdev_log_debug(device, "scroll lock: first down\n"); in evdev_button_scroll_button()
217 device->scroll.lock_state = BUTTONSCROLL_LOCK_FIRSTUP; in evdev_button_scroll_button()
218 evdev_log_debug(device, "scroll lock: first up\n"); in evdev_button_scroll_button()
222 device->scroll.lock_state = BUTTONSCROLL_LOCK_SECONDDOWN; in evdev_button_scroll_button()
223 evdev_log_debug(device, "scroll lock: second down\n"); in evdev_button_scroll_button()
227 device->scroll.lock_state = BUTTONSCROLL_LOCK_IDLE; in evdev_button_scroll_button()
228 evdev_log_debug(device, "scroll lock: idle\n"); in evdev_button_scroll_button()
235 device->scroll.button_scroll_state = BUTTONSCROLL_BUTTON_DOWN; in evdev_button_scroll_button()
244 if (device->middlebutton.enabled && in evdev_button_scroll_button()
245 (device->scroll.button == BTN_LEFT || in evdev_button_scroll_button()
246 device->scroll.button == BTN_RIGHT)) { in evdev_button_scroll_button()
250 libinput_timer_set_flags(&device->scroll.timer, in evdev_button_scroll_button()
253 device->scroll.button_down_time = time; in evdev_button_scroll_button()
254 evdev_log_debug(device, "btnscroll: down\n"); in evdev_button_scroll_button()
256 libinput_timer_cancel(&device->scroll.timer); in evdev_button_scroll_button()
257 switch(device->scroll.button_scroll_state) { in evdev_button_scroll_button()
259 evdev_log_bug_libinput(device, in evdev_button_scroll_button()
264 evdev_log_debug(device, "btnscroll: cancel\n"); in evdev_button_scroll_button()
269 evdev_pointer_post_button(device, in evdev_button_scroll_button()
270 device->scroll.button_down_time, in evdev_button_scroll_button()
271 device->scroll.button, in evdev_button_scroll_button()
273 evdev_pointer_post_button(device, time, in evdev_button_scroll_button()
274 device->scroll.button, in evdev_button_scroll_button()
278 evdev_log_debug(device, "btnscroll: up\n"); in evdev_button_scroll_button()
279 evdev_stop_scroll(device, time, in evdev_button_scroll_button()
284 device->scroll.button_scroll_state = BUTTONSCROLL_IDLE; in evdev_button_scroll_button()
289 evdev_pointer_notify_button(struct evdev_device *device, in evdev_pointer_notify_button() argument
294 if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN && in evdev_pointer_notify_button()
295 button == device->scroll.button) { in evdev_pointer_notify_button()
296 evdev_button_scroll_button(device, time, state); in evdev_pointer_notify_button()
300 evdev_pointer_post_button(device, time, button, state); in evdev_pointer_notify_button()
304 evdev_device_led_update(struct evdev_device *device, enum libinput_led leds) in evdev_device_led_update() argument
317 if (!(device->seat_caps & EVDEV_DEVICE_KEYBOARD)) in evdev_device_led_update()
329 i = write(device->fd, ev, sizeof ev); in evdev_device_led_update()
334 evdev_transform_absolute(struct evdev_device *device, in evdev_transform_absolute() argument
337 if (!device->abs.apply_calibration) in evdev_transform_absolute()
340 matrix_mult_vec(&device->abs.calibration, &point->x, &point->y); in evdev_transform_absolute()
344 evdev_transform_relative(struct evdev_device *device, in evdev_transform_relative() argument
349 if (!device->abs.apply_calibration) in evdev_transform_relative()
352 matrix_to_relative(&rel_matrix, &device->abs.calibration); in evdev_transform_relative()
364 evdev_device_transform_x(struct evdev_device *device, in evdev_device_transform_x() argument
368 return scale_axis(device->abs.absinfo_x, x, width); in evdev_device_transform_x()
372 evdev_device_transform_y(struct evdev_device *device, in evdev_device_transform_y() argument
376 return scale_axis(device->abs.absinfo_y, y, height); in evdev_device_transform_y()
380 evdev_notify_axis(struct evdev_device *device, in evdev_notify_axis() argument
390 if (device->scroll.invert_horizontal_scrolling) { in evdev_notify_axis()
395 if (device->scroll.natural_scrolling_enabled) { in evdev_notify_axis()
402 pointer_notify_axis(&device->base, in evdev_notify_axis()
411 evdev_tag_external_mouse(struct evdev_device *device, in evdev_tag_external_mouse() argument
416 bustype = libevdev_get_id_bustype(device->evdev); in evdev_tag_external_mouse()
418 device->tags |= EVDEV_TAG_EXTERNAL_MOUSE; in evdev_tag_external_mouse()
422 evdev_tag_trackpoint(struct evdev_device *device, in evdev_tag_trackpoint() argument
429 if (!libevdev_has_property(device->evdev, in evdev_tag_trackpoint()
431 !parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK")) in evdev_tag_trackpoint()
434 device->tags |= EVDEV_TAG_TRACKPOINT; in evdev_tag_trackpoint()
436 quirks = evdev_libinput_context(device)->quirks; in evdev_tag_trackpoint()
437 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_tag_trackpoint()
442 device->tags |= EVDEV_TAG_EXTERNAL_MOUSE; in evdev_tag_trackpoint()
443 evdev_log_info(device, in evdev_tag_trackpoint()
446 evdev_log_info(device, in evdev_tag_trackpoint()
456 evdev_tag_keyboard_internal(struct evdev_device *device) in evdev_tag_keyboard_internal() argument
458 device->tags |= EVDEV_TAG_INTERNAL_KEYBOARD; in evdev_tag_keyboard_internal()
459 device->tags &= ~EVDEV_TAG_EXTERNAL_KEYBOARD; in evdev_tag_keyboard_internal()
463 evdev_tag_keyboard_external(struct evdev_device *device) in evdev_tag_keyboard_external() argument
465 device->tags |= EVDEV_TAG_EXTERNAL_KEYBOARD; in evdev_tag_keyboard_external()
466 device->tags &= ~EVDEV_TAG_INTERNAL_KEYBOARD; in evdev_tag_keyboard_external()
470 evdev_tag_keyboard(struct evdev_device *device, in evdev_tag_keyboard() argument
478 if (!libevdev_has_event_type(device->evdev, EV_KEY)) in evdev_tag_keyboard()
482 if (!libevdev_has_event_code(device->evdev, in evdev_tag_keyboard()
488 quirks = evdev_libinput_context(device)->quirks; in evdev_tag_keyboard()
489 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_tag_keyboard()
492 evdev_tag_keyboard_internal(device); in evdev_tag_keyboard()
494 evdev_tag_keyboard_external(device); in evdev_tag_keyboard()
496 evdev_log_info(device, in evdev_tag_keyboard()
504 device->tags |= EVDEV_TAG_KEYBOARD; in evdev_tag_keyboard()
508 evdev_tag_tablet_touchpad(struct evdev_device *device) in evdev_tag_tablet_touchpad() argument
510 device->tags |= EVDEV_TAG_TABLET_TOUCHPAD; in evdev_tag_tablet_touchpad()
516 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_has_matrix() local
518 return device->abs.absinfo_x && device->abs.absinfo_y; in evdev_calibration_has_matrix()
525 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_set_matrix() local
527 evdev_device_calibrate(device, matrix); in evdev_calibration_set_matrix()
536 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_get_matrix() local
538 matrix_to_farray6(&device->abs.usermatrix, matrix); in evdev_calibration_get_matrix()
540 return !matrix_is_identity(&device->abs.usermatrix); in evdev_calibration_get_matrix()
547 struct evdev_device *device = evdev_device(libinput_device); in evdev_calibration_get_default_matrix() local
549 matrix_to_farray6(&device->abs.default_calibration, matrix); in evdev_calibration_get_default_matrix()
551 return !matrix_is_identity(&device->abs.default_calibration); in evdev_calibration_get_default_matrix()
555 evdev_sendevents_get_modes(struct libinput_device *device) in evdev_sendevents_get_modes() argument
561 evdev_sendevents_set_mode(struct libinput_device *device, in evdev_sendevents_set_mode() argument
564 struct evdev_device *evdev = evdev_device(device); in evdev_sendevents_set_mode()
587 evdev_sendevents_get_mode(struct libinput_device *device) in evdev_sendevents_get_mode() argument
589 struct evdev_device *evdev = evdev_device(device); in evdev_sendevents_get_mode()
596 evdev_sendevents_get_default_mode(struct libinput_device *device) in evdev_sendevents_get_default_mode() argument
602 evdev_left_handed_has(struct libinput_device *device) in evdev_left_handed_has() argument
610 evdev_left_handed_set(struct libinput_device *device, int left_handed) in evdev_left_handed_set() argument
612 struct evdev_device *evdev = evdev_device(device); in evdev_left_handed_set()
622 evdev_left_handed_get(struct libinput_device *device) in evdev_left_handed_get() argument
624 struct evdev_device *evdev = evdev_device(device); in evdev_left_handed_get()
632 evdev_left_handed_get_default(struct libinput_device *device) in evdev_left_handed_get_default() argument
638 evdev_init_left_handed(struct evdev_device *device, in evdev_init_left_handed() argument
641 device->left_handed.config.has = evdev_left_handed_has; in evdev_init_left_handed()
642 device->left_handed.config.set = evdev_left_handed_set; in evdev_init_left_handed()
643 device->left_handed.config.get = evdev_left_handed_get; in evdev_init_left_handed()
644 device->left_handed.config.get_default = evdev_left_handed_get_default; in evdev_init_left_handed()
645 device->base.config.left_handed = &device->left_handed.config; in evdev_init_left_handed()
646 device->left_handed.enabled = false; in evdev_init_left_handed()
647 device->left_handed.want_enabled = false; in evdev_init_left_handed()
648 device->left_handed.change_to_enabled = change_to_left_handed; in evdev_init_left_handed()
652 evdev_scroll_get_methods(struct libinput_device *device) in evdev_scroll_get_methods() argument
658 evdev_scroll_set_method(struct libinput_device *device, in evdev_scroll_set_method() argument
661 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_set_method()
670 evdev_scroll_get_method(struct libinput_device *device) in evdev_scroll_get_method() argument
672 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_method()
680 evdev_scroll_get_default_method(struct libinput_device *device) in evdev_scroll_get_default_method() argument
682 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_default_method()
698 evdev_scroll_set_button(struct libinput_device *device, in evdev_scroll_set_button() argument
701 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_set_button()
710 evdev_scroll_get_button(struct libinput_device *device) in evdev_scroll_get_button() argument
712 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_button()
720 evdev_scroll_get_default_button(struct libinput_device *device) in evdev_scroll_get_default_button() argument
722 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_default_button()
740 evdev_scroll_set_button_lock(struct libinput_device *device, in evdev_scroll_set_button_lock() argument
743 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_set_button_lock()
762 evdev_scroll_get_button_lock(struct libinput_device *device) in evdev_scroll_get_button_lock() argument
764 struct evdev_device *evdev = evdev_device(device); in evdev_scroll_get_button_lock()
773 evdev_scroll_get_default_button_lock(struct libinput_device *device) in evdev_scroll_get_default_button_lock() argument
780 evdev_set_button_scroll_lock_enabled(struct evdev_device *device, in evdev_set_button_scroll_lock_enabled() argument
784 device->scroll.lock_state = BUTTONSCROLL_LOCK_IDLE; in evdev_set_button_scroll_lock_enabled()
786 device->scroll.lock_state = BUTTONSCROLL_LOCK_DISABLED; in evdev_set_button_scroll_lock_enabled()
790 evdev_init_button_scroll(struct evdev_device *device, in evdev_init_button_scroll() argument
798 evdev_device_get_sysname(device)); in evdev_init_button_scroll()
799 libinput_timer_init(&device->scroll.timer, in evdev_init_button_scroll()
800 evdev_libinput_context(device), in evdev_init_button_scroll()
802 evdev_button_scroll_timeout, device); in evdev_init_button_scroll()
803 device->scroll.config.get_methods = evdev_scroll_get_methods; in evdev_init_button_scroll()
804 device->scroll.config.set_method = evdev_scroll_set_method; in evdev_init_button_scroll()
805 device->scroll.config.get_method = evdev_scroll_get_method; in evdev_init_button_scroll()
806 device->scroll.config.get_default_method = evdev_scroll_get_default_method; in evdev_init_button_scroll()
807 device->scroll.config.set_button = evdev_scroll_set_button; in evdev_init_button_scroll()
808 device->scroll.config.get_button = evdev_scroll_get_button; in evdev_init_button_scroll()
809 device->scroll.config.get_default_button = evdev_scroll_get_default_button; in evdev_init_button_scroll()
810 device->scroll.config.set_button_lock = evdev_scroll_set_button_lock; in evdev_init_button_scroll()
811 device->scroll.config.get_button_lock = evdev_scroll_get_button_lock; in evdev_init_button_scroll()
812 device->scroll.config.get_default_button_lock = evdev_scroll_get_default_button_lock; in evdev_init_button_scroll()
813 device->base.config.scroll_method = &device->scroll.config; in evdev_init_button_scroll()
814 device->scroll.method = evdev_scroll_get_default_method((struct libinput_device *)device); in evdev_init_button_scroll()
815 device->scroll.want_method = device->scroll.method; in evdev_init_button_scroll()
816 device->scroll.button = evdev_scroll_get_default_button((struct libinput_device *)device); in evdev_init_button_scroll()
817 device->scroll.want_button = device->scroll.button; in evdev_init_button_scroll()
818 device->scroll.change_scroll_method = change_scroll_method; in evdev_init_button_scroll()
822 evdev_init_calibration(struct evdev_device *device, in evdev_init_calibration() argument
825 device->base.config.calibration = calibration; in evdev_init_calibration()
834 evdev_init_sendevents(struct evdev_device *device, in evdev_init_sendevents() argument
837 device->base.config.sendevents = &dispatch->sendevents.config; in evdev_init_sendevents()
847 evdev_scroll_config_natural_has(struct libinput_device *device) in evdev_scroll_config_natural_has() argument
853 evdev_scroll_config_natural_set(struct libinput_device *device, in evdev_scroll_config_natural_set() argument
856 struct evdev_device *dev = evdev_device(device); in evdev_scroll_config_natural_set()
864 evdev_scroll_config_natural_get(struct libinput_device *device) in evdev_scroll_config_natural_get() argument
866 struct evdev_device *dev = evdev_device(device); in evdev_scroll_config_natural_get()
872 evdev_scroll_config_natural_get_default(struct libinput_device *device) in evdev_scroll_config_natural_get_default() argument
880 evdev_init_natural_scroll(struct evdev_device *device) in evdev_init_natural_scroll() argument
882 device->scroll.config_natural.has = evdev_scroll_config_natural_has; in evdev_init_natural_scroll()
883 device->scroll.config_natural.set_enabled = evdev_scroll_config_natural_set; in evdev_init_natural_scroll()
884 device->scroll.config_natural.get_enabled = evdev_scroll_config_natural_get; in evdev_init_natural_scroll()
885 device->scroll.config_natural.get_default_enabled = evdev_scroll_config_natural_get_default; in evdev_init_natural_scroll()
886 device->scroll.natural_scrolling_enabled = false; in evdev_init_natural_scroll()
887 device->base.config.natural_scroll = &device->scroll.config_natural; in evdev_init_natural_scroll()
891 evdev_need_mtdev(struct evdev_device *device) in evdev_need_mtdev() argument
893 struct libevdev *evdev = device->evdev; in evdev_need_mtdev()
904 evdev_is_fake_mt_device(struct evdev_device *device) in evdev_is_fake_mt_device() argument
906 struct libevdev *evdev = device->evdev; in evdev_is_fake_mt_device()
913 evdev_read_switch_reliability_prop(struct evdev_device *device) in evdev_read_switch_reliability_prop() argument
920 quirks = evdev_libinput_context(device)->quirks; in evdev_read_switch_reliability_prop()
921 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_switch_reliability_prop()
925 evdev_log_error(device, in evdev_read_switch_reliability_prop()
927 device->devname, in evdev_read_switch_reliability_prop()
931 evdev_log_info(device, "will write switch open events\n"); in evdev_read_switch_reliability_prop()
940 evdev_print_event(struct evdev_device *device, in evdev_print_event() argument
955 evdev_log_debug(device, in evdev_print_event()
963 evdev_log_debug(device, in evdev_print_event()
974 evdev_process_event(struct evdev_device *device, struct input_event *e) in evdev_process_event() argument
976 struct evdev_dispatch *dispatch = device->dispatch; in evdev_process_event()
980 evdev_print_event(device, e); in evdev_process_event()
983 libinput_timer_flush(evdev_libinput_context(device), time); in evdev_process_event()
985 dispatch->interface->process(dispatch, device, e, time); in evdev_process_event()
989 evdev_device_dispatch_one(struct evdev_device *device, in evdev_device_dispatch_one() argument
992 if (!device->mtdev) { in evdev_device_dispatch_one()
993 evdev_process_event(device, ev); in evdev_device_dispatch_one()
995 mtdev_put_event(device->mtdev, ev); in evdev_device_dispatch_one()
997 while (!mtdev_empty(device->mtdev)) { in evdev_device_dispatch_one()
999 mtdev_get_event(device->mtdev, &e); in evdev_device_dispatch_one()
1000 evdev_process_event(device, &e); in evdev_device_dispatch_one()
1007 evdev_sync_device(struct evdev_device *device) in evdev_sync_device() argument
1013 rc = libevdev_next_event(device->evdev, in evdev_sync_device()
1017 evdev_device_dispatch_one(device, &ev); in evdev_sync_device()
1024 evdev_note_time_delay(struct evdev_device *device, in evdev_note_time_delay() argument
1027 struct libinput *libinput = evdev_libinput_context(device); in evdev_note_time_delay()
1041 evdev_log_bug_client_ratelimit(device, in evdev_note_time_delay()
1042 &device->delay_warning_limit, in evdev_note_time_delay()
1051 struct evdev_device *device = data; in evdev_device_dispatch() local
1052 struct libinput *libinput = evdev_libinput_context(device); in evdev_device_dispatch()
1061 rc = libevdev_next_event(device->evdev, in evdev_device_dispatch()
1064 evdev_log_info_ratelimit(device, in evdev_device_dispatch()
1065 &device->syn_drop_limit, in evdev_device_dispatch()
1072 evdev_device_dispatch_one(device, &ev); in evdev_device_dispatch()
1074 rc = evdev_sync_device(device); in evdev_device_dispatch()
1079 evdev_note_time_delay(device, &ev); in evdev_device_dispatch()
1082 evdev_device_dispatch_one(device, &ev); in evdev_device_dispatch()
1087 libinput_remove_source(libinput, device->source); in evdev_device_dispatch()
1088 device->source = NULL; in evdev_device_dispatch()
1093 evdev_init_accel(struct evdev_device *device, in evdev_init_accel() argument
1099 filter = create_pointer_accelerator_filter_flat(device->dpi); in evdev_init_accel()
1100 else if (device->tags & EVDEV_TAG_TRACKPOINT) in evdev_init_accel()
1101 filter = create_pointer_accelerator_filter_trackpoint(device->trackpoint_multiplier, in evdev_init_accel()
1102 device->use_velocity_averaging); in evdev_init_accel()
1103 else if (device->dpi < DEFAULT_MOUSE_DPI) in evdev_init_accel()
1104 filter = create_pointer_accelerator_filter_linear_low_dpi(device->dpi, in evdev_init_accel()
1105 device->use_velocity_averaging); in evdev_init_accel()
1107 filter = create_pointer_accelerator_filter_linear(device->dpi, in evdev_init_accel()
1108 device->use_velocity_averaging); in evdev_init_accel()
1113 evdev_device_init_pointer_acceleration(device, filter); in evdev_init_accel()
1119 evdev_accel_config_available(struct libinput_device *device) in evdev_accel_config_available() argument
1127 evdev_accel_config_set_speed(struct libinput_device *device, double speed) in evdev_accel_config_set_speed() argument
1129 struct evdev_device *dev = evdev_device(device); in evdev_accel_config_set_speed()
1138 evdev_accel_config_get_speed(struct libinput_device *device) in evdev_accel_config_get_speed() argument
1140 struct evdev_device *dev = evdev_device(device); in evdev_accel_config_get_speed()
1146 evdev_accel_config_get_default_speed(struct libinput_device *device) in evdev_accel_config_get_default_speed() argument
1154 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_get_profiles() local
1156 if (!device->pointer.filter) in evdev_accel_config_get_profiles()
1167 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_set_profile() local
1171 filter = device->pointer.filter; in evdev_accel_config_set_profile()
1176 device->pointer.filter = NULL; in evdev_accel_config_set_profile()
1178 if (evdev_init_accel(device, profile)) { in evdev_accel_config_set_profile()
1182 device->pointer.filter = filter; in evdev_accel_config_set_profile()
1192 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_get_profile() local
1194 return filter_get_type(device->pointer.filter); in evdev_accel_config_get_profile()
1200 struct evdev_device *device = evdev_device(libinput_device); in evdev_accel_config_get_default_profile() local
1202 if (!device->pointer.filter) in evdev_accel_config_get_default_profile()
1210 evdev_device_init_pointer_acceleration(struct evdev_device *device, in evdev_device_init_pointer_acceleration() argument
1213 device->pointer.filter = filter; in evdev_device_init_pointer_acceleration()
1215 if (device->base.config.accel == NULL) { in evdev_device_init_pointer_acceleration()
1218 device->pointer.config.available = evdev_accel_config_available; in evdev_device_init_pointer_acceleration()
1219 device->pointer.config.set_speed = evdev_accel_config_set_speed; in evdev_device_init_pointer_acceleration()
1220 device->pointer.config.get_speed = evdev_accel_config_get_speed; in evdev_device_init_pointer_acceleration()
1221 device->pointer.config.get_default_speed = evdev_accel_config_get_default_speed; in evdev_device_init_pointer_acceleration()
1222 device->pointer.config.get_profiles = evdev_accel_config_get_profiles; in evdev_device_init_pointer_acceleration()
1223 device->pointer.config.set_profile = evdev_accel_config_set_profile; in evdev_device_init_pointer_acceleration()
1224 device->pointer.config.get_profile = evdev_accel_config_get_profile; in evdev_device_init_pointer_acceleration()
1225 device->pointer.config.get_default_profile = evdev_accel_config_get_default_profile; in evdev_device_init_pointer_acceleration()
1226 device->base.config.accel = &device->pointer.config; in evdev_device_init_pointer_acceleration()
1228 default_speed = evdev_accel_config_get_default_speed(&device->base); in evdev_device_init_pointer_acceleration()
1229 evdev_accel_config_set_speed(&device->base, default_speed); in evdev_device_init_pointer_acceleration()
1234 evdev_read_wheel_click_prop(struct evdev_device *device, in evdev_read_wheel_click_prop() argument
1241 prop = udev_device_get_property_value(device->udev_device, prop); in evdev_read_wheel_click_prop()
1251 evdev_log_error(device, in evdev_read_wheel_click_prop()
1260 evdev_read_wheel_click_count_prop(struct evdev_device *device, in evdev_read_wheel_click_count_prop() argument
1266 prop = udev_device_get_property_value(device->udev_device, prop); in evdev_read_wheel_click_count_prop()
1276 evdev_log_error(device, in evdev_read_wheel_click_count_prop()
1286 evdev_read_wheel_click_props(struct evdev_device *device) in evdev_read_wheel_click_props() argument
1295 if (evdev_read_wheel_click_count_prop(device, wheel_count, &angles.y) || in evdev_read_wheel_click_props()
1296 evdev_read_wheel_click_prop(device, wheel_angle, &angles.y)) { in evdev_read_wheel_click_props()
1297 evdev_log_debug(device, in evdev_read_wheel_click_props()
1300 if (evdev_read_wheel_click_count_prop(device, hwheel_count, &angles.x) || in evdev_read_wheel_click_props()
1301 evdev_read_wheel_click_prop(device, hwheel_angle, &angles.x)) { in evdev_read_wheel_click_props()
1302 evdev_log_debug(device, in evdev_read_wheel_click_props()
1312 evdev_get_trackpoint_multiplier(struct evdev_device *device) in evdev_get_trackpoint_multiplier() argument
1318 if (!(device->tags & EVDEV_TAG_TRACKPOINT)) in evdev_get_trackpoint_multiplier()
1321 quirks = evdev_libinput_context(device)->quirks; in evdev_get_trackpoint_multiplier()
1322 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_get_trackpoint_multiplier()
1329 evdev_log_bug_libinput(device, in evdev_get_trackpoint_multiplier()
1336 evdev_log_info(device, in evdev_get_trackpoint_multiplier()
1344 evdev_need_velocity_averaging(struct evdev_device *device) in evdev_need_velocity_averaging() argument
1350 quirks = evdev_libinput_context(device)->quirks; in evdev_need_velocity_averaging()
1351 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_need_velocity_averaging()
1360 evdev_log_info(device, in evdev_need_velocity_averaging()
1367 evdev_read_dpi_prop(struct evdev_device *device) in evdev_read_dpi_prop() argument
1372 if (device->tags & EVDEV_TAG_TRACKPOINT) in evdev_read_dpi_prop()
1375 mouse_dpi = udev_device_get_property_value(device->udev_device, in evdev_read_dpi_prop()
1380 evdev_log_error(device, in evdev_read_dpi_prop()
1386 evdev_log_info(device, in evdev_read_dpi_prop()
1395 evdev_read_model_flags(struct evdev_device *device) in evdev_read_model_flags() argument
1418 quirks = evdev_libinput_context(device)->quirks; in evdev_read_model_flags()
1419 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_model_flags()
1430 evdev_log_debug(device, in evdev_read_model_flags()
1435 evdev_log_debug(device, in evdev_read_model_flags()
1447 if (parse_udev_flag(device, in evdev_read_model_flags()
1448 device->udev_device, in evdev_read_model_flags()
1450 evdev_log_debug(device, "tagged as trackball\n"); in evdev_read_model_flags()
1459 if (parse_udev_flag(device, in evdev_read_model_flags()
1460 device->udev_device, in evdev_read_model_flags()
1462 evdev_log_debug(device, "tagged as trackball\n"); in evdev_read_model_flags()
1466 if (parse_udev_flag(device, device->udev_device, in evdev_read_model_flags()
1468 evdev_log_debug(device, "is a test device\n"); in evdev_read_model_flags()
1476 evdev_read_attr_res_prop(struct evdev_device *device, in evdev_read_attr_res_prop() argument
1485 quirks = evdev_libinput_context(device)->quirks; in evdev_read_attr_res_prop()
1486 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_attr_res_prop()
1502 evdev_read_attr_size_prop(struct evdev_device *device, in evdev_read_attr_size_prop() argument
1511 quirks = evdev_libinput_context(device)->quirks; in evdev_read_attr_size_prop()
1512 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_read_attr_size_prop()
1529 evdev_fix_abs_resolution(struct evdev_device *device, in evdev_fix_abs_resolution() argument
1533 struct libevdev *evdev = device->evdev; in evdev_fix_abs_resolution()
1541 evdev_log_bug_libinput(device, in evdev_fix_abs_resolution()
1559 if (!evdev_read_attr_res_prop(device, &xres, &yres) && in evdev_fix_abs_resolution()
1560 evdev_read_attr_size_prop(device, &widthmm, &heightmm)) { in evdev_fix_abs_resolution()
1574 evdev_device_get_udev_tags(struct evdev_device *device, in evdev_device_get_udev_tags() argument
1584 if (parse_udev_flag(device, in evdev_device_get_udev_tags()
1596 evdev_fix_android_mt(struct evdev_device *device) in evdev_fix_android_mt() argument
1598 struct libevdev *evdev = device->evdev; in evdev_fix_android_mt()
1606 evdev_is_fake_mt_device(device)) in evdev_fix_android_mt()
1616 evdev_check_min_max(struct evdev_device *device, unsigned int code) in evdev_check_min_max() argument
1618 struct libevdev *evdev = device->evdev; in evdev_check_min_max()
1633 evdev_log_info(device, in evdev_check_min_max()
1636 libevdev_disable_event_code(device->evdev, in evdev_check_min_max()
1640 evdev_log_bug_kernel(device, in evdev_check_min_max()
1651 evdev_reject_device(struct evdev_device *device) in evdev_reject_device() argument
1653 struct libevdev *evdev = device->evdev; in evdev_reject_device()
1665 if (!evdev_is_fake_mt_device(device) && in evdev_reject_device()
1675 evdev_log_bug_kernel(device, in evdev_reject_device()
1681 if (!evdev_is_fake_mt_device(device) && in evdev_reject_device()
1687 evdev_log_bug_kernel(device, in evdev_reject_device()
1700 if (!evdev_check_min_max(device, code)) in evdev_reject_device()
1709 evdev_extract_abs_axes(struct evdev_device *device, in evdev_extract_abs_axes() argument
1712 struct libevdev *evdev = device->evdev; in evdev_extract_abs_axes()
1719 if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) in evdev_extract_abs_axes()
1720 device->abs.is_fake_resolution = true; in evdev_extract_abs_axes()
1723 fuzz = evdev_read_fuzz_prop(device, ABS_X); in evdev_extract_abs_axes()
1725 fuzz = evdev_read_fuzz_prop(device, ABS_Y); in evdev_extract_abs_axes()
1729 device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); in evdev_extract_abs_axes()
1730 device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); in evdev_extract_abs_axes()
1731 device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum - in evdev_extract_abs_axes()
1732 device->abs.absinfo_x->minimum); in evdev_extract_abs_axes()
1733 device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - in evdev_extract_abs_axes()
1734 device->abs.absinfo_y->minimum); in evdev_extract_abs_axes()
1736 if (evdev_is_fake_mt_device(device) || in evdev_extract_abs_axes()
1741 if (evdev_fix_abs_resolution(device, in evdev_extract_abs_axes()
1744 device->abs.is_fake_resolution = true; in evdev_extract_abs_axes()
1746 if ((fuzz = evdev_read_fuzz_prop(device, ABS_MT_POSITION_X))) in evdev_extract_abs_axes()
1748 if ((fuzz = evdev_read_fuzz_prop(device, ABS_MT_POSITION_Y))) in evdev_extract_abs_axes()
1751 device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); in evdev_extract_abs_axes()
1752 device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y); in evdev_extract_abs_axes()
1753 device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum - in evdev_extract_abs_axes()
1754 device->abs.absinfo_x->minimum); in evdev_extract_abs_axes()
1755 device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - in evdev_extract_abs_axes()
1756 device->abs.absinfo_y->minimum); in evdev_extract_abs_axes()
1757 device->is_mt = 1; in evdev_extract_abs_axes()
1761 evdev_disable_accelerometer_axes(struct evdev_device *device) in evdev_disable_accelerometer_axes() argument
1763 struct libevdev *evdev = device->evdev; in evdev_disable_accelerometer_axes()
1775 evdev_configure_device(struct evdev_device *device) in evdev_configure_device() argument
1777 struct libevdev *evdev = device->evdev; in evdev_configure_device()
1782 udev_tags = evdev_device_get_udev_tags(device, device->udev_device); in evdev_configure_device()
1786 evdev_log_info(device, in evdev_configure_device()
1791 evdev_log_info(device, in evdev_configure_device()
1808 evdev_log_info(device, in evdev_configure_device()
1812 evdev_disable_accelerometer_axes(device); in evdev_configure_device()
1816 evdev_log_info(device, in evdev_configure_device()
1821 if (evdev_reject_device(device)) { in evdev_configure_device()
1822 evdev_log_info(device, "was rejected\n"); in evdev_configure_device()
1826 if (!evdev_is_fake_mt_device(device)) in evdev_configure_device()
1827 evdev_fix_android_mt(device); in evdev_configure_device()
1830 evdev_extract_abs_axes(device, udev_tags); in evdev_configure_device()
1832 if (evdev_is_fake_mt_device(device)) in evdev_configure_device()
1836 if (evdev_device_has_model_quirk(device, in evdev_configure_device()
1838 dispatch = evdev_totem_create(device); in evdev_configure_device()
1839 device->seat_caps |= EVDEV_DEVICE_TABLET; in evdev_configure_device()
1840 evdev_log_info(device, "device is a totem\n"); in evdev_configure_device()
1853 dispatch = evdev_tablet_pad_create(device); in evdev_configure_device()
1854 device->seat_caps |= EVDEV_DEVICE_TABLET_PAD; in evdev_configure_device()
1855 evdev_log_info(device, "device is a tablet pad\n"); in evdev_configure_device()
1859 dispatch = evdev_tablet_create(device); in evdev_configure_device()
1860 device->seat_caps |= EVDEV_DEVICE_TABLET; in evdev_configure_device()
1861 evdev_log_info(device, "device is a tablet\n"); in evdev_configure_device()
1867 evdev_tag_tablet_touchpad(device); in evdev_configure_device()
1869 device->use_velocity_averaging = evdev_need_velocity_averaging(device); in evdev_configure_device()
1870 dispatch = evdev_mt_touchpad_create(device); in evdev_configure_device()
1871 evdev_log_info(device, "device is a touchpad\n"); in evdev_configure_device()
1877 evdev_tag_external_mouse(device, device->udev_device); in evdev_configure_device()
1878 evdev_tag_trackpoint(device, device->udev_device); in evdev_configure_device()
1879 device->dpi = evdev_read_dpi_prop(device); in evdev_configure_device()
1880 device->trackpoint_multiplier = evdev_get_trackpoint_multiplier(device); in evdev_configure_device()
1882 device->use_velocity_averaging = evdev_need_velocity_averaging(device); in evdev_configure_device()
1884 device->seat_caps |= EVDEV_DEVICE_POINTER; in evdev_configure_device()
1886 evdev_log_info(device, "device is a pointer\n"); in evdev_configure_device()
1889 device->left_handed.want_enabled = true; in evdev_configure_device()
1891 device->scroll.natural_scrolling_enabled = true; in evdev_configure_device()
1895 device->scroll.want_button = 1; in evdev_configure_device()
1899 device->seat_caps |= EVDEV_DEVICE_KEYBOARD; in evdev_configure_device()
1900 evdev_log_info(device, "device is a keyboard\n"); in evdev_configure_device()
1905 device->scroll.natural_scrolling_enabled = true; in evdev_configure_device()
1906 device->seat_caps |= EVDEV_DEVICE_POINTER; in evdev_configure_device()
1909 evdev_tag_keyboard(device, device->udev_device); in evdev_configure_device()
1913 device->seat_caps |= EVDEV_DEVICE_TOUCH; in evdev_configure_device()
1914 evdev_log_info(device, "device is a touch device\n"); in evdev_configure_device()
1919 device->seat_caps |= EVDEV_DEVICE_SWITCH; in evdev_configure_device()
1920 device->tags |= EVDEV_TAG_LID_SWITCH; in evdev_configure_device()
1921 evdev_log_info(device, "device is a switch device\n"); in evdev_configure_device()
1925 if (evdev_device_has_model_quirk(device, in evdev_configure_device()
1927 evdev_log_info(device, in evdev_configure_device()
1929 libevdev_disable_event_code(device->evdev, in evdev_configure_device()
1933 device->tags |= EVDEV_TAG_TABLET_MODE_SWITCH; in evdev_configure_device()
1934 device->seat_caps |= EVDEV_DEVICE_SWITCH; in evdev_configure_device()
1938 if (device->seat_caps & EVDEV_DEVICE_SWITCH) in evdev_configure_device()
1939 evdev_log_info(device, "device is a switch device\n"); in evdev_configure_device()
1942 if (device->seat_caps & EVDEV_DEVICE_POINTER && in evdev_configure_device()
1945 !evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)) { in evdev_configure_device()
1946 evdev_log_error(device, in evdev_configure_device()
1951 if (evdev_device_has_model_quirk(device, QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING)) { in evdev_configure_device()
1952 device->scroll.invert_horizontal_scrolling = true; in evdev_configure_device()
1955 return fallback_dispatch_create(&device->base); in evdev_configure_device()
1959 evdev_notify_added_device(struct evdev_device *device) in evdev_notify_added_device() argument
1963 list_for_each(dev, &device->base.seat->devices_list, link) { in evdev_notify_added_device()
1965 if (dev == &device->base) in evdev_notify_added_device()
1970 d->dispatch->interface->device_added(d, device); in evdev_notify_added_device()
1973 if (device->dispatch->interface->device_added) in evdev_notify_added_device()
1974 device->dispatch->interface->device_added(device, d); in evdev_notify_added_device()
1978 device->dispatch->interface->device_suspended) in evdev_notify_added_device()
1979 device->dispatch->interface->device_suspended(device, d); in evdev_notify_added_device()
1982 notify_added_device(&device->base); in evdev_notify_added_device()
1984 if (device->dispatch->interface->post_added) in evdev_notify_added_device()
1985 device->dispatch->interface->post_added(device, in evdev_notify_added_device()
1986 device->dispatch); in evdev_notify_added_device()
2013 evdev_set_device_group(struct evdev_device *device, in evdev_set_device_group() argument
2016 struct libinput *libinput = evdev_libinput_context(device); in evdev_set_device_group()
2029 libinput_device_set_device_group(&device->base, group); in evdev_set_device_group()
2032 libinput_device_set_device_group(&device->base, group); in evdev_set_device_group()
2050 evdev_pre_configure_model_quirks(struct evdev_device *device) in evdev_pre_configure_model_quirks() argument
2059 if (evdev_device_has_model_quirk(device, QUIRK_MODEL_HP_STREAM11_TOUCHPAD)) in evdev_pre_configure_model_quirks()
2060 libevdev_enable_property(device->evdev, in evdev_pre_configure_model_quirks()
2066 if (evdev_device_has_model_quirk(device, QUIRK_MODEL_LENOVO_T480S_TOUCHPAD) || in evdev_pre_configure_model_quirks()
2067 evdev_device_has_model_quirk(device, QUIRK_MODEL_LENOVO_T490S_TOUCHPAD) || in evdev_pre_configure_model_quirks()
2068 evdev_device_has_model_quirk(device, QUIRK_MODEL_LENOVO_L380_TOUCHPAD)) in evdev_pre_configure_model_quirks()
2069 libevdev_enable_property(device->evdev, in evdev_pre_configure_model_quirks()
2074 if (evdev_device_has_model_quirk(device, QUIRK_MODEL_HP_ZBOOK_STUDIO_G3)) in evdev_pre_configure_model_quirks()
2075 libevdev_set_abs_maximum(device->evdev, ABS_MT_SLOT, 1); in evdev_pre_configure_model_quirks()
2080 quirks = evdev_libinput_context(device)->quirks; in evdev_pre_configure_model_quirks()
2081 q = quirks_fetch_for_device(quirks, device->udev_device); in evdev_pre_configure_model_quirks()
2085 libevdev_disable_event_code(device->evdev, EV_MSC, MSC_TIMESTAMP); in evdev_pre_configure_model_quirks()
2096 libevdev_disable_event_type(device->evdev, in evdev_pre_configure_model_quirks()
2099 libevdev_disable_event_code(device->evdev, in evdev_pre_configure_model_quirks()
2102 evdev_log_debug(device, in evdev_pre_configure_model_quirks()
2163 struct evdev_device *device = NULL; in evdev_device_create() local
2204 device = zalloc(sizeof *device); in evdev_device_create()
2206 libinput_device_init(&device->base, seat); in evdev_device_create()
2211 rc = libevdev_new_from_fd(fd, &device->evdev); in evdev_device_create()
2215 libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC); in evdev_device_create()
2216 libevdev_set_device_log_function(device->evdev, in evdev_device_create()
2220 device->seat_caps = 0; in evdev_device_create()
2221 device->is_mt = 0; in evdev_device_create()
2222 device->mtdev = NULL; in evdev_device_create()
2223 device->udev_device = udev_device_ref(udev_device); in evdev_device_create()
2224 device->dispatch = NULL; in evdev_device_create()
2225 device->fd = fd; in evdev_device_create()
2226 device->devname = libevdev_get_name(device->evdev); in evdev_device_create()
2227 device->scroll.threshold = 5.0; /* Default may be overridden */ in evdev_device_create()
2228 device->scroll.direction_lock_threshold = 5.0; /* Default may be overridden */ in evdev_device_create()
2229 device->scroll.direction = 0; in evdev_device_create()
2230 device->scroll.wheel_click_angle = in evdev_device_create()
2231 evdev_read_wheel_click_props(device); in evdev_device_create()
2232 device->model_flags = evdev_read_model_flags(device); in evdev_device_create()
2233 device->dpi = DEFAULT_MOUSE_DPI; in evdev_device_create()
2236 ratelimit_init(&device->syn_drop_limit, s2us(30), 5); in evdev_device_create()
2238 ratelimit_init(&device->delay_warning_limit, s2us(60 * 60), 5); in evdev_device_create()
2240 ratelimit_init(&device->nonpointer_rel_limit, s2us(5), 5); in evdev_device_create()
2242 matrix_init_identity(&device->abs.calibration); in evdev_device_create()
2243 matrix_init_identity(&device->abs.usermatrix); in evdev_device_create()
2244 matrix_init_identity(&device->abs.default_calibration); in evdev_device_create()
2246 evdev_pre_configure_model_quirks(device); in evdev_device_create()
2248 device->dispatch = evdev_configure_device(device); in evdev_device_create()
2249 if (device->dispatch == NULL || device->seat_caps == 0) in evdev_device_create()
2252 device->source = in evdev_device_create()
2253 libinput_add_fd(libinput, fd, evdev_device_dispatch, device); in evdev_device_create()
2254 if (!device->source) in evdev_device_create()
2257 if (!evdev_set_device_group(device, udev_device)) in evdev_device_create()
2260 list_insert(seat->devices_list.prev, &device->base.link); in evdev_device_create()
2262 evdev_notify_added_device(device); in evdev_device_create()
2264 return device; in evdev_device_create()
2268 if (device) { in evdev_device_create()
2269 unhandled_device = device->seat_caps == 0; in evdev_device_create()
2270 evdev_device_destroy(device); in evdev_device_create()
2277 evdev_device_get_output(struct evdev_device *device) in evdev_device_get_output() argument
2279 return device->output_name; in evdev_device_get_output()
2283 evdev_device_get_sysname(struct evdev_device *device) in evdev_device_get_sysname() argument
2285 return udev_device_get_sysname(device->udev_device); in evdev_device_get_sysname()
2289 evdev_device_get_name(struct evdev_device *device) in evdev_device_get_name() argument
2291 return device->devname; in evdev_device_get_name()
2295 evdev_device_get_id_product(struct evdev_device *device) in evdev_device_get_id_product() argument
2297 return libevdev_get_id_product(device->evdev); in evdev_device_get_id_product()
2301 evdev_device_get_id_vendor(struct evdev_device *device) in evdev_device_get_id_vendor() argument
2303 return libevdev_get_id_vendor(device->evdev); in evdev_device_get_id_vendor()
2307 evdev_device_get_udev_device(struct evdev_device *device) in evdev_device_get_udev_device() argument
2309 return udev_device_ref(device->udev_device); in evdev_device_get_udev_device()
2313 evdev_device_set_default_calibration(struct evdev_device *device, in evdev_device_set_default_calibration() argument
2316 matrix_from_farray6(&device->abs.default_calibration, calibration); in evdev_device_set_default_calibration()
2317 evdev_device_calibrate(device, calibration); in evdev_device_set_default_calibration()
2321 evdev_device_calibrate(struct evdev_device *device, in evdev_device_calibrate() argument
2330 device->abs.apply_calibration = !matrix_is_identity(&transform); in evdev_device_calibrate()
2333 matrix_from_farray6(&device->abs.usermatrix, calibration); in evdev_device_calibrate()
2335 if (!device->abs.apply_calibration) { in evdev_device_calibrate()
2336 matrix_init_identity(&device->abs.calibration); in evdev_device_calibrate()
2340 sx = device->abs.absinfo_x->maximum - device->abs.absinfo_x->minimum + 1; in evdev_device_calibrate()
2341 sy = device->abs.absinfo_y->maximum - device->abs.absinfo_y->minimum + 1; in evdev_device_calibrate()
2365 device->abs.absinfo_x->minimum, in evdev_device_calibrate()
2366 device->abs.absinfo_y->minimum); in evdev_device_calibrate()
2375 -device->abs.absinfo_x->minimum/sx, in evdev_device_calibrate()
2376 -device->abs.absinfo_y->minimum/sy); in evdev_device_calibrate()
2381 matrix_mult(&device->abs.calibration, &transform, &scale); in evdev_device_calibrate()
2385 evdev_read_calibration_prop(struct evdev_device *device) in evdev_read_calibration_prop() argument
2390 prop = udev_device_get_property_value(device->udev_device, in evdev_read_calibration_prop()
2396 if (!device->abs.absinfo_x || !device->abs.absinfo_y) in evdev_read_calibration_prop()
2402 evdev_device_set_default_calibration(device, calibration); in evdev_read_calibration_prop()
2403 evdev_log_info(device, in evdev_read_calibration_prop()
2414 evdev_read_fuzz_prop(struct evdev_device *device, unsigned int code) in evdev_read_fuzz_prop() argument
2426 prop = udev_device_get_property_value(device->udev_device, name); in evdev_read_fuzz_prop()
2428 evdev_log_bug_libinput(device, in evdev_read_fuzz_prop()
2441 abs = libevdev_get_abs_info(device->evdev, code); in evdev_read_fuzz_prop()
2446 evdev_log_bug_libinput(device, in evdev_read_fuzz_prop()
2451 evdev_log_bug_libinput(device, in evdev_read_fuzz_prop()
2461 evdev_device_has_capability(struct evdev_device *device, in evdev_device_has_capability() argument
2466 return !!(device->seat_caps & EVDEV_DEVICE_POINTER); in evdev_device_has_capability()
2468 return !!(device->seat_caps & EVDEV_DEVICE_KEYBOARD); in evdev_device_has_capability()
2470 return !!(device->seat_caps & EVDEV_DEVICE_TOUCH); in evdev_device_has_capability()
2472 return !!(device->seat_caps & EVDEV_DEVICE_GESTURE); in evdev_device_has_capability()
2474 return !!(device->seat_caps & EVDEV_DEVICE_TABLET); in evdev_device_has_capability()
2476 return !!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD); in evdev_device_has_capability()
2478 return !!(device->seat_caps & EVDEV_DEVICE_SWITCH); in evdev_device_has_capability()
2485 evdev_device_get_size(const struct evdev_device *device, in evdev_device_get_size() argument
2491 x = libevdev_get_abs_info(device->evdev, ABS_X); in evdev_device_get_size()
2492 y = libevdev_get_abs_info(device->evdev, ABS_Y); in evdev_device_get_size()
2494 if (!x || !y || device->abs.is_fake_resolution || in evdev_device_get_size()
2505 evdev_device_has_button(struct evdev_device *device, uint32_t code) in evdev_device_has_button() argument
2507 if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) in evdev_device_has_button()
2510 return libevdev_has_event_code(device->evdev, EV_KEY, code); in evdev_device_has_button()
2514 evdev_device_has_key(struct evdev_device *device, uint32_t code) in evdev_device_has_key() argument
2516 if (!(device->seat_caps & EVDEV_DEVICE_KEYBOARD)) in evdev_device_has_key()
2519 return libevdev_has_event_code(device->evdev, EV_KEY, code); in evdev_device_has_key()
2523 evdev_device_get_touch_count(struct evdev_device *device) in evdev_device_get_touch_count() argument
2527 if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) in evdev_device_get_touch_count()
2530 ntouches = libevdev_get_num_slots(device->evdev); in evdev_device_get_touch_count()
2535 if (device->mtdev) in evdev_device_get_touch_count()
2545 evdev_device_has_switch(struct evdev_device *device, in evdev_device_has_switch() argument
2550 if (!(device->seat_caps & EVDEV_DEVICE_SWITCH)) in evdev_device_has_switch()
2564 return libevdev_has_event_code(device->evdev, EV_SW, code); in evdev_device_has_switch()
2568 evdev_is_scrolling(const struct evdev_device *device, in evdev_is_scrolling() argument
2574 return (device->scroll.direction & bit(axis)) != 0; in evdev_is_scrolling()
2578 evdev_start_scrolling(struct evdev_device *device, in evdev_start_scrolling() argument
2584 device->scroll.direction |= bit(axis); in evdev_start_scrolling()
2588 evdev_post_scroll(struct evdev_device *device, in evdev_post_scroll() argument
2596 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2598 device->scroll.buildup.y += delta->y; in evdev_post_scroll()
2599 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2601 device->scroll.buildup.x += delta->x; in evdev_post_scroll()
2603 trigger = &device->scroll.buildup; in evdev_post_scroll()
2607 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2609 !evdev_is_scrolling(device, in evdev_post_scroll()
2611 if (fabs(trigger->y) >= device->scroll.threshold) in evdev_post_scroll()
2612 evdev_start_scrolling(device, in evdev_post_scroll()
2614 if (fabs(trigger->x) >= device->scroll.threshold) in evdev_post_scroll()
2615 evdev_start_scrolling(device, in evdev_post_scroll()
2619 } else if (!evdev_is_scrolling(device, in evdev_post_scroll()
2621 if (fabs(delta->y) >= device->scroll.direction_lock_threshold) in evdev_post_scroll()
2622 evdev_start_scrolling(device, in evdev_post_scroll()
2624 } else if (!evdev_is_scrolling(device, in evdev_post_scroll()
2626 if (fabs(delta->x) >= device->scroll.direction_lock_threshold) in evdev_post_scroll()
2627 evdev_start_scrolling(device, in evdev_post_scroll()
2636 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2640 if (!evdev_is_scrolling(device, in evdev_post_scroll()
2646 uint32_t axes = device->scroll.direction; in evdev_post_scroll()
2653 evdev_notify_axis(device, in evdev_post_scroll()
2663 evdev_stop_scroll(struct evdev_device *device, in evdev_stop_scroll() argument
2671 if (device->scroll.direction != 0) in evdev_stop_scroll()
2672 pointer_notify_axis(&device->base, in evdev_stop_scroll()
2674 device->scroll.direction, in evdev_stop_scroll()
2679 device->scroll.buildup.x = 0; in evdev_stop_scroll()
2680 device->scroll.buildup.y = 0; in evdev_stop_scroll()
2681 device->scroll.direction = 0; in evdev_stop_scroll()
2685 evdev_notify_suspended_device(struct evdev_device *device) in evdev_notify_suspended_device() argument
2689 if (device->is_suspended) in evdev_notify_suspended_device()
2692 list_for_each(it, &device->base.seat->devices_list, link) { in evdev_notify_suspended_device()
2694 if (it == &device->base) in evdev_notify_suspended_device()
2698 d->dispatch->interface->device_suspended(d, device); in evdev_notify_suspended_device()
2701 device->is_suspended = true; in evdev_notify_suspended_device()
2705 evdev_notify_resumed_device(struct evdev_device *device) in evdev_notify_resumed_device() argument
2709 if (!device->is_suspended) in evdev_notify_resumed_device()
2712 list_for_each(it, &device->base.seat->devices_list, link) { in evdev_notify_resumed_device()
2714 if (it == &device->base) in evdev_notify_resumed_device()
2718 d->dispatch->interface->device_resumed(d, device); in evdev_notify_resumed_device()
2721 device->is_suspended = false; in evdev_notify_resumed_device()
2725 evdev_device_suspend(struct evdev_device *device) in evdev_device_suspend() argument
2727 struct libinput *libinput = evdev_libinput_context(device); in evdev_device_suspend()
2729 evdev_notify_suspended_device(device); in evdev_device_suspend()
2731 if (device->dispatch->interface->suspend) in evdev_device_suspend()
2732 device->dispatch->interface->suspend(device->dispatch, in evdev_device_suspend()
2733 device); in evdev_device_suspend()
2735 if (device->source) { in evdev_device_suspend()
2736 libinput_remove_source(libinput, device->source); in evdev_device_suspend()
2737 device->source = NULL; in evdev_device_suspend()
2740 if (device->mtdev) { in evdev_device_suspend()
2741 mtdev_close_delete(device->mtdev); in evdev_device_suspend()
2742 device->mtdev = NULL; in evdev_device_suspend()
2745 if (device->fd != -1) { in evdev_device_suspend()
2746 close_restricted(libinput, device->fd); in evdev_device_suspend()
2747 device->fd = -1; in evdev_device_suspend()
2752 evdev_device_resume(struct evdev_device *device) in evdev_device_resume() argument
2754 struct libinput *libinput = evdev_libinput_context(device); in evdev_device_resume()
2760 if (device->fd != -1) in evdev_device_resume()
2763 if (device->was_removed) in evdev_device_resume()
2766 devnode = udev_device_get_devnode(device->udev_device); in evdev_device_resume()
2776 if (!evdev_device_have_same_syspath(device->udev_device, fd)) { in evdev_device_resume()
2783 device->fd = fd; in evdev_device_resume()
2785 if (evdev_need_mtdev(device)) { in evdev_device_resume()
2786 device->mtdev = mtdev_new_open(device->fd); in evdev_device_resume()
2787 if (!device->mtdev) in evdev_device_resume()
2791 libevdev_change_fd(device->evdev, fd); in evdev_device_resume()
2792 libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC); in evdev_device_resume()
2796 libevdev_next_event(device->evdev, in evdev_device_resume()
2800 status = libevdev_next_event(device->evdev, in evdev_device_resume()
2805 device->source = in evdev_device_resume()
2806 libinput_add_fd(libinput, fd, evdev_device_dispatch, device); in evdev_device_resume()
2807 if (!device->source) { in evdev_device_resume()
2808 mtdev_close_delete(device->mtdev); in evdev_device_resume()
2812 evdev_notify_resumed_device(device); in evdev_device_resume()
2818 evdev_device_remove(struct evdev_device *device) in evdev_device_remove() argument
2822 evdev_log_info(device, "device removed\n"); in evdev_device_remove()
2824 libinput_timer_cancel(&device->scroll.timer); in evdev_device_remove()
2825 libinput_timer_cancel(&device->middlebutton.timer); in evdev_device_remove()
2827 list_for_each(dev, &device->base.seat->devices_list, link) { in evdev_device_remove()
2829 if (dev == &device->base) in evdev_device_remove()
2833 d->dispatch->interface->device_removed(d, device); in evdev_device_remove()
2836 evdev_device_suspend(device); in evdev_device_remove()
2838 if (device->dispatch->interface->remove) in evdev_device_remove()
2839 device->dispatch->interface->remove(device->dispatch); in evdev_device_remove()
2843 device->was_removed = true; in evdev_device_remove()
2845 list_remove(&device->base.link); in evdev_device_remove()
2847 notify_removed_device(&device->base); in evdev_device_remove()
2848 libinput_device_unref(&device->base); in evdev_device_remove()
2852 evdev_device_destroy(struct evdev_device *device) in evdev_device_destroy() argument
2856 dispatch = device->dispatch; in evdev_device_destroy()
2860 if (device->base.group) in evdev_device_destroy()
2861 libinput_device_group_unref(device->base.group); in evdev_device_destroy()
2863 free(device->output_name); in evdev_device_destroy()
2864 filter_destroy(device->pointer.filter); in evdev_device_destroy()
2865 libinput_timer_destroy(&device->scroll.timer); in evdev_device_destroy()
2866 libinput_timer_destroy(&device->middlebutton.timer); in evdev_device_destroy()
2867 libinput_seat_unref(device->base.seat); in evdev_device_destroy()
2868 libevdev_free(device->evdev); in evdev_device_destroy()
2869 udev_device_unref(device->udev_device); in evdev_device_destroy()
2870 free(device); in evdev_device_destroy()
2874 evdev_tablet_has_left_handed(struct evdev_device *device) in evdev_tablet_has_left_handed() argument
2878 struct libinput *li = evdev_libinput_context(device); in evdev_tablet_has_left_handed()
2889 devnode = udev_device_get_devnode(device->udev_device); in evdev_tablet_has_left_handed()
2900 evdev_log_info(device, in evdev_tablet_has_left_handed()
2902 device->devname); in evdev_tablet_has_left_handed()
2904 evdev_log_error(device, in evdev_tablet_has_left_handed()