return NULL;
i->module.ops = &__ts_input_ops;
+ i->module.dev = dev;
i->current_x = 0;
i->current_y = 0;
i->current_p = 0;
i->using_syn = 0;
i->grab_events = 0;
- if (tslib_parse_vars(&i->module, raw_vars, NR_VARS, params)) {
+ if (check_fd(i) || tslib_parse_vars(&i->module, raw_vars, NR_VARS, params)) {
free(i);
return NULL;
}
static char *fbdevice = NULL;
static char *consoledevice = NULL;
+struct tsdev *open_touchdev(const char *dev)
+{
+ struct tsdev *ts = ts_open(dev, 0);
+ if (!ts) {
+ perror("ts_open");
+ return NULL;
+ }
+ if (ts_config(ts)) {
+ ts_close(ts);
+ return NULL;
+ }
+ return ts;
+}
+
int open_framebuffer(void)
{
struct vt_stat vts;
extern __u32 xres, yres;
+struct tsdev *open_touchdev(const char *dev);
int open_framebuffer(void);
void close_framebuffer(void);
void setcolor(unsigned colidx, unsigned value);
tset = ts_setting(TS_ENV);
if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
- ts = ts_open(tsdevice,0);
+ ts = open_touchdev(tsdevice);
} else if (tset != NULL) {
- ts = ts_open(tset->tsdev, 0);
- } else {
- if (!(ts = ts_open("/dev/input/event0", 0)))
- ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+ ts = open_touchdev(tset->tsdev);
}
-
if (!ts) {
- perror("ts_open");
- exit(1);
+ char tsdevice[20];
+ /* CW: a lazy way to go through all events.. is 99 enough? */
+ for (i = 0; i <= 99; ++i) {
+ sprintf(tsdevice, "/dev/input/event%d", i);
+ if ((ts = open_touchdev(tsdevice)))
+ break;
+ }
+ if (!ts)
+ ts = open_touchdev("/dev/touchscreen/ucb1x00");
}
- if (ts_config(ts)) {
+
+ if (!ts) {
perror("ts_config");
exit(1);
}