diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-03-17 10:39:59 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-04-04 19:46:28 +0200 |
| commit | 586dd0f17bbd6e2e8b51f3e2fca9269e33f8038a (patch) | |
| tree | 869503d8f20db088270695abe83ed9bb3425b6f2 /tools | |
| parent | 05833fda0c31938206f134e8fa1876c3360bf6c9 (diff) | |
Allow replay of device data through grail
This patch adds replay capabilities to grail. If the specified
device points to a valid evemu file, the device properties will
be extracted from that file instead. Any appended event data will
be replayed in realtime when calling grail_pull_mtdev().
In practise, grail_gesture may be executed with a test file.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/grail-gesture.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/grail-gesture.c b/tools/grail-gesture.c index 368150e..7230c3b 100644 --- a/tools/grail-gesture.c +++ b/tools/grail-gesture.c | |||
| @@ -82,6 +82,7 @@ static void loop_device(struct grail *ge, int fd) | |||
| 82 | int main(int argc, char *argv[]) | 82 | int main(int argc, char *argv[]) |
| 83 | { | 83 | { |
| 84 | struct grail ge; | 84 | struct grail ge; |
| 85 | struct stat fs; | ||
| 85 | int i, fd; | 86 | int i, fd; |
| 86 | 87 | ||
| 87 | if (argc < 3) { | 88 | if (argc < 3) { |
| @@ -104,7 +105,11 @@ int main(int argc, char *argv[]) | |||
| 104 | fprintf(stderr, "error: could not open device\n"); | 105 | fprintf(stderr, "error: could not open device\n"); |
| 105 | return -1; | 106 | return -1; |
| 106 | } | 107 | } |
| 107 | if (ioctl(fd, EVIOCGRAB, 1)) { | 108 | if (fstat(fd, &fs)) { |
| 109 | fprintf(stderr, "error: could not stat the device\n"); | ||
| 110 | return -1; | ||
| 111 | } | ||
| 112 | if (fs.st_rdev && ioctl(fd, EVIOCGRAB, 1)) { | ||
| 108 | fprintf(stderr, "error: could not grab the device\n"); | 113 | fprintf(stderr, "error: could not grab the device\n"); |
| 109 | return -1; | 114 | return -1; |
| 110 | } | 115 | } |
| @@ -121,7 +126,8 @@ int main(int argc, char *argv[]) | |||
| 121 | loop_device(&ge, fd); | 126 | loop_device(&ge, fd); |
| 122 | grail_close(&ge, fd); | 127 | grail_close(&ge, fd); |
| 123 | 128 | ||
| 124 | ioctl(fd, EVIOCGRAB, 0); | 129 | if (fs.st_rdev) |
| 130 | ioctl(fd, EVIOCGRAB, 0); | ||
| 125 | close(fd); | 131 | close(fd); |
| 126 | return 0; | 132 | return 0; |
| 127 | } | 133 | } |
