lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250703004943.515919-3-derekjohn.clark@gmail.com>
Date: Wed,  2 Jul 2025 17:49:39 -0700
From: "Derek J. Clark" <derekjohn.clark@...il.com>
To: Jiri Kosina <jikos@...nel.org>,
	Benjamin Tissoires <bentiss@...nel.org>
Cc: Mario Limonciello <superm1@...nel.org>,
	Xino Ni <nijs1@...ovo.com>,
	Zhixin Zhang <zhangzx36@...ovo.com>,
	Mia Shao <shaohz1@...ovo.com>,
	Mark Pearson <mpearson-lenovo@...ebb.ca>,
	"Pierre-Loup A . Griffais" <pgriffais@...vesoftware.com>,
	"Derek J . Clark" <derekjohn.clark@...il.com>,
	linux-input@...r.kernel.org,
	linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Mario Limonciello <mario.limonciello@....com>,
	Richard Hughes <hughsient@...il.com>
Subject: [PATCH 2/6] HID: Allow HID drivers to add more uevent variables

From: Mario Limonciello <mario.limonciello@....com>

Some drivers have static information that can be useful for userspace to
have, but maintaining a sysfs file is overkill. Add an optional callback
for drivers to be able to add their own uevent variables.

Cc: Richard Hughes <hughsient@...il.com>
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
 drivers/hid/hid-core.c | 6 ++++++
 include/linux/hid.h    | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1b18e0dadbac..de95470066d9 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2844,6 +2844,12 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
 				   hdev->firmware_version))
 			return -ENOMEM;
 	}
+	if (hdev->uevent) {
+		int ret = hdev->uevent(dev, env);
+
+		if (ret)
+			return ret;
+	}
 
 	return 0;
 }
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ffc81a8c7a49..36e3c167c7ff 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -680,6 +680,7 @@ struct hid_device {
 	void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
 				  struct hid_usage *, __s32);
 	void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
+	int (*uevent)(const struct device *dev, struct kobj_uevent_env *env);
 
 	/* debugging support via debugfs */
 	unsigned short debug;
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ