summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@bitmath.org>2010-08-05 19:42:03 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-05 22:48:38 +0200
commit41be604bacf259d8dbcd6d5641fc3e6bb113dafc (patch)
tree5c059b7e850de343cdcc3d33780da9ec7fcb5c15 /test
parent7559b3d7aa725cd75ee4e6746246205392fe1c0f (diff)
grail-gesture: Allow more versatile input
The current code does not allow input in hex form. This patch switches to use strtoull, allowing for a 32/64 bitmask to be specified on commandline. Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'test')
-rw-r--r--test/grail-gesture.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/grail-gesture.c b/test/grail-gesture.c
index f34bd6f..18c50c3 100644
--- a/test/grail-gesture.c
+++ b/test/grail-gesture.c
@@ -73,7 +73,7 @@ static void loop_device(struct grail *ge, int fd)
73int main(int argc, char *argv[]) 73int main(int argc, char *argv[])
74{ 74{
75 struct grail ge; 75 struct grail ge;
76 int fd; 76 int i, fd;
77 77
78 if (argc < 3) { 78 if (argc < 3) {
79 fprintf(stderr, "Usage: %s <mask> <device>\n", argv[0]); 79 fprintf(stderr, "Usage: %s <mask> <device>\n", argv[0]);
@@ -85,11 +85,10 @@ int main(int argc, char *argv[])
85 ge.event = tp_event; 85 ge.event = tp_event;
86 ge.gesture = tp_gesture; 86 ge.gesture = tp_gesture;
87 87
88 unsigned mask = atoi(argv[1]); 88 unsigned long mask = strtoull(argv[1], 0, 0);
89 flag_mask[0] = (mask >> 0) & 255; 89 for (i = 0; i < DIM_GRAIL_TYPE; i++)
90 flag_mask[1] = (mask >> 8) & 255; 90 if ((mask >> i) & 1)
91 flag_mask[2] = (mask >> 16) & 255; 91 grail_mask_set(flag_mask, i);
92 flag_mask[3] = (mask >> 24) & 255;
93 92
94 fd = open(argv[2], O_RDONLY | O_NONBLOCK); 93 fd = open(argv[2], O_RDONLY | O_NONBLOCK);
95 if (fd < 0) { 94 if (fd < 0) {