From nobody Wed Oct 8 03:44:51 2025 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D069EEB5; Thu, 3 Jul 2025 00:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751503790; cv=none; b=pWZrZgUcAI6/jz52fu9uFyv7bvUo72JrJwUUrI1L3bAYj7t6fOQccSP7U9GtnnK78VLOX1CHS0AGOrbCcaPdXxVN5uFoVK16bIC2kBUm3uYAn09b+92jwR8yD+/HLXKqUHeJI0ZEP77ce5YvNxfLBxn1adA7mKIWNYbNMDDsrxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751503790; c=relaxed/simple; bh=M9kWEGAhDW825E2dRVpfz8rVhUGV1kb2l+v53XfQ6oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A/jr5xf1hWAcJG8a6YRR9ogSiT++OBIkEJ4+TAHyLAlOLDHgozfax/Lotbr/0t60HynxexJSuVtJZSnzfYApgUEuIRShFM4X6032v7Kw3tZbk+OIO049aQ8tHsV6sCi2HSmE5EYwvAhXcqTFMbHU559lb8zBMYdW/f/A0Irs9/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fUfLwwuH; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fUfLwwuH" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-74b52bf417cso873323b3a.0; Wed, 02 Jul 2025 17:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751503789; x=1752108589; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EmDi07nOjAzfthy7KOI6FMj+Sn5t55qF/tEJAm78X24=; b=fUfLwwuHAzACMj668BlVjPmEBuo8yPqr9D2i84Ndz/ir+0w+quPFjUGS1bvl9FBWJT el13ibFKUD2Igt4K3hJAWDyIF4+4cqiThB2+ejmvjY7hloz6ti60SqhoOQGzhsnL0USu pJny+uDCzIGCJ9+27Fn3uT+iNRYqNia23sw43ErSR6KqmulE4C+xZC4uV2qXRpiX0LCW 1+WLc0mtqJL91Hot+UXDUnERrYgJ/haCGicYHDpU7KZR0yN+c6m/4jSTkYiIW95g+4f2 iB8cHrtV09dHVdRjm0YLqIxMoBs+kZFNqFegqS/8hqKxDJHcc0iFxLgzzkiE7Noa99PL m8EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751503789; x=1752108589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EmDi07nOjAzfthy7KOI6FMj+Sn5t55qF/tEJAm78X24=; b=aX0iF/d5dqvoQFAsOtq+HnSyhALUMBWaCkTlNa5NhfFqCEdVk2G3kqiLPtC4tmrN0z HxoJfZZzqvEXR3KRcgQx7CCv9v0CEVQ8936cfQ+8GtCERHE26Gf7EJjWilsLurxDAJe4 hox5X862nyegVR52g024nZgYbo+MiwZyM/DnIuhK+foc2yzhIQV5w/X5Dw0ZI4E0yMZq H/TGNx8U1J3mQTmHcCj2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Q== X-Received: by 2002:a05:6a21:e92:b0:1f5:9208:3ad6 with SMTP id adf61e73a8af0-2240c4a44afmr2490229637.41.1751503788634; Wed, 02 Jul 2025 17:49:48 -0700 (PDT) Received: from bliptop (108-228-232-20.lightspeed.sndgca.sbcglobal.net. [108.228.232.20]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74af55c7546sm15369815b3a.111.2025.07.02.17.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 17:49:48 -0700 (PDT) From: "Derek J. Clark" To: Jiri Kosina , Benjamin Tissoires Cc: Mario Limonciello , Xino Ni , Zhixin Zhang , Mia Shao , Mark Pearson , "Pierre-Loup A . Griffais" , "Derek J . Clark" , linux-input@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello , Richard Hughes Subject: [PATCH 1/6] HID: Include firmware version in the uevent Date: Wed, 2 Jul 2025 17:49:38 -0700 Message-ID: <20250703004943.515919-2-derekjohn.clark@gmail.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703004943.515919-1-derekjohn.clark@gmail.com> References: <20250703004943.515919-1-derekjohn.clark@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello Userspace software fwupd probes some HID devices when the daemon starts up to determine the current firmware version in order to be able to offer updated firmware if the manufacturer has made it available. In order to do this fwupd will detach the existing kernel driver if one is present, send a HID command and then reattach the kernel driver. This can be problematic if the user is using the HID device at the time that fwupd probes the hardware and can cause a few frames of input to be dropped. In some cases HID drivers already have a command to look up the firmware version, and so if that is exported to userspace fwupd can discover it and avoid needing to detach the kernel driver until it's time to update the device. Introduce a new member in the struct hid_device for the version and export a new uevent variable HID_FIRMWARE_VERSION that will display the version that HID drivers obtained. Cc: Richard Hughes Signed-off-by: Mario Limonciello --- drivers/hid/hid-core.c | 5 +++++ include/linux/hid.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 46d552b1d250..1b18e0dadbac 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2839,6 +2839,11 @@ static int hid_uevent(const struct device *dev, stru= ct kobj_uevent_env *env) if (add_uevent_var(env, "MODALIAS=3Dhid:b%04Xg%04Xv%08Xp%08X", hdev->bus, hdev->group, hdev->vendor, hdev->product)) return -ENOMEM; + if (hdev->firmware_version) { + if (add_uevent_var(env, "HID_FIRMWARE_VERSION=3D0x%04llX", + hdev->firmware_version)) + return -ENOMEM; + } =20 return 0; } diff --git a/include/linux/hid.h b/include/linux/hid.h index 7f260e0e2049..ffc81a8c7a49 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -667,6 +667,7 @@ struct hid_device { char name[128]; /* Device name */ char phys[64]; /* Device physical location */ char uniq[64]; /* Device unique identifier (serial #) */ + u64 firmware_version; /* Firmware version */ =20 void *driver_data; =20 --=20 2.50.0