• Home
  • Raw
  • Download

Lines Matching refs:msc

150 static int magicmouse_firm_touch(struct magicmouse_sc *msc)  in magicmouse_firm_touch()  argument
158 for (ii = 0; ii < msc->ntouches; ii++) { in magicmouse_firm_touch()
159 int idx = msc->tracking_ids[ii]; in magicmouse_firm_touch()
160 if (msc->touches[idx].size < 8) { in magicmouse_firm_touch()
173 static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state) in magicmouse_emit_buttons() argument
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()
190 } else if ((id = magicmouse_firm_touch(msc)) >= 0) { in magicmouse_emit_buttons()
191 int x = msc->touches[id].x; 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()
207 msc->scroll_accel = SCROLL_ACCEL_DEFAULT; in magicmouse_emit_buttons()
210 static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) in magicmouse_emit_touch() argument
212 struct input_dev *input = msc->input; in magicmouse_emit_touch()
251 msc->tracking_ids[raw_id] = id; in magicmouse_emit_touch()
252 msc->touches[id].x = x; in magicmouse_emit_touch()
253 msc->touches[id].y = y; in magicmouse_emit_touch()
254 msc->touches[id].size = size; in magicmouse_emit_touch()
262 int step_x = msc->touches[id].scroll_x - x; in magicmouse_emit_touch()
263 int step_y = msc->touches[id].scroll_y - y; in magicmouse_emit_touch()
266 ((64 - (int)scroll_speed) * msc->scroll_accel) / in magicmouse_emit_touch()
269 int step_x_hr = msc->touches[id].scroll_x_hr - x; in magicmouse_emit_touch()
270 int step_y_hr = msc->touches[id].scroll_y_hr - y; in magicmouse_emit_touch()
275 msc->touches[id].scroll_x = x; in magicmouse_emit_touch()
276 msc->touches[id].scroll_y = y; in magicmouse_emit_touch()
277 msc->touches[id].scroll_x_hr = x; in magicmouse_emit_touch()
278 msc->touches[id].scroll_y_hr = y; in magicmouse_emit_touch()
279 msc->touches[id].scroll_x_active = false; in magicmouse_emit_touch()
280 msc->touches[id].scroll_y_active = false; in magicmouse_emit_touch()
284 msc->scroll_jiffies + HZ / 2)) in magicmouse_emit_touch()
285 msc->scroll_accel = max_t(int, in magicmouse_emit_touch()
286 msc->scroll_accel - 1, 1); in magicmouse_emit_touch()
288 msc->scroll_accel = SCROLL_ACCEL_DEFAULT; in magicmouse_emit_touch()
292 step_x /= (64 - (int)scroll_speed) * msc->scroll_accel; in magicmouse_emit_touch()
294 msc->touches[id].scroll_x -= step_x * in magicmouse_emit_touch()
295 (64 - scroll_speed) * msc->scroll_accel; in magicmouse_emit_touch()
296 msc->scroll_jiffies = now; in magicmouse_emit_touch()
300 step_y /= (64 - (int)scroll_speed) * msc->scroll_accel; in magicmouse_emit_touch()
302 msc->touches[id].scroll_y -= step_y * in magicmouse_emit_touch()
303 (64 - scroll_speed) * msc->scroll_accel; in magicmouse_emit_touch()
304 msc->scroll_jiffies = now; in magicmouse_emit_touch()
308 if (!msc->touches[id].scroll_x_active && in magicmouse_emit_touch()
310 msc->touches[id].scroll_x_active = true; in magicmouse_emit_touch()
311 msc->touches[id].scroll_x_hr = x; in magicmouse_emit_touch()
317 msc->touches[id].scroll_x_active) { in magicmouse_emit_touch()
318 msc->touches[id].scroll_x_hr -= step_x_hr * in magicmouse_emit_touch()
325 if (!msc->touches[id].scroll_y_active && in magicmouse_emit_touch()
327 msc->touches[id].scroll_y_active = true; in magicmouse_emit_touch()
328 msc->touches[id].scroll_y_hr = y; in magicmouse_emit_touch()
334 msc->touches[id].scroll_y_active) { in magicmouse_emit_touch()
335 msc->touches[id].scroll_y_hr -= step_y_hr * in magicmouse_emit_touch()
346 msc->ntouches++; in magicmouse_emit_touch()
376 struct magicmouse_sc *msc = hid_get_drvdata(hdev); in magicmouse_raw_event() local
377 struct input_dev *input = msc->input; in magicmouse_raw_event()
392 msc->ntouches = 0; in magicmouse_raw_event()
394 magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); in magicmouse_raw_event()
414 msc->ntouches = 0; in magicmouse_raw_event()
416 magicmouse_emit_touch(msc, ii, data + ii * 9 + 12); in magicmouse_raw_event()
430 msc->ntouches = 0; in magicmouse_raw_event()
432 magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); in magicmouse_raw_event()
458 msc->ntouches = 0; in magicmouse_raw_event()
460 magicmouse_emit_touch(msc, ii, data + ii * 8 + 14); in magicmouse_raw_event()
490 magicmouse_emit_buttons(msc, clicks & 3); in magicmouse_raw_event()
508 struct magicmouse_sc *msc = hid_get_drvdata(hdev); in magicmouse_event() local
509 if (msc->input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 && in magicmouse_event()
678 struct magicmouse_sc *msc = hid_get_drvdata(hdev); in magicmouse_input_mapping() local
680 if (!msc->input) in magicmouse_input_mapping()
681 msc->input = hi->input; in magicmouse_input_mapping()
696 struct magicmouse_sc *msc = hid_get_drvdata(hdev); in magicmouse_input_configured() local
699 ret = magicmouse_setup_input(msc->input, hdev); in magicmouse_input_configured()
703 msc->input = NULL; in magicmouse_input_configured()
749 struct magicmouse_sc *msc = in magicmouse_enable_mt_work() local
753 ret = magicmouse_enable_multitouch(msc->hdev); in magicmouse_enable_mt_work()
755 hid_err(msc->hdev, "unable to request touch data (%d)\n", ret); in magicmouse_enable_mt_work()
787 struct magicmouse_sc *msc = from_timer(msc, t, battery_timer); in magicmouse_battery_timer_tick() local
788 struct hid_device *hdev = msc->hdev; in magicmouse_battery_timer_tick()
791 mod_timer(&msc->battery_timer, in magicmouse_battery_timer_tick()
799 struct magicmouse_sc *msc; in magicmouse_probe() local
803 msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); in magicmouse_probe()
804 if (msc == NULL) { in magicmouse_probe()
809 msc->scroll_accel = SCROLL_ACCEL_DEFAULT; in magicmouse_probe()
810 msc->hdev = hdev; in magicmouse_probe()
811 INIT_DEFERRABLE_WORK(&msc->work, magicmouse_enable_mt_work); in magicmouse_probe()
813 msc->quirks = id->driver_data; in magicmouse_probe()
814 hid_set_drvdata(hdev, msc); in magicmouse_probe()
828 timer_setup(&msc->battery_timer, magicmouse_battery_timer_tick, 0); in magicmouse_probe()
829 mod_timer(&msc->battery_timer, in magicmouse_probe()
838 if (!msc->input) { in magicmouse_probe()
885 schedule_delayed_work(&msc->work, msecs_to_jiffies(500)); in magicmouse_probe()
890 del_timer_sync(&msc->battery_timer); in magicmouse_probe()
897 struct magicmouse_sc *msc = hid_get_drvdata(hdev); in magicmouse_remove() local
899 if (msc) { in magicmouse_remove()
900 cancel_delayed_work_sync(&msc->work); in magicmouse_remove()
901 del_timer_sync(&msc->battery_timer); in magicmouse_remove()