Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3910403imm; Tue, 29 May 2018 16:47:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPBi6+QvovlvccoHlkuAxdHROzIcbDzv/9aG1F/FXKCah6S8kgL+wBOvq9JFR2NNMrSvt3 X-Received: by 2002:a63:6107:: with SMTP id v7-v6mr376449pgb.264.1527637623530; Tue, 29 May 2018 16:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527637623; cv=none; d=google.com; s=arc-20160816; b=RQSyt8UghDFeCE7T7jozN9QmF/RoW0+rzAULjr+VrLyEMcOiO1nS5uBgmhCoJki0g3 uC3198j7R2UWKpWtA5UDjSM+7xvww9COqif6A3iWpYSgmJv7ZaFFXWwVhFGHMDR+ESKp zY5ofNQRQcQxT9jv/zeyISfPybTiCspnV6GrK9NnZjfHv1XiSeowGjCt4w2Kph5Fe4bB bUVayhq1xLmA2uGkit4Ll4XE6wAljRh4lJ+xDQvnTyObOxFyOYSTRhESM75q7fcR2X/2 QshLg+rgxm1PasCGjHSrXtyfiUU5Qnd5yes2j1Upz5/xDSo7KL+6uqsHCiOKtVKYIcmS 2E6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=UqZ+o9KD2Cn4Z4MVWf9ZuyXeISOYd0qEkBDAFGvTArU=; b=la3eY+sQs0u1JtQ8Rq0J7J0VZlGJGsN+PNdJm49cA4mB3nlrpbYlFc9B1gk8NnkqMf OJelPgZPZIATYKjTrZANHpi28XOyCaReVhTAadZJ2pSu+0px2IIYZ0cUgjxbToDv8Rg1 X/UU0nAtxeXhkoljj0KFdf1nM3yLtI1zYIU3du7X1m2CPvue+1fGWGyasSI7zbx4gogg NUtVvtvZArRZvRlHaBbk4zB1m/YNe7Mz1hCYn1xsWNNg21m6kCrhk9eeK0Ljq07RiibC OqNhl/YA+7hAiyVrDReUgRWW1Vxr/DF4OS3OkYSsR0oOIEIDOM6eN3RHAIgHVXe+cBnO wuNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XuxSS+XR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8-v6si23832180plk.221.2018.05.29.16.46.48; Tue, 29 May 2018 16:47:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XuxSS+XR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755411AbeE2Xpm (ORCPT + 99 others); Tue, 29 May 2018 19:45:42 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:44298 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755284AbeE2Xpi (ORCPT ); Tue, 29 May 2018 19:45:38 -0400 Received: by mail-pg0-f67.google.com with SMTP id p21-v6so7268253pgd.11; Tue, 29 May 2018 16:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UqZ+o9KD2Cn4Z4MVWf9ZuyXeISOYd0qEkBDAFGvTArU=; b=XuxSS+XR/Zdvq9RZkdCPXy8XLP1jFL75CZYkHTkZbXBVNcRm+imWIbSY31v5gZIQ7n 4PLOozmO6ealCGFqZGcpFOt2d73OkW8NQKIBnJJhDMh4QP6Du8jSgvty5bda4Of6baDV v3frxA8Tyuiketkh0PbGM7NyQiwwH9ZQydOK11I3VLmOU78DA06nHAC5yCB+x1Uj1g0X K7DDGBt3mGLl1xmIEMOHrjKcBgUq3/DY5wolID4sn9OAHoJksPHwalPLmupprpiC7//B AOKUQwbi+73HwV0GSryvf+bNTUPnKJyr/wphBa24D6ZmnKwh94av5o8/Z7T7uGyAFJSx 0JrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UqZ+o9KD2Cn4Z4MVWf9ZuyXeISOYd0qEkBDAFGvTArU=; b=WzzG6lLa6YF9KslVzsPdmeQr1l3hKICvtdsBdpdg0mIc1r/5Kw7JSgUwEAp7RXFEVe U0hXMGgeeiO4vick6VM3VgwSyjR7QTNMjSEi0KftIV9OZoevP+0N9NaWmbNwqluwW3mC NkAXSYygkvxnMzFC/YUgcWAllOT7N/xAMgYpXecwzO5p3NNIHI6sx2VB1fNgNt24HTIn HwY2g99nohBIDl3LjovFzw2kETV7eERChFQhdP3pklJYtry+qIcJPWyxerqQD4OaUxRS fZRDD+3C0QzzIs94/+ppOXlFoEiAzx0emo0c0oHNkIIgbnhmv+8ssGChsTJCzz/n94Bl kMdA== X-Gm-Message-State: ALKqPwdD2CgVwGOHnRH7ipV9kcf5mtQb7tkp9+5B9kIaGadn3cF3A6IH xnxfjm76zbsykKrXeHo+Zgw= X-Received: by 2002:a63:4004:: with SMTP id n4-v6mr368347pga.248.1527637537662; Tue, 29 May 2018 16:45:37 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id o88-v6sm91196132pfa.29.2018.05.29.16.45.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 16:45:36 -0700 (PDT) Date: Tue, 29 May 2018 16:45:34 -0700 From: Dmitry Torokhov To: Ben Chan Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , dtor@chromium.org, drinkcat@chromium.org Subject: Re: [PATCH] HID: multitouch: fix calculation of last slot field in multi-touch reports Message-ID: <20180529234534.GG167092@dtor-ws> References: <20180529225655.214380-1-benchan@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180529225655.214380-1-benchan@chromium.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 03:56:55PM -0700, Ben Chan wrote: > According to [1] and also seemingly agreed by [2], the Scan Time usage > (0x0D 0x56) is a report level usage, not a contact level usage. > > However, the hid-multitouch driver currently includes HID_DG_SCANTIME > when calculating `td->last_slot_field', which may lead to > mt_complete_slot() being prematurely called in certain cases (e.g. when > each touch input report includes more than one contact and the Scan Time > usage appears before any contact logical collection). > > This patch fixes the issue by skipping mt_store_field() on > HID_DG_SCANTIME, similar to how HID_DG_CONTACTCOUNT and > HID_DG_CONTACTMAX are handled. > > [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections#windows-precision-touchpad-input-reports > [2] https://patchwork.kernel.org/patch/1742181/ > > Fixes: 29cc309d8bf19 ("HID: hid-multitouch: forward MSC_TIMESTAMP") > Signed-off-by: Ben Chan This looks reasonable to me. Reviewed-by: Dmitry Torokhov > --- > drivers/hid/hid-multitouch.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c > index dad2fbb0e3f8..161551aab496 100644 > --- a/drivers/hid/hid-multitouch.c > +++ b/drivers/hid/hid-multitouch.c > @@ -620,13 +620,16 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, > hid_map_usage(hi, usage, bit, max, > EV_MSC, MSC_TIMESTAMP); > input_set_capability(hi->input, EV_MSC, MSC_TIMESTAMP); > - mt_store_field(usage, td, hi); > /* Ignore if indexes are out of bounds. */ > if (field->index >= field->report->maxfield || > usage->usage_index >= field->report_count) > return 1; > td->scantime_index = field->index; > td->scantime_val_index = usage->usage_index; > + /* > + * We don't set td->last_slot_field as scan time is > + * global to the report. > + */ > return 1; > case HID_DG_CONTACTCOUNT: > /* Ignore if indexes are out of bounds. */ > -- > 2.17.0.921.gf22659ad46-goog > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Dmitry