Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1623161ybc; Wed, 13 Nov 2019 01:35:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzYRtVWfqJN7QbTrHtZ0Wnc5OpIjHByfhOKxYc4qTMlEOmHA1aSo20/32pXNllKjCu9pNQ0 X-Received: by 2002:aa7:d295:: with SMTP id w21mr2413388edq.13.1573637717858; Wed, 13 Nov 2019 01:35:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573637717; cv=none; d=google.com; s=arc-20160816; b=cYm0FIvWMSknbE6Er8r8tX0ffxkkGcj1GToqfk02J0Qm0XhuE5KCiEQrp4xqftAruS d6OFNdq86KJFF6iX2b3TGUxuinpK79oTpukeo3FZqgKeQg1V0DjipxFeXEjgEQ+T4VeF i39u2LjFakqsxznZaF3dPwzJgrmNTfRGHHp/Z4HgGTzPc1z956s7MdeTKbnhe7J1VWGL SR3Oh4wEynO2ROZYRSDpXLcRxQAnVgxN2AuNQZbA+R8KRKsdL8BDAS7IuNPlk4wuQ9HP wiuqyCP0AaojBbIcbKJYK96hZwFRtM8MiKGsMmtlSPyBkQyhJcoFekTyz1KBEGULG9bZ o91A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KfiIJYnhwIPb8ies+GY26eVHRvipn+z/HevJMP92/8A=; b=qZ5C/Pa62SlqLRJnFMENaQhpd8IAIMN9e1N038Bd1nXqzRLNKFQ1uRSKVJ2aynbXw9 zcGf8M5fh8EONaJfUGkkasXsM/qs/RCB2fjDokW5rpQbqGeR/BlifNbhI6I9ZnG3LuVe cwx8v9nHdmDT+MSAOB1K/6MeKNLvFbyumoHxkJTOGOwvfLOf5U6xJ/q2HSpNaiKnr8H/ Hr9Q3FPUW48Px723gc7BJs1f3a9/tlGJ2YMKU4EYfC7PtSyZ9h8l2uAPKCs6oOxT2Fv8 2+mFa61tDR/K5zEDrFA8Xagd5KvYKoVW3qh9oHELhjVtwXOJx/93JD5oksBns/IgPN5S 2sBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XKiI/Jub"; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si1016339edl.90.2019.11.13.01.34.53; Wed, 13 Nov 2019 01:35:17 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b="XKiI/Jub"; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727435AbfKMJaz (ORCPT + 99 others); Wed, 13 Nov 2019 04:30:55 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:23970 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726598AbfKMJay (ORCPT ); Wed, 13 Nov 2019 04:30:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573637453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KfiIJYnhwIPb8ies+GY26eVHRvipn+z/HevJMP92/8A=; b=XKiI/JubTH57aGQE9bXdRegVHcbKTV3OgcfykwYnPHoF6zIWlqntw/16GUEEtjzCLh+2wj 5vFed1NHzrileFTAiqXsy/V/foxN/gCETx7qBbJ1LVC23pF2iVCXA7LWJ4BcaGW+5JutYD g84/lnJI/EbkbFSo7bj+1HWMSgvuTJA= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-nj06QX41N1SouMLNaKG29A-1; Wed, 13 Nov 2019 04:30:52 -0500 Received: by mail-qt1-f198.google.com with SMTP id x21so938978qtp.1 for ; Wed, 13 Nov 2019 01:30:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Hz47sGg839T2K5KCo2tSAJMtBP36J6bni/N4ATh4qyY=; b=DfzhbfIb9Z0oBV/2fi5uEQ9MxyPniYS0trgUAfhbYjgoyrERL/1NT2on9s4xAfjPZ/ NruE35EsErg1OXR/pFKvD+JfU0/ZuOO/I68N9EpeYt6fTczW97spVB28VP4qdcMIQsUf 8m8g2T/8q5WPjnBHvwRgYyxctg9eBDXw7/+zT5zgFkRR3KamDPqz6sHalNMUZQtOA+9D HbBWUSNBoh1zFfSIjp1nJAuGxlV42fi9aZMBhFqO3K8P66mrE6K7ACPpXgtBumLrkmTo 0CJSioOUNqUJnNZuc+7Uv246KAgp476/w/H3nGkXJcdzrn1xu7JbW/XcR91VtfYCZQAZ jrLQ== X-Gm-Message-State: APjAAAVx7s6TdBSwutwyLzoLt6MkDTbpHl17WGQdNpAf7hT3mpPTS7q/ VT/BvPhgbsYJXdb1rC6HzpkivOIjTfnSsMKuiVSeAd4DTVQqkwmz2zW1AdQHzOsr+n/lrV1rjJQ zYVT5j4XeMohXZSY602P2+XaHLpfWKfwD+q8evLX6 X-Received: by 2002:ac8:1c03:: with SMTP id a3mr1631534qtk.31.1573637451861; Wed, 13 Nov 2019 01:30:51 -0800 (PST) X-Received: by 2002:ac8:1c03:: with SMTP id a3mr1631512qtk.31.1573637451614; Wed, 13 Nov 2019 01:30:51 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Benjamin Tissoires Date: Wed, 13 Nov 2019 10:30:39 +0100 Message-ID: Subject: Re: Query regarding hid-multitouch.c driver in 4.14/4.19 To: Neeraj Upadhyay Cc: Jiri Kosina , Henrik Rydberg , "open list:HID CORE LAYER" , lkml , linux-arm-msm-owner@vger.kernel.org, prsood@codeaurora.org, gkohli@codeaurora.org X-MC-Unique: nj06QX41N1SouMLNaKG29A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Neeraj, On Wed, Nov 13, 2019 at 4:11 AM Neeraj Upadhyay wr= ote: > > Hi, > > I have one query regarding hid-multitouch.c driver and need your guidance= on > how hid-multitouchc can restore/support the original behaviour, where, fo= r > devices, for which application is not > HID_DG_TOUCHSCREEN/HID_DG_TOUCHPAD, and has > HID_DG_CONTACTID usage in its report, can still use generic input mapping= s. > > We are using kernel versions 4.14 , 4.19 respectively in 2 different > projects: > > 4.14: > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/dri= vers/hid/hid-multitouch.c?h=3Dv4.14.153 > 4.19: > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/dri= vers/hid/hid-multitouch.c?h=3Dv4.19.83 > > I checked the application for our hid device, it's HID_DG_PEN, device > also has a HID_DG_CONTACTID usage defined in > > its report. > > In 4.19, is_mt_collection is set to 'true'. All multitouch code paths or > input mapping is configured > > mt_allocate_report_data() > ... > for (n =3D 0; n < field->report_count; n++) { > if (field->usage[n].hid =3D=3D HID_DG_CONTACTID) > rdata->is_mt_collection =3D true; // > is_mt_collection is set to 'true' > } > } > > mt_input_mapping() > ... > if (rdata->is_mt_collection) > return mt_touch_input_mapping(...) // > mt_touch_input_mapping() is called > > mt_event() > if (rdata && rdata->is_mt_collection) > return mt_touch_event(); // mt_touch_event() is called > > However, in 4.14, the behaviour was different, mt input mapping was done > only > for HID_DG_TOUCHSCREEN/HID_DG_TOUCHPAD , and because our hid device is > HID_DG_PEN, generic mappings were applied for it; with these settings, > device > responds to events. > > static int mt_input_mapping() > if (field->application =3D=3D HID_DG_TOUCHSCREEN || > field->application =3D=3D HID_DG_TOUCHPAD) > return mt_touch_input_mapping(); // This is not called. > > > mt_touch_input_mapping() > case HID_DG_CONTACTID: > mt_store_field(usage, td, hi); > td->touches_by_report++; > td->mt_report_id =3D field->report->id; // > mt_report_id is not set. > return 1; > > > Looks like this behaviour changed, with below commits: > > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/d= rivers/hid/hid-multitouch.c?h=3Dv4.19.83&id=3D8dfe14b3b47ff832cb638731f9fc6= 96a3a84f804 > 8dfe14b3b47f HID: multitouch: ditch mt_report_id > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/d= rivers/hid/hid-multitouch.c?h=3Dv4.19.83&id=3Dba6b055e0f3b4ff4942e4ab273260= affcfad9bff > ba6b055e0f3b HID: input: enable Totem on the Dell Canvas 27 > > Can you please suggest on how we can support/preserve the original > behaviour? Hmm, I would initially say that a firmware that exports Contact ID for a Pen is definitely wrong. The Contact ID usage has been introduced in https://www.usb.org/sites/default/files/hutrr34.pdf and is specifically for multi-touch, not multi pen. Anyway, couple of questions: - does the device supports multi-pen? - can you share the report descriptor and a few events when triggering this particular report (ideally with hid-recorder from https://gitlab.freedesktop.org/libevdev/hid-tools/ Cheers, Benjamin > > > Thanks > Neeraj > > -- > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member= of the Code Aurora Forum, hosted by The Linux Foundation >