Commit e9d0a26d34818e0f9340316f8016129231560966
Committed by
Jiri Kosina
1 parent
81bbef23db
HID: multitouch: change for touch height/width
Quoting from Jonathan Clarke in previous thread(2017/01/24): "This division by 2 was added along with the touch width/height fields 6 years ago so that those fields 'match the visual scale of the touch' for a specific device (3M PCT)" "The scaling is also discarding information about touch size (1 bit for each of width/height) which is useful for any application that wants to know about it." Jonathan mentioned just what I thought in a new project recently. It dosen't make sense to discard 1 bit width/height in general case according to the spec in multi-touch-protocol.txt so I would like to make a slight change here. A quirk MT_QUIRK_TOUCH_SIZE_SCALING was added to service devices like 3M PCT with a special visual scale and the division by 2 only take effect with devices like that. [jkosina@suse.cz: reformat changelog] Signed-off-by: HungNien Chen <hn.chen@weidahitech.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Showing 1 changed file with 14 additions and 4 deletions Side-by-side Diff
drivers/hid/hid-multitouch.c
... | ... | @@ -69,6 +69,7 @@ |
69 | 69 | #define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12) |
70 | 70 | #define MT_QUIRK_FORCE_GET_FEATURE (1 << 13) |
71 | 71 | #define MT_QUIRK_FIX_CONST_CONTACT_ID (1 << 14) |
72 | +#define MT_QUIRK_TOUCH_SIZE_SCALING (1 << 15) | |
72 | 73 | |
73 | 74 | #define MT_INPUTMODE_TOUCHSCREEN 0x02 |
74 | 75 | #define MT_INPUTMODE_TOUCHPAD 0x03 |
... | ... | @@ -222,7 +223,8 @@ |
222 | 223 | */ |
223 | 224 | { .name = MT_CLS_3M, |
224 | 225 | .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | |
225 | - MT_QUIRK_SLOT_IS_CONTACTID, | |
226 | + MT_QUIRK_SLOT_IS_CONTACTID | | |
227 | + MT_QUIRK_TOUCH_SIZE_SCALING, | |
226 | 228 | .sn_move = 2048, |
227 | 229 | .sn_width = 128, |
228 | 230 | .sn_height = 128, |
... | ... | @@ -658,9 +660,17 @@ |
658 | 660 | if (active) { |
659 | 661 | /* this finger is in proximity of the sensor */ |
660 | 662 | int wide = (s->w > s->h); |
661 | - /* divided by two to match visual scale of touch */ | |
662 | - int major = max(s->w, s->h) >> 1; | |
663 | - int minor = min(s->w, s->h) >> 1; | |
663 | + int major = max(s->w, s->h); | |
664 | + int minor = min(s->w, s->h); | |
665 | + | |
666 | + /* | |
667 | + * divided by two to match visual scale of touch | |
668 | + * for devices with this quirk | |
669 | + */ | |
670 | + if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) { | |
671 | + major = major >> 1; | |
672 | + minor = minor >> 1; | |
673 | + } | |
664 | 674 | |
665 | 675 | input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x); |
666 | 676 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y); |