Skip to content

Commit 2ef0645

Browse files
chejianjwenlingz
authored andcommitted
dm: virtio-input: ignore all MSC events from FE
EV_MSC is configured as INPUT_PASS_TO_ALL in input driver. There is a loop in the use case of virtio-input. They should not be forwarded back to BE since they have already been sent to native driver before sending to FE. Tracked-On: #2006 Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent 19fb5fa commit 2ef0645

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

devicemodel/hw/pci/virtio/virtio_input.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,23 +214,19 @@ virtio_input_ignore_event(struct virtio_input_event *event)
214214
if (!event)
215215
return true;
216216

217-
/* kernel commit 29cc309d8bf19a36c5196bf626662319af6e3c0b
218-
* (HID: hid-multitouch: forward MSC_TIMESTAMP)
219-
* since kernel 4.15
220-
* (EV_MSC, MSC_TIMESTAMP) is added to each frame just before
221-
* the SYN event. EV_MSC is configured as INPUT_PASS_TO_ALL.
222-
* In the use case of virtio-input, there is a loop as follows:
223-
* - A mt frame with (EV_MSC, MSC_TIMESTAMP) is passed to FE.
224-
* - FE will call virtinput_status to pass (EV_MSC, MSC_TIMESTAMP)
225-
* back to BE.
226-
* - BE writes this event to evdev. Because (EV_MSC, MSC_TIMESTAMP)
217+
/*
218+
* EV_MSC is configured as INPUT_PASS_TO_ALL. In the use case of
219+
* virtio-input, there is a loop as follows:
220+
* - A mt frame with (EV_MSC,*,*) is passed to FE.
221+
* - FE will call virtinput_status to pass (EV_MSC,*,*) back to BE.
222+
* - BE writes this event to evdev. Because (EV_MSC,*,*)
227223
* is configured as INPUT_PASS_TO_ALL, it will be written into
228224
* the event buffer of evdev then be read out by BE without
229225
* SYN followed.
230-
* - Each mt frame will introduce one (EV_MSC, MSC_TIMESTAMP).
226+
* - Each mt frame will introduce one (EV_MSC,*,*).
231227
* Later the frame becomes larger and larger...
232228
*/
233-
if ((event->type == EV_MSC) && (event->code == MSC_TIMESTAMP))
229+
if (event->type == EV_MSC)
234230
return true;
235231
return false;
236232
}

0 commit comments

Comments
 (0)