blob: a74a1f67c83b874a6a654238a4fa382386980535 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "mtouch.h"
#include <errno.h>
/******************************************************/
int configure_mtouch(struct MTouch *mt, int fd)
{
int rc = read_capabilities(&mt->caps, fd);
if (rc < 0)
return rc;
output_capabilities(&mt->caps);
return 0;
}
/******************************************************/
int open_mtouch(struct MTouch *mt, int fd)
{
int rc;
if (mt->grabbed)
return 0;
SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1));
if (rc < 0) {
xf86Msg(X_WARNING, "multitouch: cannot grab device\n");
return rc;
}
mt->grabbed = 1;
return 0;
}
/******************************************************/
void close_mtouch(struct MTouch *mt, int fd)
{
int rc;
if (!mt->grabbed)
return 0;
SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0));
if (rc < 0)
xf86Msg(X_WARNING, "multitouch: cannot ungrab device\n");
mt->grabbed = 0;
}
/******************************************************/
|