lkml.org 
[lkml]   [2018]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL for 4.15 006/102] HID: multitouch: Only look at non touch fields in first packet of a frame
    Date
    From: Hans de Goede <hdegoede@redhat.com>

    [ Upstream commit 55746d28d66860bccaae20a67b55b9d5db7c14af ]

    Devices in "single finger hybrid mode" will send one report per finger,
    on some devices only the first report of such a multi-packet frame will
    contain a value for BTN_LEFT, in subsequent reports (if multiple fingers
    are down) the value is always 0, causing hid-mt to report BTN_LEFT going
    1 - 0 - 1 - 0 when pressing a clickpad and putting down a second finger.
    This happens for example on USB 0603:0002 mt touchpads.

    This commit fixes this by only reporting non touch fields for the first
    packet of a (possibly) multi-packet frame.

    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    drivers/hid/hid-multitouch.c | 17 +++++++++++++++--
    1 file changed, 15 insertions(+), 2 deletions(-)

    diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
    index 65ea23be9677..397592959238 100644
    --- a/drivers/hid/hid-multitouch.c
    +++ b/drivers/hid/hid-multitouch.c
    @@ -778,9 +778,11 @@ static int mt_touch_event(struct hid_device *hid, struct hid_field *field,
    }

    static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
    - struct hid_usage *usage, __s32 value)
    + struct hid_usage *usage, __s32 value,
    + bool first_packet)
    {
    struct mt_device *td = hid_get_drvdata(hid);
    + __s32 cls = td->mtclass.name;
    __s32 quirks = td->mtclass.quirks;
    struct input_dev *input = field->hidinput->input;

    @@ -837,6 +839,15 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
    break;

    default:
    + /*
    + * For Win8 PTP touchpads we should only look at
    + * non finger/touch events in the first_packet of
    + * a (possible) multi-packet frame.
    + */
    + if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) &&
    + !first_packet)
    + return;
    +
    if (usage->type)
    input_event(input, usage->type, usage->code,
    value);
    @@ -856,6 +867,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
    {
    struct mt_device *td = hid_get_drvdata(hid);
    struct hid_field *field;
    + bool first_packet;
    unsigned count;
    int r, n;

    @@ -874,6 +886,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
    td->num_expected = value;
    }

    + first_packet = td->num_received == 0;
    for (r = 0; r < report->maxfield; r++) {
    field = report->field[r];
    count = field->report_count;
    @@ -883,7 +896,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)

    for (n = 0; n < count; n++)
    mt_process_mt_event(hid, field, &field->usage[n],
    - field->value[n]);
    + field->value[n], first_packet);
    }

    if (td->num_received >= td->num_expected)
    --
    2.14.1
    \
     
     \ /
      Last update: 2018-03-04 01:51    [W:2.533 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site