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

Input: introduce input_mt_report_slot_inactive()

input_mt_report_slot_state() ignores "tool" argument when the slot is
closed, which has caused a bit of confusion. Let's introduce
input_mt_report_slot_inactive() to report inactive slot state.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Link: https://lore.kernel.org/r/20200508055656.96389-2-jiada_wang@mentor.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jiada Wang and committed by
Dmitry Torokhov
5fc70e35 c9c45702

+21 -21
+1 -2
drivers/hid/hid-alps.c
··· 387 387 input_report_abs(hdata->input, 388 388 ABS_MT_PRESSURE, z); 389 389 } else { 390 - input_mt_report_slot_state(hdata->input, 391 - MT_TOOL_FINGER, 0); 390 + input_mt_report_slot_inactive(hdata->input); 392 391 } 393 392 } 394 393
+2 -4
drivers/hid/hid-multitouch.c
··· 896 896 clear_bit(slotnum, app->pending_palm_slots); 897 897 898 898 input_mt_slot(input, slotnum); 899 - input_mt_report_slot_state(input, MT_TOOL_PALM, false); 899 + input_mt_report_slot_inactive(input); 900 900 901 901 need_sync = true; 902 902 } ··· 1640 1640 if (mt) { 1641 1641 for (i = 0; i < mt->num_slots; i++) { 1642 1642 input_mt_slot(input_dev, i); 1643 - input_mt_report_slot_state(input_dev, 1644 - MT_TOOL_FINGER, 1645 - false); 1643 + input_mt_report_slot_inactive(input_dev); 1646 1644 } 1647 1645 input_mt_sync_frame(input_dev); 1648 1646 input_sync(input_dev);
+1 -1
drivers/input/misc/xen-kbdfront.c
··· 146 146 break; 147 147 148 148 case XENKBD_MT_EV_UP: 149 - input_mt_report_slot_state(info->mtouch, MT_TOOL_FINGER, false); 149 + input_mt_report_slot_inactive(info->mtouch); 150 150 break; 151 151 152 152 case XENKBD_MT_EV_SYN:
+1 -1
drivers/input/mouse/elan_i2c_core.c
··· 938 938 input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); 939 939 } else { 940 940 input_mt_slot(input, contact_num); 941 - input_mt_report_slot_state(input, MT_TOOL_FINGER, false); 941 + input_mt_report_slot_inactive(input); 942 942 } 943 943 } 944 944
+3 -4
drivers/input/touchscreen/atmel_mxt_ts.c
··· 822 822 * have happened. 823 823 */ 824 824 if (status & MXT_T9_RELEASE) { 825 - input_mt_report_slot_state(input_dev, 826 - MT_TOOL_FINGER, 0); 825 + input_mt_report_slot_inactive(input_dev); 827 826 mxt_input_sync(data); 828 827 } 829 828 ··· 838 839 input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); 839 840 } else { 840 841 /* Touch no longer active, close out slot */ 841 - input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0); 842 + input_mt_report_slot_inactive(input_dev); 842 843 } 843 844 844 845 data->update_input = true; ··· 946 947 dev_dbg(dev, "[%u] release\n", id); 947 948 948 949 /* close out slot */ 949 - input_mt_report_slot_state(input_dev, 0, 0); 950 + input_mt_report_slot_inactive(input_dev); 950 951 } 951 952 952 953 data->update_input = true;
+2 -3
drivers/input/touchscreen/cyttsp4_core.c
··· 744 744 745 745 for (t = 0; t < max_slots; t++) { 746 746 input_mt_slot(md->input, t); 747 - input_mt_report_slot_state(md->input, 748 - MT_TOOL_FINGER, false); 747 + input_mt_report_slot_inactive(md->input); 749 748 } 750 749 } 751 750 ··· 844 845 if (ids[t]) 845 846 continue; 846 847 input_mt_slot(input, t); 847 - input_mt_report_slot_state(input, MT_TOOL_FINGER, false); 848 + input_mt_report_slot_inactive(input); 848 849 } 849 850 850 851 input_sync(input);
+1 -1
drivers/input/touchscreen/cyttsp_core.c
··· 340 340 continue; 341 341 342 342 input_mt_slot(input, i); 343 - input_mt_report_slot_state(input, MT_TOOL_FINGER, false); 343 + input_mt_report_slot_inactive(input); 344 344 } 345 345 346 346 input_sync(input);
+2 -2
drivers/input/touchscreen/melfas_mip4.c
··· 391 391 /* Screen */ 392 392 for (i = 0; i < MIP4_MAX_FINGERS; i++) { 393 393 input_mt_slot(ts->input, i); 394 - input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, 0); 394 + input_mt_report_slot_inactive(ts->input); 395 395 } 396 396 397 397 /* Keys */ ··· 534 534 } else { 535 535 /* Release event */ 536 536 input_mt_slot(ts->input, id); 537 - input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, 0); 537 + input_mt_report_slot_inactive(ts->input); 538 538 } 539 539 540 540 input_mt_sync_frame(ts->input);
+1 -1
drivers/input/touchscreen/mms114.c
··· 559 559 /* Release all touch */ 560 560 for (id = 0; id < MMS114_MAX_TOUCH; id++) { 561 561 input_mt_slot(input_dev, id); 562 - input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, false); 562 + input_mt_report_slot_inactive(input_dev); 563 563 } 564 564 565 565 input_mt_report_pointer_emulation(input_dev, true);
+1 -1
drivers/input/touchscreen/raspberrypi-ts.c
··· 100 100 released_ids = ts->known_ids & ~modified_ids; 101 101 for_each_set_bit(i, &released_ids, RPI_TS_MAX_SUPPORTED_POINTS) { 102 102 input_mt_slot(input, i); 103 - input_mt_report_slot_state(input, MT_TOOL_FINGER, 0); 103 + input_mt_report_slot_inactive(input); 104 104 modified_ids &= ~(BIT(i)); 105 105 } 106 106 ts->known_ids = modified_ids;
+1 -1
drivers/input/touchscreen/stmfts.c
··· 198 198 u8 slot_id = (event[0] & STMFTS_MASK_TOUCH_ID) >> 4; 199 199 200 200 input_mt_slot(sdata->input, slot_id); 201 - input_mt_report_slot_state(sdata->input, MT_TOOL_FINGER, false); 201 + input_mt_report_slot_inactive(sdata->input); 202 202 203 203 input_sync(sdata->input); 204 204 }
+5
include/linux/input/mt.h
··· 100 100 bool input_mt_report_slot_state(struct input_dev *dev, 101 101 unsigned int tool_type, bool active); 102 102 103 + static inline void input_mt_report_slot_inactive(struct input_dev *dev) 104 + { 105 + input_mt_report_slot_state(dev, 0, false); 106 + } 107 + 103 108 void input_mt_report_finger_count(struct input_dev *dev, int count); 104 109 void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); 105 110 void input_mt_drop_unused(struct input_dev *dev);