input: mt: Break out slots handling
[deliverable/linux.git] / drivers / hid / hid-3m-pct.c
index 39628e02a4288f290211ab8de753f8af0a67210e..18575a4e0d630f030a86082f3c1cf533b1ebb442 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
+#include <linux/input/mt.h>
 
 MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
 MODULE_DESCRIPTION("3M PCT multitouch panels");
@@ -166,16 +167,18 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
                if (f->touch) {
                        /* this finger is on the screen */
                        int wide = (f->w > f->h);
+                       /* divided by two to match visual scale of touch */
+                       int major = max(f->w, f->h) >> 1;
+                       int minor = min(f->w, f->h) >> 1;
+
                        if (!f->prev_touch)
                                f->id = md->id++;
                        input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id);
                        input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
                        input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
                        input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
-                       input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR,
-                                               wide ? f->w : f->h);
-                       input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR,
-                                               wide ? f->h : f->w);
+                       input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
+                       input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
                        /* touchscreen emulation: pick the oldest contact */
                        if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1)))
                                oldest = f;
This page took 0.038701 seconds and 5 git commands to generate.