[PATCH evemu] Print DMI modalias into the header

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 29 15:52:15 PDT 2015


Useful for touchpads, where knowing which laptop the touchpad recording
belongs to allows for better historical analysis. Now we just need to turn
back the time and add this patch to evemu three years ago.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evemu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/evemu.c b/src/evemu.c
index b800998..642597b 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -348,6 +348,8 @@ static void
 write_header(FILE *fp)
 {
 	struct utsname u;
+	char modalias[2048];
+	FILE *dmi;
 
 	fprintf(fp, "# EVEMU %d.%d\n", EVEMU_FILE_MAJOR, EVEMU_FILE_MINOR);
 
@@ -355,6 +357,14 @@ write_header(FILE *fp)
 		return;
 
 	fprintf(fp, "# Kernel: %s\n", u.release);
+
+	dmi = fopen("/sys/class/dmi/id/modalias", "r");
+	if (dmi) {
+		if (fgets(modalias, sizeof(modalias), dmi)) {
+			fprintf(fp, "# DMI: %s", modalias);
+		}
+		fclose(dmi);
+	}
 }
 
 int evemu_write(const struct evemu_device *dev, FILE *fp)
-- 
2.4.3



More information about the Input-tools mailing list