ANDROID: virtio: virtio_input: pass _DIRECT only if the device

advertises _DIRECT

INPUT_MT_DIRECT should be used only if the device advertises
INPUT_PROP_DIRECT.

Bug: 147493341
Bug: 149250379
Test: boot emulator with 5.4 kernel, check if touchscreen works
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Ic06ae2b9d0ab7c77cb8829e5392fd048139500a2
This commit is contained in:
Roman Kiryanov 2020-02-07 17:06:13 -08:00 committed by Alistair Delva
parent 9c18171502
commit 369759bf55

View file

@ -164,12 +164,15 @@ static void virtinput_cfg_abs(struct virtio_input *vi, int abs)
virtio_cread(vi->vdev, struct virtio_input_config, u.abs.flat, &fl);
input_set_abs_params(vi->idev, abs, mi, ma, fu, fl);
input_abs_set_res(vi->idev, abs, re);
if (abs == ABS_MT_TRACKING_ID)
if (abs == ABS_MT_TRACKING_ID) {
unsigned int slot_flags =
test_bit(INPUT_PROP_DIRECT, vi->idev->propbit) ?
INPUT_MT_DIRECT : 0;
input_mt_init_slots(vi->idev,
ma, /* input max finger */
INPUT_MT_DIRECT
| INPUT_MT_DROP_UNUSED
| INPUT_MT_TRACK);
slot_flags);
}
}
static int virtinput_init_vqs(struct virtio_input *vi)