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()
262 if (emulate_scroll_wheel && (input->id.product != in magicmouse_emit_touch()
300 input_report_rel(input, REL_HWHEEL, -step_x); in magicmouse_emit_touch()
308 input_report_rel(input, REL_WHEEL, step_y); in magicmouse_emit_touch()
323 input_report_rel(input, in magicmouse_emit_touch()
340 input_report_rel(input, in magicmouse_emit_touch()
351 input_mt_slot(input, id); in magicmouse_emit_touch()
352 input_mt_report_slot_state(input, MT_TOOL_FINGER, down); in magicmouse_emit_touch()
356 input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2); in magicmouse_emit_touch()
357 input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2); in magicmouse_emit_touch()
358 input_report_abs(input, ABS_MT_ORIENTATION, -orientation); in magicmouse_emit_touch()
359 input_report_abs(input, ABS_MT_POSITION_X, x); in magicmouse_emit_touch()
360 input_report_abs(input, ABS_MT_POSITION_Y, y); in magicmouse_emit_touch()
362 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) in magicmouse_emit_touch()
363 input_report_abs(input, ABS_MT_PRESSURE, pressure); in magicmouse_emit_touch()
366 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_emit_touch()
367 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) in magicmouse_emit_touch()
368 input_event(input, EV_MSC, MSC_RAW, tdata[7]); in magicmouse_emit_touch()
369 else if (input->id.product != in magicmouse_emit_touch()
371 input_event(input, EV_MSC, MSC_RAW, tdata[8]); in magicmouse_emit_touch()
380 struct input_dev *input = msc->input; in magicmouse_raw_event() local
491 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_raw_event()
492 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_raw_event()
494 input_report_rel(input, REL_X, x); in magicmouse_raw_event()
495 input_report_rel(input, REL_Y, y); in magicmouse_raw_event()
496 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_raw_event()
497 input_mt_sync_frame(input); in magicmouse_raw_event()
498 input_report_key(input, BTN_MOUSE, clicks & 1); in magicmouse_raw_event()
500 input_report_key(input, BTN_MOUSE, clicks & 1); in magicmouse_raw_event()
501 input_mt_report_pointer_emulation(input, true); in magicmouse_raw_event()
504 input_sync(input); in magicmouse_raw_event()
512 if (msc->input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 && in magicmouse_event()
525 static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) in magicmouse_setup_input() argument
530 __set_bit(EV_KEY, input->evbit); in magicmouse_setup_input()
532 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_setup_input()
533 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_setup_input()
534 __set_bit(BTN_LEFT, input->keybit); in magicmouse_setup_input()
535 __set_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
537 __set_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
539 __set_bit(EV_REL, input->evbit); in magicmouse_setup_input()
540 __set_bit(REL_X, input->relbit); in magicmouse_setup_input()
541 __set_bit(REL_Y, input->relbit); in magicmouse_setup_input()
543 __set_bit(REL_WHEEL, input->relbit); in magicmouse_setup_input()
544 __set_bit(REL_HWHEEL, input->relbit); in magicmouse_setup_input()
545 __set_bit(REL_WHEEL_HI_RES, input->relbit); in magicmouse_setup_input()
546 __set_bit(REL_HWHEEL_HI_RES, input->relbit); in magicmouse_setup_input()
548 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_setup_input()
558 if (input->id.version == TRACKPAD2_2021_BT_VERSION) in magicmouse_setup_input()
559 input->name = "Apple Inc. Magic Trackpad"; in magicmouse_setup_input()
561 input->name = "Apple Inc. Magic Trackpad 2"; in magicmouse_setup_input()
563 input->name = hdev->name; in magicmouse_setup_input()
566 __clear_bit(EV_MSC, input->evbit); in magicmouse_setup_input()
567 __clear_bit(BTN_0, input->keybit); in magicmouse_setup_input()
568 __clear_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
569 __clear_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
570 __set_bit(BTN_MOUSE, input->keybit); in magicmouse_setup_input()
571 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); in magicmouse_setup_input()
572 __set_bit(BTN_TOOL_FINGER, input->keybit); in magicmouse_setup_input()
582 __clear_bit(BTN_RIGHT, input->keybit); in magicmouse_setup_input()
583 __clear_bit(BTN_MIDDLE, input->keybit); in magicmouse_setup_input()
584 __set_bit(BTN_MOUSE, input->keybit); in magicmouse_setup_input()
585 __set_bit(BTN_TOOL_FINGER, input->keybit); in magicmouse_setup_input()
586 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); in magicmouse_setup_input()
587 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); in magicmouse_setup_input()
588 __set_bit(BTN_TOOL_QUADTAP, input->keybit); in magicmouse_setup_input()
589 __set_bit(BTN_TOOL_QUINTTAP, input->keybit); in magicmouse_setup_input()
590 __set_bit(BTN_TOUCH, input->keybit); in magicmouse_setup_input()
591 __set_bit(INPUT_PROP_POINTER, input->propbit); in magicmouse_setup_input()
592 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); in magicmouse_setup_input()
596 __set_bit(EV_ABS, input->evbit); in magicmouse_setup_input()
598 error = input_mt_init_slots(input, 16, mt_flags); in magicmouse_setup_input()
601 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2, in magicmouse_setup_input()
603 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2, in magicmouse_setup_input()
612 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE || in magicmouse_setup_input()
613 input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) { in magicmouse_setup_input()
614 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); in magicmouse_setup_input()
615 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
617 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
620 input_abs_set_res(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
622 input_abs_set_res(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
624 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_setup_input()
625 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 253, 0, 0); in magicmouse_setup_input()
626 input_set_abs_params(input, ABS_PRESSURE, 0, 253, 0, 0); in magicmouse_setup_input()
627 input_set_abs_params(input, ABS_MT_ORIENTATION, -3, 4, 0, 0); in magicmouse_setup_input()
628 input_set_abs_params(input, ABS_X, TRACKPAD2_MIN_X, in magicmouse_setup_input()
630 input_set_abs_params(input, ABS_Y, TRACKPAD2_MIN_Y, in magicmouse_setup_input()
632 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
634 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
637 input_abs_set_res(input, ABS_X, TRACKPAD2_RES_X); in magicmouse_setup_input()
638 input_abs_set_res(input, ABS_Y, TRACKPAD2_RES_Y); in magicmouse_setup_input()
639 input_abs_set_res(input, ABS_MT_POSITION_X, TRACKPAD2_RES_X); in magicmouse_setup_input()
640 input_abs_set_res(input, ABS_MT_POSITION_Y, TRACKPAD2_RES_Y); in magicmouse_setup_input()
642 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); in magicmouse_setup_input()
643 input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, in magicmouse_setup_input()
645 input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, in magicmouse_setup_input()
647 input_set_abs_params(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
649 input_set_abs_params(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
652 input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); in magicmouse_setup_input()
653 input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); in magicmouse_setup_input()
654 input_abs_set_res(input, ABS_MT_POSITION_X, in magicmouse_setup_input()
656 input_abs_set_res(input, ABS_MT_POSITION_Y, in magicmouse_setup_input()
660 input_set_events_per_packet(input, 60); in magicmouse_setup_input()
663 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) { in magicmouse_setup_input()
664 __set_bit(EV_MSC, input->evbit); in magicmouse_setup_input()
665 __set_bit(MSC_RAW, input->mscbit); in magicmouse_setup_input()
672 __clear_bit(EV_REP, input->evbit); in magicmouse_setup_input()
683 if (!msc->input) in magicmouse_input_mapping()
684 msc->input = hi->input; in magicmouse_input_mapping()
687 if ((hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD || in magicmouse_input_mapping()
688 hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) && in magicmouse_input_mapping()
702 ret = magicmouse_setup_input(msc->input, hdev); in magicmouse_input_configured()
706 msc->input = NULL; in magicmouse_input_configured()
841 if (!msc->input) { in magicmouse_probe()