[PATCH evemu 1/3] tools: don't try to grab the device for evemu-describe

Peter Hutterer peter.hutterer at who-t.net
Mon Nov 25 15:41:16 PST 2013


evemu-describe doesn't care if there's a grab on the device, it still sees the
description.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/evemu-record.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/evemu-record.c b/tools/evemu-record.c
index c881e57..5d9cdc6 100644
--- a/tools/evemu-record.c
+++ b/tools/evemu-record.c
@@ -112,12 +112,6 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
-	if (ioctl(fd, EVIOCGRAB, (void*)1) < 0) {
-		fprintf(stderr, "error: this device is grabbed and I cannot record events\n");
-		return -1;
-	} else
-		ioctl(fd, EVIOCGRAB, (void*)0);
-
 	memset (&act, '\0', sizeof(act));
 	act.sa_handler = &handler;
 
@@ -149,6 +143,11 @@ int main(int argc, char *argv[])
 		int clockid = CLOCK_MONOTONIC;
 		ioctl(fd, EVIOCSCLOCKID, &clockid);
 #endif
+		if (ioctl(fd, EVIOCGRAB, (void*)1) < 0) {
+			fprintf(stderr, "error: this device is grabbed and I cannot record events\n");
+			return -1;
+		} else
+			ioctl(fd, EVIOCGRAB, (void*)0);
 
 		fprintf(output,  "################################\n");
 		fprintf(output,  "#      Waiting for events      #\n");
-- 
1.8.3.1



More information about the Input-tools mailing list