资源简介
其中包含tslib1.0,tslib1.3,tslib1.4三个版本的源码
代码片段和文件信息
#include
#include
#include
#include “config.h“
#include “tslib-private.h“
struct arctic2_ts_event { /* Used in the IBM Arctic II */
signed short pressure;
signed int x;
signed int y;
int millisecs;
int flags;
};
static int arctic2_read(struct tslib_module_info *inf struct ts_sample *samp int nr)
{
struct tsdev *ts = inf->dev;
struct arctic2_ts_event *arctic2_evt;
int ret;
int total = 0;
arctic2_evt = alloca(sizeof(*arctic2_evt) * nr);
ret = read(ts->fd arctic2_evt sizeof(*arctic2_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*arctic2_evt);
while(ret >= (int)sizeof(*arctic2_evt)) {
samp->x = (short)arctic2_evt->x;
samp->y = (short)arctic2_evt->y;
samp->pressure = arctic2_evt->pressure;
#ifdef DEBUG
fprintf(stderr“RAW---------------------------> %d %d %d\n“samp->xsamp->ysamp->pressure);
#endif /*DEBUG*/
gettimeofday(&samp->tvNULL);
samp++;
arctic2_evt++;
ret -= sizeof(*arctic2_evt);
}
} else {
return -1;
}
ret = nr;
return ret;
}
static const struct tslib_ops arctic2_ops =
{
.read = arctic2_read
};
TSAPI struct tslib_module_info *mod_init(struct tsdev *dev const char *params)
{
struct tslib_module_info *m;
m = malloc(sizeof(struct tslib_module_info));
if (m == NULL)
return NULL;
m->ops = &arctic2_ops;
return m;
}
- 上一篇:aszou_FireBird数据库备份.rar
- 下一篇:声光控路灯控制课程设计
评论
共有 条评论