Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2628169ybc; Mon, 18 Nov 2019 02:06:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyZcKICz9tEUfHRdwUxslad8n7w97T3L/YjiU11SW3U+jXliIPIG8CrqWgUQ0C3tpQzDg6E X-Received: by 2002:a17:906:394c:: with SMTP id g12mr25179751eje.233.1574071588860; Mon, 18 Nov 2019 02:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574071588; cv=none; d=google.com; s=arc-20160816; b=sNpJb8tbcFgEZBLjRA3St8O2LTEYUooQlZso2LO7s6h/3rH7ZaD+AUj1VuLb4Df8W+ 1HSZ6vveEpsFzgTaN/4waCJaKt6FL2wUv2DVx4uqhQktfx2PlqeE5jtGy77RyiZXljjb 1R80Ki/NVmBMLYwDRIRRUK78IWbrmtVhFwL0uhhgfGt1uc4OOMg0XM8/uyIiV93prEAy AIXj765JgD8Au6zDifOVLDatGNXDHLM3021BTz5XsLIVRB4bVaxZ31KkKRMvPH8031E5 gQHptPS+79oqnK1Mr0RUN6FJcEFs1JGKrBDtebmIsf9R197oaQpOWshTX33kalE6SlZa N7Rw== 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=rIf/Elci/1PK0huoWDjxcN09AY9Hw5H1mVv9fFN249U=; b=Z0TOr2OvtUQKUaXY7aQp4Xd695gHYVV67VllZHtRdLrkU7wWD59UWOrkT9v7irgcPw IBHj4v7TzyShDIf3aAAEKMFKSQpg/W3yBVPiohtH2ob6k0uybIqJJGjEwMW81gUjSdDh vp717TiVmMw2DJEX+7jL25ygP+3Chx35eymb0u4b/bffrM/YutnmlES8qfin9+nowpBF C12yn+6VC2VN+5y4q0iciCmh/NSYP6XoeSmwitSTtoMmbLU3MnYdSnTktbqf59lJZrkJ 7gSf+HfGLjD60RUSMW3RuFXa44HtfBj+f/BKNaXGEGKvy4grA0hakrJFhMuMoDA9aqPr vziw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hgglmAIa; 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 q12si11494587ejn.435.2019.11.18.02.06.03; Mon, 18 Nov 2019 02:06:28 -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=hgglmAIa; 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 S1726735AbfKRKEc (ORCPT + 99 others); Mon, 18 Nov 2019 05:04:32 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:26539 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726490AbfKRKEc (ORCPT ); Mon, 18 Nov 2019 05:04:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574071470; 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=rIf/Elci/1PK0huoWDjxcN09AY9Hw5H1mVv9fFN249U=; b=hgglmAIajjm8UfpsnrwTa1TWld3mwrdd5WiIPjGgpp2ssOe3Z1YKhX+l6CbNAuQBZF6XaZ GR2zPGHh7TStPur8HL9yRKObAbhZKeG9L71o9oIUwyfKHvUx6AAEooLQRP8uS2hUcr9Bgi W8Vt5YxDjRFbLrieqReuGDeMhSd7Z+8= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-B4PIT9ycPLuSshR2BnQHHQ-1; Mon, 18 Nov 2019 05:04:29 -0500 Received: by mail-qt1-f199.google.com with SMTP id j18so11914914qtp.15 for ; Mon, 18 Nov 2019 02:04:29 -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:content-transfer-encoding; bh=rIf/Elci/1PK0huoWDjxcN09AY9Hw5H1mVv9fFN249U=; b=Q4czg8P93z+oZKTyZWwsbkV5kpUa2ZYNt2zuvdirTfb4h42cVeUppGyJ4IC6bvXOvU +tbiTWHkK9eQ+EkvHn824nfFqr/3LvEGjD5HBsqobDwO/lbB8NdkRWSUtdkzlhLXueor Ji9pEAbM9OQst+mhlnRH2qNKrZCsBmQc/sD+kiOcpGPxtAGiVMBhH/cgtOwDfvudYP5I jg9pWi7IybqlDxMAba6OXD2fSEtI4ET/MbddYs1Z8Gs/rfPDv3aPmgAufF8+wYq4gcP1 oX+nj0FDRycKNXhN58H18nGX0kCWQYILkF9eiffWE8onuJBBtyw/MaXE6bciVlnM2vC6 tT3g== X-Gm-Message-State: APjAAAVxyZ8dwG8wqFGPCvnH0RcgFUJnt/S0jFDP5VXsXIkB99jqzM6m ph1IUZO4YgqtegBSiZ6Q4mcIRSS4AvS0NSSe2m7ejDwK166YRSBzKR3FOeIyBSkRJ3m72+SG8r2 KI3UrjQ0pQKgRU2LcKzZjljHL9fU/g6JTtmrq5zar X-Received: by 2002:ac8:1c03:: with SMTP id a3mr26210141qtk.31.1574071465159; Mon, 18 Nov 2019 02:04:25 -0800 (PST) X-Received: by 2002:ac8:1c03:: with SMTP id a3mr26210122qtk.31.1574071464941; Mon, 18 Nov 2019 02:04:24 -0800 (PST) MIME-Version: 1.0 References: <20191106110246.70937-1-blaz@mxxn.io> In-Reply-To: From: Benjamin Tissoires Date: Mon, 18 Nov 2019 11:04:13 +0100 Message-ID: Subject: Re: [PATCH] HID: Improve Windows Precision Touchpad detection. To: =?UTF-8?Q?Bla=C5=BE_Hrastnik?= Cc: Jiri Kosina , "open list:HID CORE LAYER" , lkml X-MC-Unique: B4PIT9ycPLuSshR2BnQHHQ-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 On Thu, Nov 7, 2019 at 10:07 AM Bla=C5=BE Hrastnik wrote: > > I've submitted a test containing the Surface Book 2 descriptor. > > https://gitlab.freedesktop.org/libevdev/hid-tools/merge_requests/59 Thanks. Patch is now queued in branch for-5.5/core. Cheers, Benjamin > > Bla=C5=BE > > On Thu, 7 Nov 2019, at 17:48, Benjamin Tissoires wrote: > > Hi Bla=C5=BE, > > > > On Wed, Nov 6, 2019 at 12:03 PM Bla=C5=BE Hrastnik wrote= : > > > > > > Per Microsoft spec, usage 0xC5 (page 0xFF) returns a blob containing > > > data used to verify the touchpad as a Windows Precision Touchpad. > > > > > > 0x85, REPORTID_PTPHQA, // REPORT_ID (PTPHQA) > > > 0x09, 0xC5, // USAGE (Vendor Usage 0xC5) > > > 0x15, 0x00, // LOGICAL_MINIMUM (0) > > > 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (0xff) > > > 0x75, 0x08, // REPORT_SIZE (8) > > > 0x96, 0x00, 0x01, // REPORT_COUNT (0x100 (256)) > > > 0xb1, 0x02, // FEATURE (Data,Var,Abs) > > > > > > However, some devices, namely Microsoft's Surface line of products > > > instead implement a "segmented device certification report" (usage 0x= C6) > > > which returns the same report, but in smaller chunks. > > > > > > 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined) > > > 0x85, REPORTID_PTPHQA, // REPORT_ID (PTPHQA) > > > 0x09, 0xC6, // USAGE (Vendor usage for segment #= ) > > > 0x25, 0x08, // LOGICAL_MAXIMUM (8) > > > 0x75, 0x08, // REPORT_SIZE (8) > > > 0x95, 0x01, // REPORT_COUNT (1) > > > 0xb1, 0x02, // FEATURE (Data,Var,Abs) > > > 0x09, 0xC7, // USAGE (Vendor Usage) > > > 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (0xff) > > > 0x95, 0x20, // REPORT_COUNT (32) > > > 0xb1, 0x02, // FEATURE (Data,Var,Abs) > > > > > > By expanding Win8 touchpad detection to also look for the segmented > > > report, all Surface touchpads are now properly recognized by > > > hid-multitouch. > > > > > > Signed-off-by: Bla=C5=BE Hrastnik > > > --- > > > > This looks good to me. > > We *could* shorten the ifs and make only one conditional, but I find > > it this way more readable and future proof. > > > > There is just one last step required before we merge this: add a > > regression test so we ensure we do not break it in the future. > > > > It should be merely a matter of sending a MR to > > https://gitlab.freedesktop.org/libevdev/hid-tools. > > It should consist in adding the report descriptor in the same way we > > have > > https://gitlab.freedesktop.org/libevdev/hid-tools/blob/master/tests/tes= t_multitouch.py#L1656-1658. > > Then, make sure an unpatched kernel breaks the multitouch test (sudo > > pytest-3 -k 'multitouch and TestPTP') and that a patched kernel is > > fixed. > > > > Cheers, > > Benjamin > > > > > drivers/hid/hid-core.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c > > > index 63fdbf09b044..2af597cd5d65 100644 > > > --- a/drivers/hid/hid-core.c > > > +++ b/drivers/hid/hid-core.c > > > @@ -742,6 +742,10 @@ static void hid_scan_feature_usage(struct hid_pa= rser *parser, u32 usage) > > > if (usage =3D=3D 0xff0000c5 && parser->global.report_count = =3D=3D 256 && > > > parser->global.report_size =3D=3D 8) > > > parser->scan_flags |=3D HID_SCAN_FLAG_MT_WIN_8; > > > + > > > + if (usage =3D=3D 0xff0000c6 && parser->global.report_count = =3D=3D 1 && > > > + parser->global.report_size =3D=3D 8) > > > + parser->scan_flags |=3D HID_SCAN_FLAG_MT_WIN_8; > > > } > > > > > > static void hid_scan_collection(struct hid_parser *parser, unsigned = type) > > > -- > > > 2.23.0 > > > > > > >