Lines Matching refs:input
125 struct input_dev *input; member
175 int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 | in magicmouse_emit_buttons()
176 test_bit(BTN_RIGHT, msc->input->key) << 1 | in magicmouse_emit_buttons()
177 test_bit(BTN_MIDDLE, msc->input->key) << 2; in magicmouse_emit_buttons()
200 input_report_key(msc->input, BTN_MIDDLE, state & 4); in magicmouse_emit_buttons()
203 input_report_key(msc->input, BTN_LEFT, state & 1); in magicmouse_emit_buttons()
204 input_report_key(msc->input, BTN_RIGHT, state & 2); in magicmouse_emit_buttons()
212 struct input_dev *input = msc->input; in magicmouse_emit_touch() local
216 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_emit_touch()
217 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_emit_touch()
227 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_emit_touch()
259 if (emulate_scroll_wheel && (input->id.product != in magicmouse_emit_touch()
297 input_report_rel(input, REL_HWHEEL, -step_x); in magicmouse_emit_touch()
305 input_report_rel(input, REL_WHEEL, step_y); in magicmouse_emit_touch()
320 input_report_rel(input, in magicmouse_emit_touch()
337 input_report_rel(input, in magicmouse_emit_touch()
348 input_mt_slot(input, id); in magicmouse_emit_touch()
349 input_mt_report_slot_state(input, MT_TOOL_FINGER, down); in magicmouse_emit_touch()
353 input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2); in magicmouse_emit_touch()
354 input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2); in magicmouse_emit_touch()
355 input_report_abs(input, ABS_MT_ORIENTATION, -orientation); in magicmouse_emit_touch()
356 input_report_abs(input, ABS_MT_POSITION_X, x); in magicmouse_emit_touch()
357 input_report_abs(input, ABS_MT_POSITION_Y, y); in magicmouse_emit_touch()
359 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) in magicmouse_emit_touch()
360 input_report_abs(input, ABS_MT_PRESSURE, pressure); in magicmouse_emit_touch()
363 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_emit_touch()
364 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) in magicmouse_emit_touch()
365 input_event(input, EV_MSC, MSC_RAW, tdata[7]); in magicmouse_emit_touch()
366 else if (input->id.product != in magicmouse_emit_touch()
368 input_event(input, EV_MSC, MSC_RAW, tdata[8]); in magicmouse_emit_touch()
377 struct input_dev *input = msc->input; in magicmouse_raw_event() local
488 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_raw_event()
489 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_raw_event()
491 input_report_rel(input, REL_X, x); in magicmouse_raw_event()
492 input_report_rel(input, REL_Y, y); in magicmouse_raw_event()
493 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_raw_event()
494 input_mt_sync_frame(input); in magicmouse_raw_event()
495 input_report_key(input, BTN_MOUSE, clicks & 1); in magicmouse_raw_event()
497 input_report_key(input, BTN_MOUSE, clicks & 1); in magicmouse_raw_event()
498 input_mt_report_pointer_emulation(input, true); in magicmouse_raw_event()
501 input_sync(input); in magicmouse_raw_event()
509 if (msc->input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 && in magicmouse_event()
522 static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) in magicmouse_setup_input() argument
527 __set_bit(EV_KEY, input->evbit); in magicmouse_setup_input()
529 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_setup_input()
530 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_setup_input()
531 __set_bit(BTN_LEFT, input->keybit); in magicmouse_setup_input()
532 __set_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
534 __set_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
536 __set_bit(EV_REL, input->evbit); in magicmouse_setup_input()
537 __set_bit(REL_X, input->relbit); in magicmouse_setup_input()
538 __set_bit(REL_Y, input->relbit); in magicmouse_setup_input()
540 __set_bit(REL_WHEEL, input->relbit); in magicmouse_setup_input()
541 __set_bit(REL_HWHEEL, input->relbit); in magicmouse_setup_input()
542 __set_bit(REL_WHEEL_HI_RES, input->relbit); in magicmouse_setup_input()
543 __set_bit(REL_HWHEEL_HI_RES, input->relbit); in magicmouse_setup_input()
545 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_setup_input()
555 if (input->id.version == TRACKPAD2_2021_BT_VERSION) in magicmouse_setup_input()
556 input->name = "Apple Inc. Magic Trackpad"; in magicmouse_setup_input()
558 input->name = "Apple Inc. Magic Trackpad 2"; in magicmouse_setup_input()
560 input->name = hdev->name; in magicmouse_setup_input()
563 __clear_bit(EV_MSC, input->evbit); in magicmouse_setup_input()
564 __clear_bit(BTN_0, input->keybit); in magicmouse_setup_input()
565 __clear_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
566 __clear_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
567 __set_bit(BTN_MOUSE, input->keybit); in magicmouse_setup_input()
568 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); in magicmouse_setup_input()
569 __set_bit(BTN_TOOL_FINGER, input->keybit); in magicmouse_setup_input()
579 __clear_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
580 __clear_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
581 __set_bit(BTN_MOUSE, input->keybit); in magicmouse_setup_input()
582 __set_bit(BTN_TOOL_FINGER, input->keybit); in magicmouse_setup_input()
583 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); in magicmouse_setup_input()
584 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); in magicmouse_setup_input()
585 __set_bit(BTN_TOOL_QUADTAP, input->keybit); in magicmouse_setup_input()
586 __set_bit(BTN_TOOL_QUINTTAP, input->keybit); in magicmouse_setup_input()
587 __set_bit(BTN_TOUCH, input->keybit); in magicmouse_setup_input()
588 __set_bit(INPUT_PROP_POINTER, input->propbit); in magicmouse_setup_input()
589 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); in magicmouse_setup_input()
593 __set_bit(EV_ABS, input->evbit); in magicmouse_setup_input()
595 error = input_mt_init_slots(input, 16, mt_flags); in magicmouse_setup_input()
598 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2, in magicmouse_setup_input()
600 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2, in magicmouse_setup_input()
609 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_setup_input()
610 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_setup_input()
611 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); in magicmouse_setup_input()
612 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
614 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
617 input_abs_set_res(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
619 input_abs_set_res(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
621 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_setup_input()
622 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 253, 0, 0); in magicmouse_setup_input()
623 input_set_abs_params(input, ABS_PRESSURE, 0, 253, 0, 0); in magicmouse_setup_input()
624 input_set_abs_params(input, ABS_MT_ORIENTATION, -3, 4, 0, 0); in magicmouse_setup_input()
625 input_set_abs_params(input, ABS_X, TRACKPAD2_MIN_X, in magicmouse_setup_input()
627 input_set_abs_params(input, ABS_Y, TRACKPAD2_MIN_Y, in magicmouse_setup_input()
629 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
631 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
634 input_abs_set_res(input, ABS_X, TRACKPAD2_RES_X); in magicmouse_setup_input()
635 input_abs_set_res(input, ABS_Y, TRACKPAD2_RES_Y); in magicmouse_setup_input()
636 input_abs_set_res(input, ABS_MT_POSITION_X, TRACKPAD2_RES_X); in magicmouse_setup_input()
637 input_abs_set_res(input, ABS_MT_POSITION_Y, TRACKPAD2_RES_Y); in magicmouse_setup_input()
639 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); in magicmouse_setup_input()
640 input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, in magicmouse_setup_input()
642 input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, in magicmouse_setup_input()
644 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
646 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
649 input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); in magicmouse_setup_input()
650 input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); in magicmouse_setup_input()
651 input_abs_set_res(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
653 input_abs_set_res(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
657 input_set_events_per_packet(input, 60); in magicmouse_setup_input()
660 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_setup_input()
661 __set_bit(EV_MSC, input->evbit); in magicmouse_setup_input()
662 __set_bit(MSC_RAW, input->mscbit); in magicmouse_setup_input()
669 __clear_bit(EV_REP, input->evbit); in magicmouse_setup_input()
680 if (!msc->input) in magicmouse_input_mapping()
681 msc->input = hi->input; in magicmouse_input_mapping()
684 if ((hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD || in magicmouse_input_mapping()
685 hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) && in magicmouse_input_mapping()
699 ret = magicmouse_setup_input(msc->input, hdev); in magicmouse_input_configured()
703 msc->input = NULL; in magicmouse_input_configured()
838 if (!msc->input) { in magicmouse_probe()