diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2008-11-06 14:23:23 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2008-11-06 14:23:23 +0100 |
| commit | 826439bce844fdbc8d7e47c0964cb15fd8a8fe93 (patch) | |
| tree | 01fb4630ac048ace32b36c308dd0ec62b27f4dcd /src/mtouch.c | |
| parent | a773c79d6d767ddfe574ad513ab0276bdd13a717 (diff) | |
grab and open/close device, now enters read (and crashes)
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mtouch.c')
| -rw-r--r-- | src/mtouch.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mtouch.c b/src/mtouch.c index 2d05921..a74a1f6 100644 --- a/src/mtouch.c +++ b/src/mtouch.c | |||
| @@ -14,9 +14,31 @@ int configure_mtouch(struct MTouch *mt, int fd) | |||
| 14 | 14 | ||
| 15 | /******************************************************/ | 15 | /******************************************************/ |
| 16 | 16 | ||
| 17 | int init_mtouch(struct MTouch *mt) | 17 | int open_mtouch(struct MTouch *mt, int fd) |
| 18 | { | 18 | { |
| 19 | int rc; | ||
| 20 | if (mt->grabbed) | ||
| 21 | return 0; | ||
| 22 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); | ||
| 23 | if (rc < 0) { | ||
| 24 | xf86Msg(X_WARNING, "multitouch: cannot grab device\n"); | ||
| 25 | return rc; | ||
| 26 | } | ||
| 27 | mt->grabbed = 1; | ||
| 19 | return 0; | 28 | return 0; |
| 20 | } | 29 | } |
| 21 | 30 | ||
| 22 | /******************************************************/ | 31 | /******************************************************/ |
| 32 | |||
| 33 | void close_mtouch(struct MTouch *mt, int fd) | ||
| 34 | { | ||
| 35 | int rc; | ||
| 36 | if (!mt->grabbed) | ||
| 37 | return 0; | ||
| 38 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0)); | ||
| 39 | if (rc < 0) | ||
| 40 | xf86Msg(X_WARNING, "multitouch: cannot ungrab device\n"); | ||
| 41 | mt->grabbed = 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | /******************************************************/ | ||
