[PATCH evemu] Print uname in the header comments

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 10 18:14:17 PDT 2015


Knowing what approximate kernel version this was recorded against help
identify a few bugs before we spend too much time trying to reproduce it on
other kernels.

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

diff --git a/src/evemu.c b/src/evemu.c
index b98d340..b800998 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -52,6 +52,7 @@
 #include <poll.h>
 #include <ctype.h>
 #include <unistd.h>
+#include <sys/utsname.h>
 
 #include "version.h"
 
@@ -343,12 +344,25 @@ static void write_desc(const struct evemu_device *dev, FILE *fp)
 #endif
 }
 
-int evemu_write(const struct evemu_device *dev, FILE *fp)
+static void
+write_header(FILE *fp)
 {
-	int i;
+	struct utsname u;
 
 	fprintf(fp, "# EVEMU %d.%d\n", EVEMU_FILE_MAJOR, EVEMU_FILE_MINOR);
 
+	if (uname(&u) == -1)
+		return;
+
+	fprintf(fp, "# Kernel: %s\n", u.release);
+}
+
+int evemu_write(const struct evemu_device *dev, FILE *fp)
+{
+	int i;
+
+	write_header(fp);
+
 	write_desc(dev, fp);
 
 	fprintf(fp, "N: %s\n", evemu_get_name(dev));
-- 
2.4.1



More information about the Input-tools mailing list