From: Douglas Lowder Date: Fri, 30 Aug 2002 03:40:09 +0000 (-0700) Subject: Added tests/ts_print_raw.c and modified autogen.sh -- see ChangeLog X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=efb385c39dfc3c506f7e461fff89ea348586d951;p=android-x86%2Fexternal-tslib.git Added tests/ts_print_raw.c and modified autogen.sh -- see ChangeLog --- diff --git a/ChangeLog b/ChangeLog index 00fcce6..4992e6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-08-29 Douglas Lowder +- Added tests/ts_print_raw.c to print raw uncalibrated touchscreen events + (useful for debugging) + 2002-07-11 Douglas Lowder - Added code in src/ts_read_raw.c to handle reading events from the mk712 touchscreen driver on the Hitachi Webpad. diff --git a/autogen.sh b/autogen.sh index 6c0992d..8b8f2f5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,8 +1,19 @@ #!/bin/sh -# $Id: autogen.sh,v 1.1.1.1 2001/12/22 21:12:06 rmk Exp $ +# $Id: autogen.sh,v 1.2 2002/08/29 20:40:09 dlowder Exp $ +echo -n "Libtoolize..." libtoolize --force --copy +echo "Done." +echo -n "Aclocal..." aclocal +echo "Done." +echo -n "Autoheader..." autoheader +echo "Done." +echo -n "Automake..." automake --add-missing --copy +echo "Done." +echo -n "Autoconf..." autoconf -./configure $* +echo "Done." +#./configure $* +echo "Now you can do ./configure, make, make install." diff --git a/tests/Makefile.am b/tests/Makefile.am index 1a1f5e5..2b714cc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,13 +6,13 @@ # This file is placed under the LGPL. Please see the file # COPYING for more details. # -# $Id: Makefile.am,v 1.2 2002/06/17 17:21:43 dlowder Exp $ +# $Id: Makefile.am,v 1.3 2002/08/29 20:40:09 dlowder Exp $ # CFLAGS := $(CFLAGS) $(DEBUGFLAGS) $(INPUTAPIFLAG) INCLUDES = -I$(top_srcdir)/src -bin_PROGRAMS = ts_test ts_calibrate ts_print +bin_PROGRAMS = ts_test ts_calibrate ts_print ts_print_raw ts_test_SOURCES = ts_test.c fbutils.c font_8x8.c font_8x16.c ts_test_LDADD = $(top_builddir)/src/libts.la @@ -20,5 +20,8 @@ ts_test_LDADD = $(top_builddir)/src/libts.la ts_print_SOURCES = ts_print.c ts_print_LDADD = $(top_builddir)/src/libts.la +ts_print_raw_SOURCES = ts_print_raw.c +ts_print_raw_LDADD = $(top_builddir)/src/libts.la + ts_calibrate_SOURCES = ts_calibrate.c fbutils.c font_8x8.c font_8x16.c ts_calibrate_LDADD = $(top_builddir)/src/libts.la diff --git a/tests/ts_print_raw.c b/tests/ts_print_raw.c new file mode 100644 index 0000000..773613e --- /dev/null +++ b/tests/ts_print_raw.c @@ -0,0 +1,66 @@ +/* + * tslib/src/ts_print.c + * + * Derived from tslib/src/ts_test.c by Douglas Lowder + * Just prints touchscreen events -- does not paint them on framebuffer + * + * This file is placed under the GPL. Please see the file + * COPYING for more details. + * + * Basic test program for touchscreen library. + */ +#include +#include +#include +#include +#include +#include +#include + +#include "tslib.h" + + +int main() +{ + struct tsdev *ts; + int x, y; + char *tsdevice=NULL; + + if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) { + ts = ts_open(tsdevice,0); + } else { +#ifdef USE_INPUT_API + ts = ts_open("/dev/input/event0", 0); +#else + ts = ts_open("/dev/touchscreen/ucb1x00", 0); +#endif /* USE_INPUT_API */ + } + + if (!ts) { + perror("ts_open"); + exit(1); + } + + if (ts_config(ts)) { + perror("ts_config"); + exit(1); + } + + while (1) { + struct ts_sample samp; + int ret; + + ret = ts_read_raw(ts, &samp, 1); + + if (ret < 0) { + perror("ts_read"); + exit(1); + } + + if (ret != 1) + continue; + + printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure); + + } +}