Skip to content

Instantly share code, notes, and snippets.

@xlab
Created July 13, 2012 10:59
Show Gist options
  • Save xlab/3104270 to your computer and use it in GitHub Desktop.
Save xlab/3104270 to your computer and use it in GitHub Desktop.
Touchscreen lock via tslib
#include "tslib/src/tslib.h"
struct tsdev *ts;
char *tsdevice = "/dev/input/event0";
ts = ts_open(tsdevice, 0);
int ts_tmpfd = ts_fd(ts);
if (ts_tmpfd == -1)
{
perror("ts_open");
exit(1);
}
unsigned long val = 1;
int ioctl_ret = ioctl(ts_tmpfd, EVIOCGRAB, &val);
printf("now lock the ts ioctl ret is: %d\n", ioctl_ret);
if (ioctl_ret != 0)
{
printf("Error: %s\n", strerror(errno));
exit(1);
}
printf("lock the ts succeed\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment