?? test.c
字號:
#include <sys/types.h>
#include <sys/ipc.h>
#include <stdio.h>
#include <fcntl.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/ioctl.h>
#define TS_DEV "/dev/TS"
static int ts_fd=-1;
typedef struct {
unsigned short pressure;
unsigned short x;
unsigned short y;
unsigned short pad;
} TS_RET;
int main()
{
TS_RET data;
if((ts_fd=open(TS_DEV,O_RDONLY))<0)
{
printf("Error opening %s device!\n",TS_DEV);
return -1;
}
while(1)
{
read(ts_fd,&data,sizeof(data));
printf("x=%d,y=%d,pressure=%d\n",data.x,data.y,data.pressure);
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -