Topic: documentation on /dev/ts, /dev/fb and /dev/bend
In an old post Duane was talking about accessing /dev/fb0 and /dev/ts directly
With fbwrite I was able to write and read pixels on the screen but for the touchscreen I don't know how to separate coordinates from dev/ts.
Is there any documentation on /dev/ts ?
Duane post : http://forum.chumby.com/viewtopic.php?id=90
He also talked about /dev/bend, which seems to not exists anymore .. ?
[edit: 15 may]
I finally got it for /dev/ts
simple code for reading /dev/ts:
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
short *buf;
int read_coor()
{
int fd;
int n = 0;
if (0 > (fd = open("/dev/ts", O_RDONLY)))
{
perror("file ");
return 0;
}
buf = (short *)malloc(4 * sizeof(short));
do
{
if((n = read(fd, buf, 4 * sizeof(short))) < 0)
perror("read");
printf("read n[%d] p[%d] x[%d] y[%d] unknown[%d]\n",
n, buf[0], buf[1], buf[2], buf[3]);
}while(n > 0);
free(buf);
buf = 0;
return close(fd);
}
void killall(int t)
{
printf("clean exit\n");
if (buf)
free(buf);
buf = 0;
exit(0);
}
int main()
{
signal(SIGINT, killall);
read_coor();
return 0;
}
and you got pressure, then X, then Y, then a unknown value in buf.
you just have to split the bits from buf.
[/edit: 15 may]
--
kit