tslib improvements

This commit is contained in:
Matthew Allum 2003-11-06 14:01:46 +00:00
parent 7e1a564c41
commit 598c5d549a
7 changed files with 81 additions and 25 deletions

View File

@ -6,17 +6,16 @@ noinst_LIBRARIES = libfbdev.a
bin_PROGRAMS = Xfbdev
if TSLIB
TSLIB_FLAG = -lts
endif
libfbdev_a_SOURCES = \
fbdev.c
Xfbdev_SOURCES = \
fbinit.c
if TSLIB
TSLIB_FLAG = -lts
endif
Xfbdev_LDADD = \
libfbdev.a \
@KDRIVE_LIBS@ \
@ -25,5 +24,5 @@ Xfbdev_LDADD = \
Xfbdev_DEPENDENCIES = \
libfbdev.a \
@KDRIVE_LIBS@
@KDRIVE_LIBS@

View File

@ -62,19 +62,27 @@
static long lastx = 0, lasty = 0;
static struct tsdev *tsDev = NULL;
void
/* extern int TSLibWantRawData; */
int KdTsPhyScreen = 0;
static void
TsRead (int tsPort, void *closure)
{
KdMouseInfo *mi = closure;
int fd = (int) mi->driver;
struct ts_sample event;
int n;
long pressure;
long x, y;
unsigned long flags;
unsigned long buttons;
/*
if (TSLibWantRawData)
n = ts_read_raw(tsDev, &event, 1);
else
*/
n = ts_read(tsDev, &event, 1);
if (n == 1)
{
if (event.pressure)
@ -85,7 +93,7 @@ TsRead (int tsPort, void *closure)
* touch screen, if it is we send absolute coordinates. If not,
* then we send delta's so that we can track the entire vga screen.
*/
if (KdTsCurScreen == KdTsPhyScreen) {
if (KdCurScreen == KdTsPhyScreen) {
flags = KD_BUTTON_1;
x = event.x;
y = event.y;
@ -108,11 +116,13 @@ TsRead (int tsPort, void *closure)
lastx = 0;
lasty = 0;
}
KdEnqueueMouseEvent (mi, flags, x, y);
}
}
static char *TsNames[] = {
NULL,
"/dev/ts",
"/dev/touchscreen/0",
};
@ -121,12 +131,14 @@ static char *TsNames[] = {
int TsInputType;
int
static int
TslibEnable (int not_needed_fd, void *closure)
{
KdMouseInfo *mi = closure;
int fd = 0;
fprintf(stderr, "%s() called\n", __func__);
if(!(tsDev = ts_open(mi->name, 0))) {
fprintf(stderr, "%s() failed to open %s\n", __func__, mi->name );
return -1; /* XXX Not sure what to return here */
@ -138,16 +150,16 @@ TslibEnable (int not_needed_fd, void *closure)
return fd;
}
void
static void
TslibDisable (int fd, void *closure)
{
ts_close(tsDev);
}
int
static int
TslibInit (void)
{
int i;
int i, j = 0;
KdMouseInfo *mi, *next;
int fd= 0;
int n = 0;
@ -161,10 +173,17 @@ TslibInit (void)
if (mi->inputType)
continue;
/* Check for tslib env var device setting */
if ((TsNames[0] = getenv("TSLIB_TSDEVICE")) == NULL)
j++;
if (!mi->name)
{
for (i = 0; i < NUM_TS_NAMES; i++)
for (i = j; i < NUM_TS_NAMES; i++)
{
/* XXX Should check for */
if(!(tsDev = ts_open(TsNames[i],0))) continue;
ts_config(tsDev);
fd=ts_fd(tsDev);
@ -195,11 +214,18 @@ TslibInit (void)
}
else
if (fd > 0) close(fd);
{
fprintf(stderr, "%s() failed to open tslib\n", __func__);
if (fd > 0) close(fd);
}
}
return n;
}
void
static void
TslibFini (void)
{
KdMouseInfo *mi;

View File

@ -5,6 +5,11 @@ INCLUDES = \
bin_PROGRAMS = Xmach64
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libmach64.a
libmach64_a_SOURCES = \
@ -20,11 +25,14 @@ Xmach64_SOURCES = \
MACH64_LIBS = \
libmach64.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
$(top_builddir)/hw/kdrive/vesa/libvesa.a
Xmach64_LDADD = \
$(MACH64_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xmach64_DEPENDENCIES = $(MACH64_LIBS) @KDRIVE_LIBS@

View File

@ -7,6 +7,10 @@ bin_PROGRAMS = Xmga
noinst_LIBRARIES = libmga.a
if TSLIB
TSLIB_FLAG = -lts
endif
libmga_a_SOURCES = \
mgadraw.c \
mga.c \
@ -19,4 +23,6 @@ Xmga_LDADD = \
libmga.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
@XSERVER_LIBS@ \
$(TSLIB_FLAG)

View File

@ -5,6 +5,10 @@ INCLUDES = \
bin_PROGRAMS = Xr128
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libr128.a
libr128_a_SOURCES = \
@ -19,4 +23,6 @@ Xr128_LDADD = \
libr128.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
@XSERVER_LIBS@ \
$(TSLIB_FLAG)

View File

@ -6,6 +6,10 @@ INCLUDES = \
bin_PROGRAMS = Xsmi
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libsmi.a
# smivideo.c # not ready yet
@ -22,4 +26,5 @@ Xsmi_LDADD = \
$(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
@XSERVER_LIBS@ \
$(TSLIB_FLAG)

View File

@ -6,6 +6,11 @@ noinst_LIBRARIES = libvesa.a
bin_PROGRAMS = Xvesa
if TSLIB
TSLIB_FLAG = -lts
endif
libvesa_a_SOURCES = \
vesa.c \
vbe.c \
@ -18,8 +23,9 @@ Xvesa_SOURCES = \
Xvesa_LDADD = \
libvesa.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xvesa_DEPENDENCIES = \
libvesa.a \
libvesa.a \
@KDRIVE_LIBS@