Lines Matching defs:msc

132 static int magicmouse_firm_touch(struct magicmouse_sc *msc)
140 for (ii = 0; ii < msc->ntouches; ii++) {
141 int idx = msc->tracking_ids[ii];
142 if (msc->touches[idx].size < 8) {
155 static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state)
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;
172 } else if ((id = magicmouse_firm_touch(msc)) >= 0) {
173 int x = msc->touches[id].x;
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);
189 msc->scroll_accel = SCROLL_ACCEL_DEFAULT;
192 static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata)
194 struct input_dev *input = msc->input;
232 msc->tracking_ids[raw_id] = id;
233 msc->touches[id].x = x;
234 msc->touches[id].y = y;
235 msc->touches[id].size = size;
243 int step_x = msc->touches[id].scroll_x - x;
244 int step_y = msc->touches[id].scroll_y - y;
249 msc->touches[id].scroll_x = x;
250 msc->touches[id].scroll_y = y;
254 msc->scroll_jiffies + HZ / 2))
255 msc->scroll_accel = max_t(int,
256 msc->scroll_accel - 1, 1);
258 msc->scroll_accel = SCROLL_ACCEL_DEFAULT;
262 step_x /= (64 - (int)scroll_speed) * msc->scroll_accel;
264 msc->touches[id].scroll_x -= step_x *
265 (64 - scroll_speed) * msc->scroll_accel;
266 msc->scroll_jiffies = now;
270 step_y /= (64 - (int)scroll_speed) * msc->scroll_accel;
272 msc->touches[id].scroll_y -= step_y *
273 (64 - scroll_speed) * msc->scroll_accel;
274 msc->scroll_jiffies = now;
282 msc->ntouches++;
311 struct magicmouse_sc *msc = hid_get_drvdata(hdev);
312 struct input_dev *input = msc->input;
327 msc->ntouches = 0;
329 magicmouse_emit_touch(msc, ii, data + ii * 9 + 4);
349 msc->ntouches = 0;
351 magicmouse_emit_touch(msc, ii, data + ii * 9 + 12);
365 msc->ntouches = 0;
367 magicmouse_emit_touch(msc, ii, data + ii * 8 + 6);
396 magicmouse_emit_buttons(msc, clicks & 3);
551 struct magicmouse_sc *msc = hid_get_drvdata(hdev);
553 if (!msc->input)
554 msc->input = hi->input;
569 struct magicmouse_sc *msc = hid_get_drvdata(hdev);
572 ret = magicmouse_setup_input(msc->input, hdev);
575 /* clean msc->input to notify probe() of the failure */
576 msc->input = NULL;
592 struct magicmouse_sc *msc;
602 msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
603 if (msc == NULL) {
608 msc->scroll_accel = SCROLL_ACCEL_DEFAULT;
610 msc->quirks = id->driver_data;
611 hid_set_drvdata(hdev, msc);
625 if (!msc->input) {