From nobody Wed Feb 21 20:32:38 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Tg7Hq30S2z5BJNS; Wed, 21 Feb 2024 20:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tg7Hq0sKlz4D8c; Wed, 21 Feb 2024 20:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708547559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WX1mhbDQ9llb0yJr8EpWCu+a//pFshMj6plJx7bLeOY=; b=hL088DxTovsNI2Uqckxp2nzbZEDhxorXpOXKuiMZklSxzQHPF3a64/NXcZ+IOHDfIxxgme eNgJZOMwxhwiFV6Sx3CoYGsgVlSpic1va8SfVaF6JBrgakjs5T2lmna1LAEd1K6BDw0+q7 Lo7E49ARqxktMRyrPj1sVOJDDyMuacWrlInS26qOTF5imCQbEFMRVQ+Gvqo25e+gVxdw89 C1nS1X60iUrmDznQna8Nbt7QHS9CLCsr0cA2ZB/UVqId6njfVksqsFn9ZObbqNTfqEyIQR 1SBCt+TTW748uDzZbA9DOM95bf8r5i4R7Q1S3AseJWkcgL9OBuy6n/0vDIO8Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708547559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WX1mhbDQ9llb0yJr8EpWCu+a//pFshMj6plJx7bLeOY=; b=PI2k8+rkn/AZb+ohGAkgPhnUKXGci9E7tF8zzdP8s/ShMpdVB9QGy4Y5hyDIgi1ZcnZNtT x+a98s8hEaNYZC7wiG9tIvCyR6GEjUQuNFv7i3jZVNBmv2waV10AIMmdVT1KOh932NG9ZO TFRuFLrDvzpINBEwfTu2Z6+3Jzm9MEjSVrzTIojP+QWb14SoZI8WYtaRix3jmn1hLN9lRF cxUX2bOb31r+5V+ATasE68WnXBf/y5IyG5TShzGEAPuOgaC+xPCD1z1oVan1FePY8j6h+2 5pidJneW5C/AblRw6wADiVMvecDe4w3sZ1ynPybmVpSE2Hyya7M7gTXhwf0zxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708547559; a=rsa-sha256; cv=none; b=dLqvl2zbWRz4Or1MDWLAxmC/YhJrvYVrdaB/mGjQepgWjXzGsbF0Husv9KNEfJ+xuG3vfh hjjCMaVT+4pIkKYmeqsWyCv2PbPalhUSFg9u09pKdrOLwni/Ct4+7CQ+Ad0el/tKKoFbHQ TCMaI5wQq/U+SY8Ny6SXT0CvpxFA730q0KxhzQ8ONnH42GYLE0SqJM6F9N6DEI0Ldh11q4 jXZBx07YP9ok0PIkzpkT4SJfJS5XvjONpBavyV6fkzM7RmM52xT74DlOUWOjSdEmAit7W+ T0RY437pmKI2sZSIoER/raMYmpUOsX+KcqL+y9XzpRSvQg3/tPjsGaYIpnqS1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Tg7Hp6jFWz1HPD; Wed, 21 Feb 2024 20:32:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41LKWcax002358; Wed, 21 Feb 2024 20:32:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41LKWc4H002355; Wed, 21 Feb 2024 20:32:38 GMT (envelope-from git) Date: Wed, 21 Feb 2024 20:32:38 GMT Message-Id: <202402212032.41LKWc4H002355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 9097284b98be - main - bcm5974(4): Properly assign MT-slot on Apple Magic Trackpad List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9097284b98be57e2e2bf12942844fa3c920dd1a7 Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9097284b98be57e2e2bf12942844fa3c920dd1a7 commit 9097284b98be57e2e2bf12942844fa3c920dd1a7 Author: Vladimir Kondratyev AuthorDate: 2024-02-21 20:31:39 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-02-21 20:31:39 +0000 bcm5974(4): Properly assign MT-slot on Apple Magic Trackpad Assign multi-touch slot number based on internal evdev MT state and reported tracking ID of contact rather than on sequentional number of contact in report. Sponsored by: Serenity Cyber Security Fixes: ef8397c28e98 ("add Magic Trackpad 2 (USB only) support") MFC after: 1 month --- sys/dev/hid/bcm5974.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/hid/bcm5974.c b/sys/dev/hid/bcm5974.c index e76e3dfa805c..442e8905e9bc 100644 --- a/sys/dev/hid/bcm5974.c +++ b/sys/dev/hid/bcm5974.c @@ -820,6 +820,7 @@ bcm5974_intr(void *context, void *data, hid_size_t len) int ibt; /* button status */ int i; int slot; + uint8_t id; uint8_t fsize = sizeof(struct tp_finger) + params->tp->delta; if ((params->tp->caps & USES_COMPACT_REPORT) != 0) @@ -840,18 +841,20 @@ bcm5974_intr(void *context, void *data, hid_size_t len) fc = (struct tp_finger_compact *)(((uint8_t *)data) + params->tp->offset + params->tp->delta + i * fsize); coords = (int)le32toh(fc->coords); + id = fc->id_ori & 0x0f; + slot = evdev_mt_id_to_slot(sc->sc_evdev, id); DPRINTFN(BCM5974_LLEVEL_INFO, "[%d]ibt=%d, taps=%d, x=%5d, y=%5d, state=%4d, " "tchmaj=%4d, tchmin=%4d, size=%4d, pressure=%4d, " - "ot=%4x, id=%4x\n", + "ot=%4x, id=%4x, slot=%d\n", i, ibt, ntouch, coords << 19 >> 19, coords << 6 >> 19, (u_int)coords >> 30, fc->touch_major, fc->touch_minor, fc->size, - fc->pressure, fc->id_ori >> 5, fc->id_ori & 0x0f); - if (fc->touch_major == 0) + fc->pressure, fc->id_ori >> 5, id, slot); + if (fc->touch_major == 0 || slot == -1) continue; slot_data = (union evdev_mt_slot) { - .id = fc->id_ori & 0x0f, + .id = id, .x = coords << 19 >> 19, .y = params->y.min + params->y.max - ((coords << 6) >> 19), @@ -861,7 +864,6 @@ bcm5974_intr(void *context, void *data, hid_size_t len) .ori = (int)(fc->id_ori >> 5) - 4, }; evdev_mt_push_slot(sc->sc_evdev, slot, &slot_data); - slot++; continue; } f = (struct tp_finger *)(((uint8_t *)data) +