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.
Unified · Split
| @@ -387,8 +387,7 @@ static int u1_raw_event(struct alps_dev *hdata, u8 *data, int size) · 386 unmodified lines | ||
| 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 | |
| @@ -896,7 +896,7 @@ static void mt_release_pending_palms(struct mt_device *td, · 895 unmodified lines | ||
| 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,9 +1640,7 @@ static void mt_release_contacts(struct hid_device *hid) · 737 unmodified lines | ||
| 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); |
| @@ -146,7 +146,7 @@ static void xenkbd_handle_mt_event(struct xenkbd_info *info, · 145 unmodified lines | ||
| 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: |
| @@ -938,7 +938,7 @@ static void elan_report_contact(struct elan_tp_data *data, · 937 unmodified lines | ||
| 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 | |
| @@ -822,8 +822,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) · 821 unmodified lines | ||
| 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 | |
| @@ -839,7 +838,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) · 9 unmodified lines | ||
| 839 | 838 | input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); |
| 840 | 839 | } else { |
| 841 | 840 | /* Touch no longer active, close out slot */ |
| 842 | − input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0); | |
| 841 | + input_mt_report_slot_inactive(input_dev); | |
| 843 | 842 | } |
| 844 | 843 | |
| 845 | 844 | data->update_input = true; |
| @@ -947,7 +946,7 @@ static void mxt_proc_t100_message(struct mxt_data *data, u8 *message) · 101 unmodified lines | ||
| 947 | 946 | dev_dbg(dev, "[%u] release\n", id); |
| 948 | 947 | |
| 949 | 948 | /* close out slot */ |
| 950 | − input_mt_report_slot_state(input_dev, 0, 0); | |
| 949 | + input_mt_report_slot_inactive(input_dev); | |
| 951 | 950 | } |
| 952 | 951 | |
| 953 | 952 | data->update_input = true; |
| @@ -744,8 +744,7 @@ static void cyttsp4_report_slot_liftoff(struct cyttsp4_mt_data *md, · 743 unmodified lines | ||
| 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 | |
| @@ -845,7 +844,7 @@ static void cyttsp4_final_sync(struct input_dev *input, int max_slots, int *ids) · 93 unmodified lines | ||
| 845 | 844 | if (ids[t]) |
| 846 | 845 | continue; |
| 847 | 846 | input_mt_slot(input, t); |
| 848 | − input_mt_report_slot_state(input, MT_TOOL_FINGER, false); | |
| 847 | + input_mt_report_slot_inactive(input); | |
| 849 | 848 | } |
| 850 | 849 | |
| 851 | 850 | input_sync(input); |
| @@ -340,7 +340,7 @@ static void cyttsp_report_tchdata(struct cyttsp *ts) · 339 unmodified lines | ||
| 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); |
| @@ -391,7 +391,7 @@ static void mip4_clear_input(struct mip4_ts *ts) · 390 unmodified lines | ||
| 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,7 +534,7 @@ static void mip4_report_touch(struct mip4_ts *ts, u8 *packet) · 136 unmodified lines | ||
| 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); |
| @@ -559,7 +559,7 @@ static int __maybe_unused mms114_suspend(struct device *dev) · 558 unmodified lines | ||
| 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); |
| @@ -100,7 +100,7 @@ static void rpi_ts_poll(struct input_dev *input) · 99 unmodified lines | ||
| 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; |
| @@ -198,7 +198,7 @@ static void stmfts_report_contact_release(struct stmfts_data *sdata, · 197 unmodified lines | ||
| 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 | } |
| @@ -100,6 +100,11 @@ static inline bool input_is_mt_axis(int axis) · 99 unmodified lines | ||
| 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); |