From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=157.90.84.7 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796123248; b=Th0uVms3m5tIqyKcWlUthWl10iq2lK775pK2e7HximznEvaSkxpzbTqVnIqM0kdzi+gq kBRUsvoJa+UkO4THohA6258aN1+25NqakiiU+J6+fMTe/zWaVw3kfnPAziT/MNcAl6WfS mC1ZZeK0+LiILQ9u06m2JXO+j75aZgaQUfTLEjvxZtQvNLV9lttjTs5kYBZ7lfWcorjpR QRAek0p5sG1ztEmS80C5375LhlBq53w2TTsrrY8kvqjfCKOjBApN7/b0LVQyjxx8291B9 Yt2nOMMXU7k8TVnmJeyRp205K3sDPRMkadJMGJnJ1fpw7i5ihAyUYOl928txlSKcw1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796123248; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=kr6upLw3WeuNu21faO2cOiW96MAMAqJvIPd27ZXpv0g=; b=0gsjYPRTRVDE9oRSa6Bzr/DJoAegRtZMGOmzifBNvkDuOAMLshQkx45xCDCtdvDvsoXF S8cWEHDeBSh7lSIhdUGGOgYw9qDdHXPJI8Ly5emM+A4r5IbowzIbbtO13+Loa+mPgbmff Fh/PQKAxjR30MFUHEvsTDAbJBbgpo+eQgE28vgU4NaKvgGb0ClcLiXkDZoL6HGGJO6yUX 1qQ3aqs9Wej/ag48dBdfsz0zaqUiGiUsmRQmRy7NbsNG3CL9dpsgfaH/4HkArPDP3/iim NhKXj//NGqu/v2BnqQFwJKrmhiySUAbbD+4sfOg+imXmGJv8DKxv56yM/9Um6tn32YA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=tuxedocomputers.com; spf=pass smtp.mailfrom=tuxedocomputers.com; dkim=pass header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.a=rsa-sha256 header.s=default header.b=YzLsOZ9s; arc=none smtp.remote-ip=157.90.84.7 Received: from mail.tuxedocomputers.com (mail.tuxedocomputers.com [157.90.84.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECF11606A31A; Tue, 1 Dec 2026 11:07:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ECF11606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxedocomputers.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.a=rsa-sha256 header.s=default header.b=YzLsOZ9s Received: from [10.10.11.130] (business-024-134-105-141.24.134.pools.vodafone-ip.de [24.134.105.141]) (Authenticated sender: a.erhardt@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPSA id 74E732FC004A; Tue, 1 Dec 2026 12:07:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1796123238; 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=kr6upLw3WeuNu21faO2cOiW96MAMAqJvIPd27ZXpv0g=; b=YzLsOZ9sJUqBOS0ppu6vS3uDCrcg/QT+J624UzPFtu0btXESX5Ra1ubtMpF8si9VK1pLir FiPwkaQpmZ7TjHicDwthGeXEWqb3BEQJDWGsXQeEh+7Q3yjzHdDEw7hW8vSQ8o8aXXo609 r5cJpimrnA8sS2UlCnxA9u2n47SQlt0= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=a.erhardt@tuxedocomputers.com smtp.mailfrom=aer@tuxedocomputers.com Message-ID: Date: Tue, 1 Dec 2026 12:07:18 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 00/13] HID: Add hid-plugin framework & convert hid-haptic into a generic plugin To: Rong Zhang Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Benjamin Tissoires , Jiri Kosina , Dmitry Torokhov , Henrik Rydberg , Angela Czubak References: <20261130-hid-haptic-kmod-v5-0-4903f73d8cac@rong.moe> Content-Language: en-US, de-DE From: Aaron Erhardt In-Reply-To: <20261130-hid-haptic-kmod-v5-0-4903f73d8cac@rong.moe> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Am 29.11.26 um 18:52 schrieb Rong Zhang: > Several weeks ago, I bought a Logitech MX Master 4 with haptic feedback. > The hid-haptic already supports the Haptic usage page, but it only works > with hid-multitouch. I am also working on adding support for the > LampArray usage page recently [1]. > > The two drivers have a common characteristic, i.e., they targets > specific HID usage pages instead of specific devices. This leads to > additional linkage dependences because the device drivers need to call > functions provided by the usage page drivers. > > Logically, the dependence should be reversed, i.e., a usage page driver > should be an optional component of the associated device driver and is > only loaded by the device driver when the device has the usage page. > > Introduce hid-plugin framework for loadable plugin modules to achieve > the said logical dependence. Each plugin has a unique hid_plugin_id when > enabled, so that HID drivers can connect to it accordingly. The > framework loads the plugin module when needed. Once loaded (or if the > plugin is builtin), plugin connection only requires an RCU dereference > plusing an module refcount increment. Once connected, the plugin's > private data is initialized with its pointer stored in hid_device. > > On HID driver removal, all HID plugins are automatically disconnected. > When a plugin turns out to be unsuitable for the associated HID device, > it's disconnected early to release the resources. > > When a plugin is disabled, its ID maps to HID_PLUGIN_DISABLED, and calls > to the plugin helper functions are eliminated by the compiler. > > With the framework, convert hid-haptic to the first plugin. After the > conversion, it connects to hid-input and becomes a generic plugin. > > The first few patches fix pre-existing bugs in hid-haptic and > hid-multitouch. Then the later patches refactor hid-haptic, implement > the hid-plugin framework and finish the conversion. > > I volunteer to maintain the framework as well as its plugins, including > hid-haptic and future ones. > > Thanks Benjamin Tissoires for the inspiration for the implementation. > > [1]: I know Texudo folks are working on adding hid-lamparray to connect > it to hid-generic. I am not in favor of their design, so I decided to > write a new one. In my local tree, I've had an independent > implementation with HIDRAW sniff, autonomous mode as an LED trigger, > RGB/non-RGB LampArray support, per-key LED device support, etc. I will > submit it once this series settles. Thanks for your feedback! I would highly appreciate to hear your comments on our patch series. The hid-lamparray module is designed is to make it easy for other drivers to pick it up as a dependency. The only reason to include it in hid-generic is to keep the generic functionality of keyboards that are also lamparray devices. Otherwise, a separate lamparray driver would take over the device, leaving the keyboard in a bad state (LEDs working but no typing). If there was another solution but to hijack hid-generic I would also prefer that. On the other side, per-key LED support is not planned for our driver unless the maintainers agree that this is acceptable in the kernel. In general, we should settle the debate what should be included in the kernel and what is supposed to be userspace. In the meanwhile, OpenRGB has already gone the hidraw route and I think it's feasible to completely handle this in userspace. Either way, I would like to have some clarity soon. > > Suggested-by: Benjamin Tissoires > Link: https://lore.kernel.org/linux-input/auypydfkhx2eg7vp764way4batdilzc35inqda3exwzs3tk3ff@oagat6g46zto/ > Signed-off-by: Rong Zhang > --- > Changes in v5: > - Manage HID plugins' private data in the framework > - Disconnect all connected HID plugins on HID driver removal > - Add debug printk()s to track (dis)connection and (un)registration > - Only use HID_PLUGIN to build Kconfig menuconfig, rather than having > plugins depend on it > - Enable HID_PLUGIN by default to ease Kconfig migration > - Build the hid-plugin framework only if HID_PLUGIN_CORE is selected > - HID_HAPTIC selects it, so that olddefconfig preserves HID_HAPTIC's > old value > - Connect hid-haptic to hid-inpput > - Convert hid-haptic to a generic plugin > - Add a quirk flag for Logitech MX Master 4 > - Link to v4: https://patch.msgid.link/20261125-hid-haptic-kmod-v4-0-03713a89f656@rong.moe > > Changes in v4: > - Drop get_device()/put_device() and try_module_get()/module_put() > completely, as they are needless now (thanks Dmitry Torokhov) > - Drop synchronize_rcu() during registration as other drivers do, as > there is nothing to protect > - Link to v3: https://patch.msgid.link/20261113-hid-haptic-kmod-v3-0-e7dfa8766c0d@rong.moe > > Changes in v3: > - Correct the Fixes: tag of PATCH 4 (thanks Sashiko) > - Add missing Return: to hid_plugin_register()'s kernel-doc (ditto) > - Fix the return value of hid_haptic_connected_to_input() when > hid-haptic is disabled (ditto) > - Link to v2: https://patch.msgid.link/20261110-hid-haptic-kmod-v2-0-b835a067cb62@rong.moe > > Changes in v2: > - Reject touchpad applications with non-force units (thanks Sashiko) > - Only call runtime methods if the event source is the same input device > as the stored one (ditto) > - Rebase on top of v7.4-rc2 due to the devm_kzalloc_obj() changes > - Link to v1: https://patch.msgid.link/20261102-hid-haptic-kmod-v1-0-a3de5626dade@rong.moe > > --- > Rong Zhang (13): > HID: haptic: Get rid of input_ff_destroy() in error paths > HID: haptic: Fix use-after-free when draining workqueue > HID: haptic, multitouch: Check haptic prerequisite properly > HID: haptic: Postpone GET_REPORT to init > HID: Add hid-plugin framework for loadable plugin modules > HID: haptic: Convert to a loadable plugin module > HID: haptic: Adopt pr_fmt, dev_fmt and hid_*() printk helpers > HID: Add Ordinal page defines > HID: haptic: Handle list reports separately and make auto trigger optional > HID: haptic: Decouple from hid-multitouch and support other devices > HID: haptic: Add quirk table > HID: haptic: Add HID_HAPTIC_QUIRK_NO_RETRIGGER to disable retriggering > HID: haptic: Add quirk flag for Logitech MX Master 4 > > MAINTAINERS | 7 + > drivers/hid/Kconfig | 24 ++- > drivers/hid/Makefile | 4 +- > drivers/hid/hid-core.c | 3 + > drivers/hid/hid-haptic.c | 444 ++++++++++++++++++++++++++++--------------- > drivers/hid/hid-haptic.h | 181 ++++++++++++------ > drivers/hid/hid-input.c | 50 ++++- > drivers/hid/hid-multitouch.c | 41 +--- > drivers/hid/hid-plugin.c | 172 +++++++++++++++++ > drivers/hid/hid-plugin.h | 208 ++++++++++++++++++++ > include/linux/hid.h | 25 +++ > 11 files changed, 906 insertions(+), 253 deletions(-) > --- > base-commit: 4f069ab1ec243e6b60dc438772905855c60774e8 > change-id: 9644469a-hid-haptic-kmod-4e8e420f8e5f > > Thanks, > Rong > >