Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215570
b: refs/heads/master
c: 6de048b
h: refs/heads/master
v: v3
  • Loading branch information
Chase Douglas authored and Jiri Kosina committed Sep 3, 2010
1 parent b0f028e commit dc4451e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0773590c89fee9c62eaddc5459e52ba96173f930
refs/heads/master: 6de048bf1dd2ad35fe9b2326bf9d6d23fb2fff7a
25 changes: 13 additions & 12 deletions trunk/drivers/hid/hid-magicmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,21 @@ static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state)
static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata)
{
struct input_dev *input = msc->input;
__s32 x_y = tdata[0] << 8 | tdata[1] << 16 | tdata[2] << 24;
int misc = tdata[5] | tdata[6] << 8;
int id = (misc >> 6) & 15;
int x = x_y << 12 >> 20;
int y = -(x_y >> 20);
int down = (tdata[7] & TOUCH_STATE_MASK) != TOUCH_STATE_NONE;
int id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
int x = (tdata[1] << 28 | tdata[0] << 20) >> 20;
int y = -((tdata[2] << 24 | tdata[1] << 16) >> 20);
int size = tdata[5] & 0x3f;
int orientation = (tdata[6] >> 2) - 32;
int touch_major = tdata[3];
int touch_minor = tdata[4];
int state = tdata[7] & TOUCH_STATE_MASK;
int down = state != TOUCH_STATE_NONE;

/* Store tracking ID and other fields. */
msc->tracking_ids[raw_id] = id;
msc->touches[id].x = x;
msc->touches[id].y = y;
msc->touches[id].size = misc & 63;
msc->touches[id].size = size;

/* If requested, emulate a scroll wheel by detecting small
* vertical touch motions.
Expand All @@ -180,7 +183,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
int step_y = msc->touches[id].scroll_y - y;

/* Calculate and apply the scroll motion. */
switch (tdata[7] & TOUCH_STATE_MASK) {
switch (state) {
case TOUCH_STATE_START:
msc->touches[id].scroll_x = x;
msc->touches[id].scroll_y = y;
Expand Down Expand Up @@ -216,11 +219,9 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda

/* Generate the input events for this touch. */
if (report_touches && down) {
int orientation = (misc >> 10) - 32;

input_report_abs(input, ABS_MT_TRACKING_ID, id);
input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]);
input_report_abs(input, ABS_MT_TOUCH_MINOR, tdata[4]);
input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major);
input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor);
input_report_abs(input, ABS_MT_ORIENTATION, orientation);
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
Expand Down

0 comments on commit dc4451e

Please sign in to comment.