Lines Matching defs:msc

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