Lines Matching refs:input
16 #include <linux/input/mt.h>
116 * @input: Input device through which we report events.
122 * @tracking_ids: Mapping of current touch input data to @touches.
125 struct input_dev *input;
175 int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 |
176 test_bit(BTN_RIGHT, msc->input->key) << 1 |
177 test_bit(BTN_MIDDLE, msc->input->key) << 2;
200 input_report_key(msc->input, BTN_MIDDLE, state & 4);
203 input_report_key(msc->input, BTN_LEFT, state & 1);
204 input_report_key(msc->input, BTN_RIGHT, state & 2);
212 struct input_dev *input = msc->input;
216 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE ||
217 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) {
227 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
259 if (emulate_scroll_wheel && (input->id.product !=
297 input_report_rel(input, REL_HWHEEL, -step_x);
305 input_report_rel(input, REL_WHEEL, step_y);
320 input_report_rel(input,
337 input_report_rel(input,
348 input_mt_slot(input, id);
349 input_mt_report_slot_state(input, MT_TOOL_FINGER, down);
351 /* Generate the input events for this touch. */
353 input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2);
354 input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2);
355 input_report_abs(input, ABS_MT_ORIENTATION, -orientation);
356 input_report_abs(input, ABS_MT_POSITION_X, x);
357 input_report_abs(input, ABS_MT_POSITION_Y, y);
359 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)
360 input_report_abs(input, ABS_MT_PRESSURE, pressure);
363 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE ||
364 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2)
365 input_event(input, EV_MSC, MSC_RAW, tdata[7]);
366 else if (input->id.product !=
368 input_event(input, EV_MSC, MSC_RAW, tdata[8]);
377 struct input_dev *input = msc->input;
488 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE ||
489 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) {
491 input_report_rel(input, REL_X, x);
492 input_report_rel(input, REL_Y, y);
493 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
494 input_mt_sync_frame(input);
495 input_report_key(input, BTN_MOUSE, clicks & 1);
497 input_report_key(input, BTN_MOUSE, clicks & 1);
498 input_mt_report_pointer_emulation(input, true);
501 input_sync(input);
509 if (msc->input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 &&
522 static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev)
527 __set_bit(EV_KEY, input->evbit);
529 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE ||
530 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) {
531 __set_bit(BTN_LEFT, input->keybit);
532 __set_bit(BTN_RIGHT, input->keybit);
534 __set_bit(BTN_MIDDLE, input->keybit);
536 __set_bit(EV_REL, input->evbit);
537 __set_bit(REL_X, input->relbit);
538 __set_bit(REL_Y, input->relbit);
540 __set_bit(REL_WHEEL, input->relbit);
541 __set_bit(REL_HWHEEL, input->relbit);
542 __set_bit(REL_WHEEL_HI_RES, input->relbit);
543 __set_bit(REL_HWHEEL_HI_RES, input->relbit);
545 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
555 if (input->id.version == TRACKPAD2_2021_BT_VERSION)
556 input->name = "Apple Inc. Magic Trackpad";
558 input->name = "Apple Inc. Magic Trackpad 2";
560 input->name = hdev->name;
563 __clear_bit(EV_MSC, input->evbit);
564 __clear_bit(BTN_0, input->keybit);
565 __clear_bit(BTN_RIGHT, input->keybit);
566 __clear_bit(BTN_MIDDLE, input->keybit);
567 __set_bit(BTN_MOUSE, input->keybit);
568 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
569 __set_bit(BTN_TOOL_FINGER, input->keybit);
574 /* input->keybit is initialized with incorrect button info
579 __clear_bit(BTN_RIGHT, input->keybit);
580 __clear_bit(BTN_MIDDLE, input->keybit);
581 __set_bit(BTN_MOUSE, input->keybit);
582 __set_bit(BTN_TOOL_FINGER, input->keybit);
583 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
584 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
585 __set_bit(BTN_TOOL_QUADTAP, input->keybit);
586 __set_bit(BTN_TOOL_QUINTTAP, input->keybit);
587 __set_bit(BTN_TOUCH, input->keybit);
588 __set_bit(INPUT_PROP_POINTER, input->propbit);
589 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
593 __set_bit(EV_ABS, input->evbit);
595 error = input_mt_init_slots(input, 16, mt_flags);
598 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
600 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2,
609 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE ||
610 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) {
611 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
612 input_set_abs_params(input, ABS_MT_POSITION_X,
614 input_set_abs_params(input, ABS_MT_POSITION_Y,
617 input_abs_set_res(input, ABS_MT_POSITION_X,
619 input_abs_set_res(input, ABS_MT_POSITION_Y,
621 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
622 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 253, 0, 0);
623 input_set_abs_params(input, ABS_PRESSURE, 0, 253, 0, 0);
624 input_set_abs_params(input, ABS_MT_ORIENTATION, -3, 4, 0, 0);
625 input_set_abs_params(input, ABS_X, TRACKPAD2_MIN_X,
627 input_set_abs_params(input, ABS_Y, TRACKPAD2_MIN_Y,
629 input_set_abs_params(input, ABS_MT_POSITION_X,
631 input_set_abs_params(input, ABS_MT_POSITION_Y,
634 input_abs_set_res(input, ABS_X, TRACKPAD2_RES_X);
635 input_abs_set_res(input, ABS_Y, TRACKPAD2_RES_Y);
636 input_abs_set_res(input, ABS_MT_POSITION_X, TRACKPAD2_RES_X);
637 input_abs_set_res(input, ABS_MT_POSITION_Y, TRACKPAD2_RES_Y);
639 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
640 input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
642 input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
644 input_set_abs_params(input, ABS_MT_POSITION_X,
646 input_set_abs_params(input, ABS_MT_POSITION_Y,
649 input_abs_set_res(input, ABS_X, TRACKPAD_RES_X);
650 input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y);
651 input_abs_set_res(input, ABS_MT_POSITION_X,
653 input_abs_set_res(input, ABS_MT_POSITION_Y,
657 input_set_events_per_packet(input, 60);
660 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
661 __set_bit(EV_MSC, input->evbit);
662 __set_bit(MSC_RAW, input->mscbit);
666 * hid-input may mark device as using autorepeat, but neither
669 __clear_bit(EV_REP, input->evbit);
680 if (!msc->input)
681 msc->input = hi->input;
684 if ((hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD ||
685 hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) &&
699 ret = magicmouse_setup_input(msc->input, hdev);
701 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
702 /* clean msc->input to notify probe() of the failure */
703 msc->input = NULL;
838 if (!msc->input) {
839 hid_err(hdev, "magicmouse input not registered\n");