资源简介
触摸板的优化算法库源代码,可在linux下编译,通用于各个平台
代码片段和文件信息
#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;
}
评论
共有 条评论