static void loop_device(int fd) { struct MTouch mt; if (mtouch_configure(&mt, fd)) { fprintf(stderr, "error: could not configure device\n"); return; } if (mtouch_open(&mt, fd)) { fprintf(stderr, "error: could not open device\n"); return; } mconfig_defaults(&mt.cfg); printf("width: %d\n", mt.hs.max_x); printf("height: %d\n", mt.hs.max_y); //while (!mtdev_idle(&mt.dev, fd, 5000)) { while (1) { while (mtouch_read(&mt) > 0) print_gestures(&mt.gs); if (mtouch_delayed(&mt)) print_gestures(&mt.gs); } mtouch_close(&mt); }
static int device_on(InputInfoPtr local) { struct mtev_mtouch *mt = local->private; local->fd = xf86OpenSerial(local->options); if (local->fd < 0) { xf86Msg(X_ERROR, "mtev: cannot open device\n"); return !Success; } if (mtouch_open(mt, local->fd)) { xf86Msg(X_ERROR, "mtev: cannot grab device\n"); return !Success; } xf86AddEnabledDevice(local); return Success; }
static int device_on(LocalDevicePtr local) { struct MTouch *mt = local->private; local->fd = xf86OpenSerial(local->options); if (local->fd < 0) { xf86Msg(X_ERROR, "mtrack: cannot open device\n"); return !Success; } if (mtouch_open(mt, local->fd)) { xf86Msg(X_ERROR, "mtrack: cannot grab device\n"); return !Success; } xf86AddEnabledDevice(local); if(mt->timer != NULL) TimerFree(mt->timer); // release any existing timer mt->timer = NULL; mt->is_timer_installed = 0; return Success; }