[PATCH v2 evemu 2/4] evemu-record: move describe_device into each mode

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 1 00:49:22 UTC 2016


This doesn't make sense just yet, it's prep work for an upcoming patch to call
describe_device multiple times in the evemu-record case.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- remove the original describe_device() call

 tools/evemu-record.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/evemu-record.c b/tools/evemu-record.c
index 1a81767..abf8ffe 100644
--- a/tools/evemu-record.c
+++ b/tools/evemu-record.c
@@ -151,11 +151,6 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	if (describe_device(output, fd)) {
-		fprintf(stderr, "error: could not describe device\n");
-		goto out;
-	}
-
 	if (mode == EVEMU_RECORD) {
 #ifdef EVIOCSCLOCKID
 		int clockid = CLOCK_MONOTONIC;
@@ -164,11 +159,21 @@ int main(int argc, char *argv[])
 		if (!test_grab_device(fd))
 			goto out;
 
+		if (describe_device(output, fd)) {
+			fprintf(stderr, "error: could not describe device\n");
+			goto out;
+		}
+
 		fprintf(output,  "################################\n");
 		fprintf(output,  "#      Waiting for events      #\n");
 		fprintf(output,  "################################\n");
 		if (evemu_record(output, fd, INFINITE))
 			fprintf(stderr, "error: could not record device\n");
+	} else if (mode == EVEMU_DESCRIBE) {
+		if (describe_device(output, fd)) {
+			fprintf(stderr, "error: could not describe device\n");
+			goto out;
+		}
 	}
 
 	rc = 0;
-- 
2.5.0



More information about the Input-tools mailing list