aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-09-22 05:29:07 -0400
committerJiri Kosina <jkosina@suse.cz>2010-09-22 05:29:07 -0400
commit48216fbdad6cc462b056ce1e876edcc664d32a8d (patch)
tree0008b59a476f0c89b77e07a0fd76dcf43c470148 /drivers/hid
parent1d958c83c8d77ad4977ae963017e87cec8cca9b5 (diff)
HID: 3m: Adjust major / minor axes to scale
By visual inspection, the reported touch_major and touch_minor axes are a factor of two too large. Presumably the device actually reports the width_major and width_minor, which are generally about a factor of two larger than the touches themselves. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-3m-pct.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c
index 39628e02a428..02d8cd3b1b1b 100644
--- a/drivers/hid/hid-3m-pct.c
+++ b/drivers/hid/hid-3m-pct.c
@@ -166,16 +166,18 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
166 if (f->touch) { 166 if (f->touch) {
167 /* this finger is on the screen */ 167 /* this finger is on the screen */
168 int wide = (f->w > f->h); 168 int wide = (f->w > f->h);
169 /* divided by two to match visual scale of touch */
170 int major = max(f->w, f->h) >> 1;
171 int minor = min(f->w, f->h) >> 1;
172
169 if (!f->prev_touch) 173 if (!f->prev_touch)
170 f->id = md->id++; 174 f->id = md->id++;
171 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id); 175 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id);
172 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); 176 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
173 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); 177 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
174 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); 178 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
175 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, 179 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
176 wide ? f->w : f->h); 180 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
177 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR,
178 wide ? f->h : f->w);
179 /* touchscreen emulation: pick the oldest contact */ 181 /* touchscreen emulation: pick the oldest contact */
180 if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1))) 182 if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1)))
181 oldest = f; 183 oldest = f;