From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796238487; b=hP7pV8LJP1QE3v80ErUKHJJKkL9wCPaQf2Nd0sI1HSZIvG9yg97eF8U79v6e+D3CvMqI eQ64KGbFRwGdShY4HgNz93ydxcXIc1MAOYd3zbdJ3n1Idg5xzprty7s1fDyzeaKrsluOU a27VPf+jD50nvKazHXZyUYTbAOE/Zc1UktUpFg8w718Vee1g9MJH0RRwNuTyQlZWch7Pk QChrjE+bDrsbBcDvjRocrVj4vzKZu62Ci9s2hDaxw+uXtDzVa30ATsdtv73mXaZGhYC2t mhRK9GDV9XqjK9FpLifJCJxG/ZuITLyTy22Sa0ixPtFcbbUYcdDoJ3Gb57Wbhocapcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796238487; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=x5uKxFRDok/VLN6JK6a/naba4aElu58RWTSsomv12EE=; b=Z2kBqFhblkaTFFZII4pdxvJXVUG5VZdh+LvogPBOOk29jEeloYy/Ux04jManJd8MJbIt xAcZiQa5Ysm1Qd/NShj52gCudaW+ABzBlJW7G7DqA10atq6vGRrPgkfgbEVbF2N7L/vOG Ktfji9FbszavsSDpRXlrvboZPm3CV2eqf23iDB5cuLYAokt0d6cet7Hw8Nialxrmj6deQ F6hJYMwgtdWOXfY/0C10rTdli3ClckJ7K4J4xtI8mEFNq980j4Hr4PlMC52qkr1tNWhM1 a8A4Lv6zNh5H3EHDuCHywoipLc46UqeL/UxjGx/vigWjnzAFyXlpNPeQSZ8xUmZClqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G4krsr0w; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97482606A322 for ; Wed, 2 Dec 2026 19:08:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G4krsr0w Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1429A1F000C1; Wed, 2 Dec 2026 19:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796238487; bh=x5uKxFRDok/VLN6JK6a/naba4aElu58RWTSsomv12EE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=G4krsr0wmDbd1A9+JDNgPqBmbQINmweR813bvQi82nKwq5bQK4iVRd/WrCHW8JqxJ NVS5tK7lQqMVKWdj44rz/NL3aLrWHDhnlZx9QqmYGbo/Ct6wkkfZdN8UYC3WuBgSRe EiiSIcByd61NutNPqUnXtra5BzKQXBq0NE84XYokPlejIpcUrgIJJG+98DquuQICwJ nG1mSARs/HFHesA/Bck3wXRz1HwvX30XBTP6A3rENEF+CrA7eHqyM79KqqLjlmoGRF qaR00m5usXK7qBHLJfzOr1Ip+OEDDGcZF0WEwNTDrYDL6Pfa15XC7bohy2EXWpr7xA bjAIDxDJ7n5YA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 10/13] HID: haptic: Decouple from hid-multitouch and support other devices Reply-To: sashiko-reviews@lists.linux.dev To: "Rong Zhang" Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261203-hid-haptic-kmod-v6-10-95a1273b9e40@rong.moe> References: <20261203-hid-haptic-kmod-v6-0-95a1273b9e40@rong.moe> <20261203-hid-haptic-kmod-v6-10-95a1273b9e40@rong.moe> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 19:08:06 +0000 X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] HID: haptic: stylus matching fails in hid_haptic_check_prerequisites() -- commit bd7794227e36fff25c1aaa191f88aebef47dc33b Author: Rong Zhang HID: haptic: Decouple from hid-multitouch and support other devices This commit adds fallback input device selection for hid-haptic so that haptic devices with Collection Application or Collection Logical hierarchies can initialize without requiring hid-multitouch integration. Link: https://usb.org/sites/default/files/hutrr63b_-_haptics_page_redline_0= .pdf [1] Link: https://learn.microsoft.com/en-us/windows-hardware/design/component-g= uidelines/input-haptics-implementation-guide [2] Link: https://learn.microsoft.com/en-us/windows-hardware/design/component-g= uidelines/haptic-pen-implementation-guide [3] > diff --git a/drivers/hid/hid-haptic.c b/drivers/hid/hid-haptic.c > index 40bb641fc1f5d..aae4ff1f0ccaa 100644 > --- a/drivers/hid/hid-haptic.c > +++ b/drivers/hid/hid-haptic.c [ ... ] > @@ -566,19 +567,55 @@ static int hid_haptic_init(struct hid_device *hdev,= struct hid_haptic_device *ha > static int hid_haptic_check_prerequisites(struct hid_device *hdev, > struct hid_haptic_device *haptic, struct hid_input *hi) > { > + struct hid_report *report; > + > if (!haptic->waveform_list_report || !haptic->duration_list_report || > !haptic->manual_trigger_report) > return -ENOENT; > =20 > - if (IS_ERR_OR_NULL(haptic->input_dev)) > - return PTR_ERR(haptic->input_dev) ?: -EXDEV; > - > /* Check the prerequisites only. */ > if (!hi) > return 1; > =20 > - if (haptic->input_dev =3D=3D hi->input) > - return 0; > + /* > + * Honor the HID driver's choice. > + * > + * If the driver didn't choose an input device or failed its > + * prerequisites check, initialize the haptic device without the > + * integration with the driver. > + */ > + if (IS_ERR_OR_NULL(haptic->input_dev)) > + haptic->input_dev =3D NULL; > + else > + return haptic->input_dev !=3D hi->input; > + > + /* > + * A Simple Haptic Controller may be either a Collection Application > + * (CA) or a Collection Logical (CL): > + * > + * A CA is a dedicated HID application, i.e., not associated with other > + * HID applications. Choose the first HID input device to attach the FF > + * device, as other FF drivers do. Haptic Mouse usually falls into this > + * category. > + * > + * A CL is contained within another HID application. The HID input > + * device handling the manual trigger report must be the one handling > + * the associated HID application. Haptic Touchpad and Stylus usually > + * fall into this category. > + * > + * When HID_QUIRK_MULTI_INPUT is set, the quirky collection hierarchy > + * makes no sense anyway, so the first input device is chosen instead. > + */ > + if (haptic->manual_trigger_report->application =3D=3D HID_HP_SIMPLECONT= ROLLER || > + hdev->quirks & HID_QUIRK_MULTI_INPUT) { > + if (list_is_first(&hi->list, &hdev->inputs)) > + return 0; > + } else { > + list_for_each_entry(report, &hi->reports, hidinput_list) { > + if (report =3D=3D haptic->manual_trigger_report) > + return 0; > + } > + } [Severity: Medium] Can this match haptic->manual_trigger_report for a haptic stylus on a composite touchscreen and pen device bound to hid-multitouch? In descriptors following the Microsoft Haptic Pen Implementation Guide, the top-level application collection is HID_DG_PEN, containing a HID_DG_STYLUS physical collection for the stylus input fields and a HID_HP_SIMPLECONTROLLER logical collection for the manual trigger output report. When hidinput_connect() processes HID_INPUT_REPORT first, hidinput_allocate() sets hi->application to HID_DG_PEN, and then mt_input_mapping() overwrites it: drivers/hid/hid-multitouch.c:mt_input_mapping() { ... if (field->physical =3D=3D HID_DG_STYLUS) hi->application =3D HID_DG_STYLUS; ... } When HID_OUTPUT_REPORT is processed next, manual_trigger_report still has report->application =3D=3D HID_DG_PEN. Because mt_probe() sets HID_QUIRK_INPUT_PER_APP, hidinput_match_application() compares hidinput->application (now HID_DG_STYLUS) against report->application (HID_DG_PEN), fails to match the stylus hid_input, and places manual_trigger_report on a newly allocated hid_input with no input usages. As a result, manual_trigger_report is absent from the stylus hi->reports list, hid_haptic_check_prerequisites() returns 1 for the stylus, and the unpopulated hid_input holding manual_trigger_report is later freed by hidinput_cleanup_hidinput(), leaving the stylus without haptic force feedback. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-hid-haptic= -kmod-v6-0-95a1273b9e40@rong.moe?part=3D10