From nobody Sun Feb 8 12:37:41 2026 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 1E787279DAB for ; Mon, 29 Dec 2025 03:18:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766978290; cv=none; b=Y4ewwuP+NOz1DqdEGBzbQfh1jhyG0iFmJAWQ53up+5CkFgXOVvAeLdBGaOfELxMjdkE7HHX+09QIotiBek61uHqNTROAr/MzquSM4UtKO14g5YsVX6q770Kyxttl3r/vco+R1WaeJ/YsZL92SYF2bNgn9ykMfSLSqkVbgUgaPWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766978290; c=relaxed/simple; bh=9+pJd3NBP++1JTk1sqOowLELYEPW5+pC2QloAQLjOjs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SZQHX+3ICJQMkvefsJsbcCzcs1Ha2pzUQL/kHrVk9IpXUtRu/lNmjlrmV1D3+ovVVcpr3KYoxXDHAtbIRpGVPau1DRmAi41Y5k3fn/F7D66dbD4SCuKz56g1oKSgJx38jFr79uG4wLpr9MjiSGWghGZvmze8IdQPT/QetgaZ9I8= 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=iC0hM66p; arc=none smtp.client-ip=209.85.216.53 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="iC0hM66p" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-34b75fba315so9663734a91.3 for ; Sun, 28 Dec 2025 19:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766978285; x=1767583085; 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=b5fLauwF03o87S7cIGBwSfbxsvXnHNtEz/FCDWnd8ng=; b=iC0hM66pQzv/0cNJ5dAl8AcF8iVP/J7Sf0QmZxmmg0mK4EiqEWkVpziuEBKWKxotmH 69wnxE6KX+bwc1vAJZ4gSboRmGQE7n7pq1XnB7ACy6ehOAd/rfdipBu1dp1JpmumQ52l pteyhl6eUVBfC4XYFOrpc05p654ffF7EXj6tSf8WDs6unIsDi3TJN0czoVEnmY+naV04 YGnt66g9tzCaGISXoDvVMNGa3Wp/TLiEZosXhN2tcFntuXi/imHkK0X3rqFtWYYyXoyc Xzv6dSp4NG091bVz9CoMc1jQWjO0ouHuaHKb5hNjgPEbbhGVv+BUPkikSkqaThXbko6E uT5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766978285; x=1767583085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=b5fLauwF03o87S7cIGBwSfbxsvXnHNtEz/FCDWnd8ng=; b=bdKRt1uj6e7V5dk3xsutKLM/FdpNPRrLsNGMVE/L2LJxu1l/z3fNgRN8bwJJX6aPRP p8/ZKcpyAVDs68iPrPLyhQY5Fajod6/TcB3SaGqsDejejPOVxrGPg3YzCh64xD4oZeAl oUfoVS8mxku/+L5HSXbCjiDqRcc0GOrUk3EaKv9tHZmimv/XPJl3+MbWsfCdRp0jL50G J85IVTfMbCvqvIAVH0LlGdLTcFCPJ4TuC9NikTLTFdEdCGJUrsrdLV2utvAfaST6TL7i XmbzCHz2TuKbX9Ab5TBUzGpG1lkBOUR6ve60PrK8rpBKC340y+extUxw5DdWB88wO34M VUEA== X-Forwarded-Encrypted: i=1; AJvYcCUot7qfOxbVnB+vcgw6Al/ntFA4lkForTXmmE0iJXucXY8ol/eRdW6gMX/F95fTihIg6U4Wqr7DAX44FRA=@vger.kernel.org X-Gm-Message-State: AOJu0YxdFGgXnjZ1Vpx4rvZBgLs/OGdmc6pLBpZM3cU+QTqGuYrTaTg4 97FrJeRX1SahzcqbRlCwLnJF/V5wezbq4f5rKanILWS8AYOhOcF7km9I X-Gm-Gg: AY/fxX78ke6s1D8Rxc24Teq+AkPiL7bzpHIhl7lPqR9q8h2yKPWLhlPZDzNx7Bs478k qokQGIESI8EbbH+j1/a+XQ4+CqY9Akk87rfAydAsQMP0rcK4qUIrqgJJmGTxahdSc3oX8ki/0q2 cbNoyQM6YL8/xD7HPa5fJ6l6t2EiqcEGKVq/EPO+/UF/ukebQrskg6X0/Mkci39OeNZgKUMVmO3 ZwrLP/EKv/IXerl7kzC5OFuhwp+kzx+SONFC7CASOM/2aar2r6Rm0Jwr/NohMzBxobdNlVAIj9f CMKxJPiFHIEkf/OJYzOXgXRMv8qe6731kwFSRft2IZSaC3R9crHEmmP9EjjDd/H6wc4Ai3bq/Ml e0kCiwxGkBM1VAhHhwUwnrJSJQFWq4rRHX1lVMBAddls+Ute61IjZXtkCqzmTh10RF5TJcytp8X wnWD9I7yaDi+zTu/kniAXuYwx1sKDQDIJw6Ve+m5pabbUx1VaWW2K2LYf4CB1ojkg= X-Google-Smtp-Source: AGHT+IHxlvbsjIIiGCdaZR2kNkfJhhczYREzl56thhmxe0C7ocWaa7i+0Rinex+uCUd+z7fHP0XHDg== X-Received: by 2002:a05:7022:7e8e:b0:11b:bf3f:5208 with SMTP id a92af1059eb24-121722ac21bmr29615714c88.1.1766978285028; Sun, 28 Dec 2025 19:18:05 -0800 (PST) Received: from lappy (108-228-232-20.lightspeed.sndgca.sbcglobal.net. [108.228.232.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-121724dd7f5sm112992785c88.5.2025.12.28.19.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 19:18:04 -0800 (PST) From: "Derek J. Clark" To: Jiri Kosina , Benjamin Tissoires Cc: Mario Limonciello , 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, Richard Hughes Subject: [PATCH v2 09/16] HID: Include firmware version in the uevent Date: Mon, 29 Dec 2025 03:17:46 +0000 Message-ID: <20251229031753.581664-10-derekjohn.clark@gmail.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251229031753.581664-1-derekjohn.clark@gmail.com> References: <20251229031753.581664-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 a5b3a8ca2fcb..524f2b9ed512 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2887,6 +2887,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 a4ddb94e3ee5..8249da55c9ba 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -698,6 +698,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.51.2