Lines Matching refs:input
16 #include <linux/input/mt.h>
106 * @input: Input device through which we report events.
112 * @tracking_ids: Mapping of current touch input data to @touches.
115 struct input_dev *input;
157 int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 |
158 test_bit(BTN_RIGHT, msc->input->key) << 1 |
159 test_bit(BTN_MIDDLE, msc->input->key) << 2;
182 input_report_key(msc->input, BTN_MIDDLE, state & 4);
185 input_report_key(msc->input, BTN_LEFT, state & 1);
186 input_report_key(msc->input, BTN_RIGHT, state & 2);
194 struct input_dev *input = msc->input;
198 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
208 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
240 if (emulate_scroll_wheel && (input->id.product !=
267 input_report_rel(input, REL_HWHEEL, -step_x);
275 input_report_rel(input, REL_WHEEL, step_y);
284 input_mt_slot(input, id);
285 input_mt_report_slot_state(input, MT_TOOL_FINGER, down);
287 /* Generate the input events for this touch. */
289 input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2);
290 input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2);
291 input_report_abs(input, ABS_MT_ORIENTATION, -orientation);
292 input_report_abs(input, ABS_MT_POSITION_X, x);
293 input_report_abs(input, ABS_MT_POSITION_Y, y);
295 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)
296 input_report_abs(input, ABS_MT_PRESSURE, pressure);
299 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
300 input_event(input, EV_MSC, MSC_RAW, tdata[7]);
301 else if (input->id.product !=
303 input_event(input, EV_MSC, MSC_RAW, tdata[8]);
312 struct input_dev *input = msc->input;
395 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
397 input_report_rel(input, REL_X, x);
398 input_report_rel(input, REL_Y, y);
399 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
400 input_mt_sync_frame(input);
401 input_report_key(input, BTN_MOUSE, clicks & 1);
403 input_report_key(input, BTN_MOUSE, clicks & 1);
404 input_mt_report_pointer_emulation(input, true);
407 input_sync(input);
411 static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev)
416 __set_bit(EV_KEY, input->evbit);
418 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
419 __set_bit(BTN_LEFT, input->keybit);
420 __set_bit(BTN_RIGHT, input->keybit);
422 __set_bit(BTN_MIDDLE, input->keybit);
424 __set_bit(EV_REL, input->evbit);
425 __set_bit(REL_X, input->relbit);
426 __set_bit(REL_Y, input->relbit);
428 __set_bit(REL_WHEEL, input->relbit);
429 __set_bit(REL_HWHEEL, input->relbit);
431 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
435 input->name = "Apple Inc. Magic Trackpad 2";
437 __clear_bit(EV_MSC, input->evbit);
438 __clear_bit(BTN_0, input->keybit);
439 __clear_bit(BTN_RIGHT, input->keybit);
440 __clear_bit(BTN_MIDDLE, input->keybit);
441 __set_bit(BTN_MOUSE, input->keybit);
442 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
443 __set_bit(BTN_TOOL_FINGER, input->keybit);
448 /* input->keybit is initialized with incorrect button info
453 __clear_bit(BTN_RIGHT, input->keybit);
454 __clear_bit(BTN_MIDDLE, input->keybit);
455 __set_bit(BTN_MOUSE, input->keybit);
456 __set_bit(BTN_TOOL_FINGER, input->keybit);
457 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
458 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
459 __set_bit(BTN_TOOL_QUADTAP, input->keybit);
460 __set_bit(BTN_TOOL_QUINTTAP, input->keybit);
461 __set_bit(BTN_TOUCH, input->keybit);
462 __set_bit(INPUT_PROP_POINTER, input->propbit);
463 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
467 __set_bit(EV_ABS, input->evbit);
469 error = input_mt_init_slots(input, 16, mt_flags);
472 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
474 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2,
483 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
484 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
485 input_set_abs_params(input, ABS_MT_POSITION_X,
487 input_set_abs_params(input, ABS_MT_POSITION_Y,
490 input_abs_set_res(input, ABS_MT_POSITION_X,
492 input_abs_set_res(input, ABS_MT_POSITION_Y,
494 } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
495 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 253, 0, 0);
496 input_set_abs_params(input, ABS_PRESSURE, 0, 253, 0, 0);
497 input_set_abs_params(input, ABS_MT_ORIENTATION, -3, 4, 0, 0);
498 input_set_abs_params(input, ABS_X, TRACKPAD2_MIN_X,
500 input_set_abs_params(input, ABS_Y, TRACKPAD2_MIN_Y,
502 input_set_abs_params(input, ABS_MT_POSITION_X,
504 input_set_abs_params(input, ABS_MT_POSITION_Y,
507 input_abs_set_res(input, ABS_X, TRACKPAD2_RES_X);
508 input_abs_set_res(input, ABS_Y, TRACKPAD2_RES_Y);
509 input_abs_set_res(input, ABS_MT_POSITION_X, TRACKPAD2_RES_X);
510 input_abs_set_res(input, ABS_MT_POSITION_Y, TRACKPAD2_RES_Y);
512 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
513 input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
515 input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
517 input_set_abs_params(input, ABS_MT_POSITION_X,
519 input_set_abs_params(input, ABS_MT_POSITION_Y,
522 input_abs_set_res(input, ABS_X, TRACKPAD_RES_X);
523 input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y);
524 input_abs_set_res(input, ABS_MT_POSITION_X,
526 input_abs_set_res(input, ABS_MT_POSITION_Y,
530 input_set_events_per_packet(input, 60);
533 input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
534 __set_bit(EV_MSC, input->evbit);
535 __set_bit(MSC_RAW, input->mscbit);
539 * hid-input may mark device as using autorepeat, but neither
542 __clear_bit(EV_REP, input->evbit);
553 if (!msc->input)
554 msc->input = hi->input;
557 if ((hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD ||
558 hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) &&
572 ret = magicmouse_setup_input(msc->input, hdev);
574 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
575 /* clean msc->input to notify probe() of the failure */
576 msc->input = NULL;
625 if (!msc->input) {
626 hid_err(hdev, "magicmouse input not registered\n");