Lines Matching refs:input
128 struct input_dev *input; member
178 int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 | in magicmouse_emit_buttons()
179 test_bit(BTN_RIGHT, msc->input->key) << 1 | in magicmouse_emit_buttons()
180 test_bit(BTN_MIDDLE, msc->input->key) << 2; in magicmouse_emit_buttons()
203 input_report_key(msc->input, BTN_MIDDLE, state & 4); in magicmouse_emit_buttons()
206 input_report_key(msc->input, BTN_LEFT, state & 1); in magicmouse_emit_buttons()
207 input_report_key(msc->input, BTN_RIGHT, state & 2); in magicmouse_emit_buttons()
215 struct input_dev *input = msc->input; in magicmouse_emit_touch() local
219 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_emit_touch()
220 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_emit_touch()
230 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || in magicmouse_emit_touch()
231 input->id.product == in magicmouse_emit_touch()
265 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && in magicmouse_emit_touch()
266 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC) { in magicmouse_emit_touch()
303 input_report_rel(input, REL_HWHEEL, -step_x); in magicmouse_emit_touch()
311 input_report_rel(input, REL_WHEEL, step_y); in magicmouse_emit_touch()
326 input_report_rel(input, in magicmouse_emit_touch()
343 input_report_rel(input, in magicmouse_emit_touch()
354 input_mt_slot(input, id); in magicmouse_emit_touch()
355 input_mt_report_slot_state(input, MT_TOOL_FINGER, down); in magicmouse_emit_touch()
359 input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2); in magicmouse_emit_touch()
360 input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2); in magicmouse_emit_touch()
361 input_report_abs(input, ABS_MT_ORIENTATION, -orientation); in magicmouse_emit_touch()
362 input_report_abs(input, ABS_MT_POSITION_X, x); in magicmouse_emit_touch()
363 input_report_abs(input, ABS_MT_POSITION_Y, y); in magicmouse_emit_touch()
365 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || in magicmouse_emit_touch()
366 input->id.product == in magicmouse_emit_touch()
368 input_report_abs(input, ABS_MT_PRESSURE, pressure); in magicmouse_emit_touch()
371 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_emit_touch()
372 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) in magicmouse_emit_touch()
373 input_event(input, EV_MSC, MSC_RAW, tdata[7]); in magicmouse_emit_touch()
374 else if (input->id.product != in magicmouse_emit_touch()
376 input->id.product != in magicmouse_emit_touch()
378 input_event(input, EV_MSC, MSC_RAW, tdata[8]); in magicmouse_emit_touch()
387 struct input_dev *input = msc->input; in magicmouse_raw_event() local
498 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_raw_event()
499 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_raw_event()
501 input_report_rel(input, REL_X, x); in magicmouse_raw_event()
502 input_report_rel(input, REL_Y, y); in magicmouse_raw_event()
503 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || in magicmouse_raw_event()
504 input->id.product == in magicmouse_raw_event()
506 input_mt_sync_frame(input); in magicmouse_raw_event()
507 input_report_key(input, BTN_MOUSE, clicks & 1); in magicmouse_raw_event()
509 input_report_key(input, BTN_MOUSE, clicks & 1); in magicmouse_raw_event()
510 input_mt_report_pointer_emulation(input, true); in magicmouse_raw_event()
513 input_sync(input); in magicmouse_raw_event()
521 if (msc->input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 && in magicmouse_event()
534 static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) in magicmouse_setup_input() argument
539 __set_bit(EV_KEY, input->evbit); in magicmouse_setup_input()
541 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_setup_input()
542 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_setup_input()
543 __set_bit(BTN_LEFT, input->keybit); in magicmouse_setup_input()
544 __set_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
546 __set_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
548 __set_bit(EV_REL, input->evbit); in magicmouse_setup_input()
549 __set_bit(REL_X, input->relbit); in magicmouse_setup_input()
550 __set_bit(REL_Y, input->relbit); in magicmouse_setup_input()
552 __set_bit(REL_WHEEL, input->relbit); in magicmouse_setup_input()
553 __set_bit(REL_HWHEEL, input->relbit); in magicmouse_setup_input()
554 __set_bit(REL_WHEEL_HI_RES, input->relbit); in magicmouse_setup_input()
555 __set_bit(REL_HWHEEL_HI_RES, input->relbit); in magicmouse_setup_input()
557 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || in magicmouse_setup_input()
558 input->id.product == in magicmouse_setup_input()
569 if (input->id.version == TRACKPAD2_2021_BT_VERSION) in magicmouse_setup_input()
570 input->name = "Apple Inc. Magic Trackpad"; in magicmouse_setup_input()
572 input->name = "Apple Inc. Magic Trackpad 2"; in magicmouse_setup_input()
574 input->name = hdev->name; in magicmouse_setup_input()
577 __clear_bit(EV_MSC, input->evbit); in magicmouse_setup_input()
578 __clear_bit(BTN_0, 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(INPUT_PROP_BUTTONPAD, input->propbit); in magicmouse_setup_input()
583 __set_bit(BTN_TOOL_FINGER, input->keybit); in magicmouse_setup_input()
593 __clear_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
594 __clear_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
595 __set_bit(BTN_MOUSE, input->keybit); in magicmouse_setup_input()
596 __set_bit(BTN_TOOL_FINGER, input->keybit); in magicmouse_setup_input()
597 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); in magicmouse_setup_input()
598 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); in magicmouse_setup_input()
599 __set_bit(BTN_TOOL_QUADTAP, input->keybit); in magicmouse_setup_input()
600 __set_bit(BTN_TOOL_QUINTTAP, input->keybit); in magicmouse_setup_input()
601 __set_bit(BTN_TOUCH, input->keybit); in magicmouse_setup_input()
602 __set_bit(INPUT_PROP_POINTER, input->propbit); in magicmouse_setup_input()
603 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); in magicmouse_setup_input()
607 __set_bit(EV_ABS, input->evbit); in magicmouse_setup_input()
609 error = input_mt_init_slots(input, 16, mt_flags); in magicmouse_setup_input()
612 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2, in magicmouse_setup_input()
614 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2, in magicmouse_setup_input()
623 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_setup_input()
624 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_setup_input()
625 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); in magicmouse_setup_input()
626 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
628 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
631 input_abs_set_res(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
633 input_abs_set_res(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
635 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || in magicmouse_setup_input()
636 input->id.product == in magicmouse_setup_input()
638 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 253, 0, 0); in magicmouse_setup_input()
639 input_set_abs_params(input, ABS_PRESSURE, 0, 253, 0, 0); in magicmouse_setup_input()
640 input_set_abs_params(input, ABS_MT_ORIENTATION, -3, 4, 0, 0); in magicmouse_setup_input()
641 input_set_abs_params(input, ABS_X, TRACKPAD2_MIN_X, in magicmouse_setup_input()
643 input_set_abs_params(input, ABS_Y, TRACKPAD2_MIN_Y, in magicmouse_setup_input()
645 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
647 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
650 input_abs_set_res(input, ABS_X, TRACKPAD2_RES_X); in magicmouse_setup_input()
651 input_abs_set_res(input, ABS_Y, TRACKPAD2_RES_Y); in magicmouse_setup_input()
652 input_abs_set_res(input, ABS_MT_POSITION_X, TRACKPAD2_RES_X); in magicmouse_setup_input()
653 input_abs_set_res(input, ABS_MT_POSITION_Y, TRACKPAD2_RES_Y); in magicmouse_setup_input()
655 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); in magicmouse_setup_input()
656 input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, in magicmouse_setup_input()
658 input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, in magicmouse_setup_input()
660 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
662 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
665 input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); in magicmouse_setup_input()
666 input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); in magicmouse_setup_input()
667 input_abs_set_res(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
669 input_abs_set_res(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
673 input_set_events_per_packet(input, 60); in magicmouse_setup_input()
676 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && in magicmouse_setup_input()
677 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC) { in magicmouse_setup_input()
678 __set_bit(EV_MSC, input->evbit); in magicmouse_setup_input()
679 __set_bit(MSC_RAW, input->mscbit); in magicmouse_setup_input()
686 __clear_bit(EV_REP, input->evbit); in magicmouse_setup_input()
697 if (!msc->input) in magicmouse_input_mapping()
698 msc->input = hi->input; in magicmouse_input_mapping()
701 if ((hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD || in magicmouse_input_mapping()
702 hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || in magicmouse_input_mapping()
703 hi->input->id.product == in magicmouse_input_mapping()
718 ret = magicmouse_setup_input(msc->input, hdev); in magicmouse_input_configured()
722 msc->input = NULL; in magicmouse_input_configured()
861 if (!msc->input) { in magicmouse_probe()