--- /dev/null
+ifeq ($(BOARD_USES_TSLIB),true)
+include $(call all-subdir-makefiles)
+endif
TSLIB_FBDEVICE Framebuffer device.
Default: /dev/fb0
+Alternatively, use ${sysconfdir}/ts.env to store these configuration
+parameters. Some java terminals do not inherit environment variables, and
+having to type the environment variables everytime can be a pain. The format of
+ts.env should be the same as entering the environment variables into a flat
+file:
+
+TSLIB_TSDEVICE=/dev/input/event2
+TSLIB_CALIBFILE=/etc/pointercal
+<key>=<value>
+
+Empty lines, lines starting with '#', lines longer then 512 bytes, and lines
+that don't follow the previous three lines will be ignored.
+
Module Creation Notes
=====================
--- /dev/null
+Don't have android install ts.conf.
+This should be done by the Target Product.
+Copy the ts.conf to vendor/<company>/<product> and install it from there.
+Also include a premade pointercal if you wish.
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+C_INCLUDES += \
+ external/tslib \
+ external/tslib/src \
+ external/tslib/plugins
+
+CFLAGS += -DTS_POINTERCAL=\"/data/system/tslib/pointercal\" \
+ -DTS_ENV=\"/system/etc/ts.env\" \
+ -DTSLIB_INTERNAL \
+ -DGCC_HASCLASSVISIBILITY
+
+LOCAL_MODULE:= linear
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = linear.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= dejitter
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = dejitter.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= variance
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = variance.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= pthres
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = pthres.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= input-raw
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = input-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= arctic2
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = arctic2-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= corgi
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = corgi-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= collie
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = collie-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= h3600
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = h3600-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= linear-h2200
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = linear-h2200.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= mk712
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = mk712-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= tatung
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = tatung-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= touchkit
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = touchkit-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE:= ucb1x00
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_C_INCLUDES = $(C_INCLUDES)
+LOCAL_SRC_FILES = ucb1x00-raw.c
+LOCAL_SHARED_LIBRARIES += libts
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/ts
+include $(BUILD_SHARED_LIBRARY)
+
we set it to constant 255. It's still controlled by BTN_TOUCH - when not
touched, the pressure is forced to 0. */
- if (!(absbit[BIT_WORD(ABS_PRESSURE)] & BIT_MASK(ABS_PRESSURE))) {
+ if (1 || !(absbit[BIT_WORD(ABS_PRESSURE)] & BIT_MASK(ABS_PRESSURE))) {
i->current_p = 255;
if ((ioctl(ts->fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) ||
case EV_KEY:
switch (ev.code) {
case BTN_TOUCH:
+ case BTN_MOUSE:
if (ev.value == 0)
pen_up = 1;
break;
case EV_ABS:
switch (ev.code) {
case ABS_X:
+ case ABS_Z:
i->current_x = ev.value;
break;
case ABS_Y:
+ case ABS_RX:
i->current_y = ev.value;
break;
case ABS_PRESSURE:
if (ev.type == EV_ABS) {
switch (ev.code) {
case ABS_X:
+ case ABS_Z:
if (ev.value != 0) {
samp->x = i->current_x = ev.value;
samp->y = i->current_y;
}
break;
case ABS_Y:
+ case ABS_RX:
if (ev.value != 0) {
samp->x = i->current_x;
samp->y = i->current_y = ev.value;
} else if (ev.type == EV_KEY) {
switch (ev.code) {
case BTN_TOUCH:
+ case BTN_MOUSE:
if (ev.value == 0) {
/* pen up */
samp->x = 0;
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;
}
int index;
char *calfile;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
lin = malloc(sizeof(struct tslib_linear));
if (lin == NULL)
return NULL;
/*
* Check calibration file
*/
- if( (calfile = getenv("TSLIB_CALIBFILE")) == NULL) calfile = TS_POINTERCAL;
+ if( (calfile = getenv("TSLIB_CALIBFILE")) == NULL) {
+ if (tset != NULL) {
+ calfile = tset->calfile;
+ } else {
+ calfile = TS_POINTERCAL;
+ }
+ }
if (stat(calfile, &sbuf)==0) {
pcal_fd = fopen(calfile, "r");
for (index = 0; index < 7; index++)
return NULL;
}
+ free(tset);
return &lin->module;
}
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ ts_attach.c \
+ ts_close.c \
+ ts_config.c \
+ ts_setting.c \
+ ts_error.c \
+ ts_fd.c \
+ ts_load_module.c \
+ ts_open.c \
+ ts_parse_vars.c \
+ ts_read.c \
+ ts_read_raw.c
+
+#include $(LOCAL_PATH)/../android-config.mk
+LOCAL_CFLAGS += -DPLUGIN_DIR=\"/system/lib/ts\" \
+ -DTS_CONF=\"/system/etc/ts.conf\" \
+ -DTS_ENV=\"/system/etc/ts.env\" \
+ -DTSLIB_INTERNAL
+LOCAL_C_INCLUDES += \
+ external/tslib \
+ external/tslib/src
+
+LOCAL_SHARED_LIBRARIES += libdl
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_MODULE:= libts
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
int line = 0;
int ret = 0;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
char *conffile;
if( (conffile = getenv("TSLIB_CONFFILE")) == NULL) {
- conffile = strdup (TS_CONF);
+ if (tset != NULL) {
+ conffile = tset->conffile;
+ } else {
+ conffile = strdup (TS_CONF);
+ }
}
f = fopen(conffile, "r");
fclose(f);
+ free(tset);
return ret;
}
void *handle;
char *plugin_directory = getenv("TSLIB_PLUGINDIR");
- if (!plugin_directory)
- plugin_directory = PLUGIN_DIR;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
+ if (!plugin_directory) {
+ if (tset != NULL && tset->plugdir != NULL) {
+ plugin_directory = tset->plugdir;
+ } else {
+ plugin_directory = PLUGIN_DIR;
+ }
+ }
snprintf(fn, sizeof fn, "%s/%s.so", plugin_directory, module);
info->handle = handle;
+ free(tset);
return info;
}
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include "tslib-private.h"
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "tslib.h"
+
+#define BUF_SIZE 512
+
+struct tssetting *ts_setting(const char *filename)
+{
+ struct tssetting *tset;
+ char buf[BUF_SIZE], *p;
+ int line = 0;
+
+ /* try to open filename */
+ FILE *file = fopen(filename, "r");
+ if (file == NULL) {
+ perror("Failed to open settings file");
+ return NULL;
+ } else {
+ /* we can open filename, lets allocate tset! */
+ tset = malloc(sizeof(struct tssetting));
+ if (tset)
+ {
+ memset(tset, 0, sizeof(struct tssetting));
+ } else {
+ return NULL;
+ }
+ }
+
+ if (file != NULL)
+ {
+ buf[BUF_SIZE - 2] = '\0';
+ while ((p = fgets(buf, BUF_SIZE, file)) != NULL) {
+ char *e, *tok;
+ char delim[] = "=";
+
+ line++;
+
+ /* chomp */
+ e = strchr(p, '\n');
+ if (e)
+ *e = '\0';
+
+ /* ignore lines that are too long for our buffer */
+ if (buf[BUF_SIZE - 2] != '\0') {
+ /* printf("%s: line %d too long\n", filename, line); */
+ break;
+ }
+
+ /* get the lhs of delim */
+ tok = strsep(&p, delim);
+
+ /* ignore lines starting with '#' and blank lines */
+ if (p==NULL || *tok == '#')
+ continue;
+
+ /* copy the rhs to struct->member */
+ if (strcasecmp(tok, "TSLIB_TSDEVICE") == 0) {
+ tset->tsdev = strdup(strsep(&p, delim));
+ } else if (strcasecmp(tok, "TSLIB_CONSOLEDEVICE") == 0) {
+ tset->condev = strdup(strsep(&p, delim));
+ } else if (strcasecmp(tok, "TSLIB_FBDEVICE") == 0) {
+ tset->fbdev = strdup(strsep(&p, delim));
+ } else if (strcasecmp(tok, "TSLIB_CALIBFILE") == 0) {
+ tset->calfile = strdup(strsep(&p, delim));
+ } else if (strcasecmp(tok, "TSLIB_CONFFILE") == 0) {
+ tset->conffile = strdup(strsep(&p, delim));
+ } else if (strcasecmp(tok, "TSLIB_PLUGINDIR") == 0) {
+ tset->plugdir = strdup(strsep(&p, delim));
+ } else {
+ /* unknown line... ignoring */
+ continue;
+ }
+ }
+ fclose(file);
+ }
+ return tset;
+}
int rotation;
};
+struct tssetting;
+
int __ts_attach(struct tsdev *ts, struct tslib_module_info *info);
int __ts_attach_raw(struct tsdev *ts, struct tslib_module_info *info);
int ts_load_module(struct tsdev *dev, const char *module, const char *params);
struct tsdev;
+struct tssetting
+{
+ char *tsdev;
+ char *fbdev;
+ char *calfile;
+ char *conffile;
+ char *condev;
+ char *plugdir;
+};
+
struct ts_sample {
int x;
int y;
};
/*
+ * Get environment variables from settings file rather then environment.
+ */
+TSAPI struct tssetting *ts_setting(const char *filename);
+
+/*
* Close the touchscreen device, free all resources.
*/
TSAPI int ts_close(struct tsdev *);
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+INCLUDES += \
+ external/tslib \
+ external/tslib/src \
+ external/tslib/tests
+
+CFLAGS += -DTS_POINTERCAL=\"/data/system/tslib/pointercal\" \
+ -DTS_ENV=\"/system/etc/ts.env\" \
+ -DGCC_HASCLASSVISIBILITY
+
+SRC_FILES += fbutils.c \
+ font_8x8.c \
+ font_8x16.c
+
+SHARED_LIBRARIES = libts
+
+LOCAL_MODULE := ts_test
+LOCAL_MODULE_TAGS := tests
+LOCAL_SRC_FILES = ts_test.c \
+ $(SRC_FILES)
+LOCAL_C_INCLUDES = $(INCLUDES)
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_SHARED_LIBRARIES = $(SHARED_LIBRARIES)
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ts_calibrate
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES = ts_calibrate.c \
+ testutils.c \
+ $(SRC_FILES)
+LOCAL_C_INCLUDES = $(INCLUDES)
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_SHARED_LIBRARIES = $(SHARED_LIBRARIES)
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ts_print
+LOCAL_MODULE_TAGS := tests
+LOCAL_SRC_FILES = ts_print.c
+LOCAL_C_INCLUDES = $(INCLUDES)
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_SHARED_LIBRARIES = $(SHARED_LIBRARIES)
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ts_print_raw
+LOCAL_MODULE_TAGS := tests
+LOCAL_SRC_FILES = ts_print_raw.c
+LOCAL_C_INCLUDES = $(INCLUDES)
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_SHARED_LIBRARIES = $(SHARED_LIBRARIES)
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ts_harvest
+LOCAL_MODULE_TAGS := tests
+LOCAL_SRC_FILES = ts_harvest.c \
+ testutils.c \
+ $(SRC_FILES)
+LOCAL_C_INCLUDES = $(INCLUDES)
+LOCAL_CFLAGS = $(CFLAGS)
+LOCAL_SHARED_LIBRARIES = $(SHARED_LIBRARIES)
+include $(BUILD_EXECUTABLE)
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <linux/kd.h>
#include <linux/fb.h>
+#include "tslib.h"
+
#include "font.h"
#include "fbutils.h"
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;
int fd, nr;
unsigned y, addr;
- if ((fbdevice = getenv ("TSLIB_FBDEVICE")) == NULL)
- fbdevice = defaultfbdevice;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
- if ((consoledevice = getenv ("TSLIB_CONSOLEDEVICE")) == NULL)
- consoledevice = defaultconsoledevice;
+ if ((fbdevice = getenv ("TSLIB_FBDEVICE")) == NULL) {
+ if (tset != NULL) {
+ fbdevice = tset->fbdev;
+ } else {
+ fbdevice = defaultfbdevice;
+ }
+ }
+
+ if ((consoledevice = getenv ("TSLIB_CONSOLEDEVICE")) == NULL) {
+ if (tset != NULL) {
+ consoledevice = tset->condev;
+ } else {
+ consoledevice = defaultconsoledevice;
+ }
+ }
if (strcmp (consoledevice, "none") != 0) {
sprintf (vtname,"%s%d", consoledevice, 1);
for (y = 0; y < var.yres_virtual; y++, addr += fix.line_length)
line_addr [y] = fbuffer + addr;
+ free(tset);
return 0;
}
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);
#include <signal.h>
#include <string.h>
#include <unistd.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
char *tsdevice = NULL;
char *calfile = NULL;
unsigned int i, len;
+ pid_t child;
+
+ child = fork();
+ if (child > 0) {
+ getchar();
+ kill(child, SIGKILL);
+ exit(0);
+ } else if (child < 0) {
+ perror("fork");
+ exit(-1);
+ }
+
+ struct tsetting *tset;
+ tset = ts_setting(TS_ENV);
signal(SIGSEGV, sig);
signal(SIGINT, sig);
signal(SIGTERM, sig);
if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
- ts = ts_open(tsdevice,0);
- } else {
- if (!(ts = ts_open("/dev/input/event0", 0)))
- ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+ ts = ts_touchdev(tsdevice);
+ } else if (tset != NULL) {
+ ts = ts_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);
}
"TSLIB calibration utility", 1);
put_string_center (xres / 2, yres / 4 + 20,
"Touch crosshair to calibrate", 2);
+ put_string_center (xres / 2, yres / 4 + 40,
+ "Press Enter to skip", 2);
- printf("xres = %d, yres = %d\n", xres, yres);
+ sprintf(cal_buffer, "Resolution %d x %d", xres, yres);
+ put_string_center (xres / 2, yres / 4 + 70, cal_buffer, 3);
// Clear the buffer
clearbuf(ts);
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
cal_fd = open (calfile, O_CREAT | O_RDWR,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ } else if (tset != NULL) {
+ cal_fd = open (tset->calfile, O_CREAT | O_RDWR,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
} else {
cal_fd = open (TS_POINTERCAL, O_CREAT | O_RDWR,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
i = -1;
}
+ free(tset);
close_framebuffer();
+ kill(getppid(), SIGTERM);
return i;
}
#include <stdlib.h>
#include <string.h>
#include <signal.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
char *tsdevice=NULL;
FILE *output_fid;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
signal(SIGSEGV, sig);
signal(SIGINT, sig);
signal(SIGTERM, sig);
if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
ts = ts_open(tsdevice,0);
+ } 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);
put_string_center (xres/2, yres*0.85, "Touch anywhere to quit", 4);
getxy (ts, &x_ts, &y_ts);
refresh_screen ();
+ free(tset);
close_framebuffer();
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
struct tsdev *ts;
char *tsdevice=NULL;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
ts = ts_open(tsdevice,0);
+ } 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);
printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure);
}
+ free(tset);
+ return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
struct tsdev *ts;
char *tsdevice=NULL;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
ts = ts_open(tsdevice,0);
+ } 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);
printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure);
}
+ free(tset);
+ return 0;
}
#include <stdlib.h>
#include <string.h>
#include <signal.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
char *tsdevice=NULL;
+ struct tssetting *tset;
+ tset = ts_setting(TS_ENV);
+
signal(SIGSEGV, sig);
signal(SIGINT, sig);
signal(SIGTERM, sig);
if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
ts = ts_open(tsdevice,0);
+ } 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);
if (quit_pressed)
break;
}
+ free(tset);
close_framebuffer();
+ return 0;
}
--- /dev/null
+#
+# Copyright (C) 2011 The Android-x86 Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+
+# for touchscreen calibration
+PRODUCT_PACKAGES := \
+ ts_calibrate \
+
+# plugins
+PRODUCT_PACKAGES += \
+ arctic2 \
+ collie \
+ corgi \
+ dejitter \
+ h3600 \
+ input-raw \
+ linear \
+ linear-h2200 \
+ mk712 \
+ pthres \
+ tatung \
+ touchkit \
+ ucb1x00 \
+ variance