Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: elants_i2c - support palm detection

Elan uses the least significant bit of byte 33 to signal the type of
contact (finger versus palm). The default value is 1 for all firmwares,
which is reported as MT_TOOL_FINGER. If firmware supports palm detection,
the bit will change to 0 and the driver will report such contact as
MT_TOOL_PALM.

Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Link: https://lore.kernel.org/r/1585551756-29066-1-git-send-email-johnny.chuang.emc@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Johnny Chuang and committed by
Dmitry Torokhov
f27ad893 cd510679

+10 -1
+10 -1
drivers/input/touchscreen/elants_i2c.c
··· 19 19 */ 20 20 21 21 22 + #include <linux/bits.h> 22 23 #include <linux/module.h> 23 24 #include <linux/input.h> 24 25 #include <linux/interrupt.h> ··· 74 73 #define FW_POS_STATE 1 75 74 #define FW_POS_TOTAL 2 76 75 #define FW_POS_XY 3 76 + #define FW_POS_TOOL_TYPE 33 77 77 #define FW_POS_CHECKSUM 34 78 78 #define FW_POS_WIDTH 35 79 79 #define FW_POS_PRESSURE 45 ··· 844 842 { 845 843 struct input_dev *input = ts->input; 846 844 unsigned int n_fingers; 845 + unsigned int tool_type; 847 846 u16 finger_state; 848 847 int i; 849 848 ··· 854 851 855 852 dev_dbg(&ts->client->dev, 856 853 "n_fingers: %u, state: %04x\n", n_fingers, finger_state); 854 + 855 + /* Note: all fingers have the same tool type */ 856 + tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ? 857 + MT_TOOL_FINGER : MT_TOOL_PALM; 857 858 858 859 for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) { 859 860 if (finger_state & 1) { ··· 874 867 i, x, y, p, w); 875 868 876 869 input_mt_slot(input, i); 877 - input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 870 + input_mt_report_slot_state(input, tool_type, true); 878 871 input_event(input, EV_ABS, ABS_MT_POSITION_X, x); 879 872 input_event(input, EV_ABS, ABS_MT_POSITION_Y, y); 880 873 input_event(input, EV_ABS, ABS_MT_PRESSURE, p); ··· 1314 1307 input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0); 1315 1308 input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); 1316 1309 input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0); 1310 + input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 1311 + 0, MT_TOOL_PALM, 0, 0); 1317 1312 input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); 1318 1313 input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); 1319 1314 input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1);