summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Allum <breakfast@10.am>2003-11-06 14:01:46 +0000
committerMatthew Allum <breakfast@10.am>2003-11-06 14:01:46 +0000
commit598c5d549abbb819f3391a2c88432941b546a213 (patch)
treea33d1dd4de165ba7f15796e2743b1182dae07ac3
parent7e1a564c416f6dc337a0021b1c0e1f2cb3b27296 (diff)
tslib improvements
-rw-r--r--hw/kdrive/fbdev/Makefile.am11
-rw-r--r--hw/kdrive/linux/tslib.c50
-rw-r--r--hw/kdrive/mach64/Makefile.am12
-rw-r--r--hw/kdrive/mga/Makefile.am8
-rw-r--r--hw/kdrive/r128/Makefile.am8
-rw-r--r--hw/kdrive/smi/Makefile.am7
-rw-r--r--hw/kdrive/vesa/Makefile.am10
7 files changed, 81 insertions, 25 deletions
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am
index f492e8db6..3cda39178 100644
--- a/hw/kdrive/fbdev/Makefile.am
+++ b/hw/kdrive/fbdev/Makefile.am
@@ -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@
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
index 70d9d5bd0..7d8bfdf84 100644
--- a/hw/kdrive/linux/tslib.c
+++ b/hw/kdrive/linux/tslib.c
@@ -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;
diff --git a/hw/kdrive/mach64/Makefile.am b/hw/kdrive/mach64/Makefile.am
index ff9282e60..47202971a 100644
--- a/hw/kdrive/mach64/Makefile.am
+++ b/hw/kdrive/mach64/Makefile.am
@@ -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@
diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am
index 157421249..56fa3a0cf 100644
--- a/hw/kdrive/mga/Makefile.am
+++ b/hw/kdrive/mga/Makefile.am
@@ -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)
+
diff --git a/hw/kdrive/r128/Makefile.am b/hw/kdrive/r128/Makefile.am
index 1a5718c5f..a3a989c41 100644
--- a/hw/kdrive/r128/Makefile.am
+++ b/hw/kdrive/r128/Makefile.am
@@ -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)
+
diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am
index b6e4bb140..cc78fb60d 100644
--- a/hw/kdrive/smi/Makefile.am
+++ b/hw/kdrive/smi/Makefile.am
@@ -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)
diff --git a/hw/kdrive/vesa/Makefile.am b/hw/kdrive/vesa/Makefile.am
index b0aeba0bb..e1a5de893 100644
--- a/hw/kdrive/vesa/Makefile.am
+++ b/hw/kdrive/vesa/Makefile.am
@@ -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@