aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/linux
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 20:12:58 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 20:12:58 +0000
commit2553bdd7c359cd87525d367761c86932cec5adff (patch)
treeae71245933c98474a699d3e392de5820879b2018 /xorg-server/hw/kdrive/linux
parente2c51f2ee7b0a3ea1a052fc49324057b4a4bbc78 (diff)
parent4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (diff)
downloadvcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.gz
vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.bz2
vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.zip
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/hw/kdrive/linux')
-rw-r--r--xorg-server/hw/kdrive/linux/Makefile.am7
-rw-r--r--xorg-server/hw/kdrive/linux/Makefile.in87
-rw-r--r--xorg-server/hw/kdrive/linux/evdev.c6
-rw-r--r--xorg-server/hw/kdrive/linux/keyboard.c26
-rw-r--r--xorg-server/hw/kdrive/linux/ts.c209
-rw-r--r--xorg-server/hw/kdrive/linux/tslib.c8
6 files changed, 57 insertions, 286 deletions
diff --git a/xorg-server/hw/kdrive/linux/Makefile.am b/xorg-server/hw/kdrive/linux/Makefile.am
index e13d08312..6380bd5ab 100644
--- a/xorg-server/hw/kdrive/linux/Makefile.am
+++ b/xorg-server/hw/kdrive/linux/Makefile.am
@@ -10,10 +10,6 @@ if TSLIB
TSLIB_C = tslib.c
endif
-if H3600_TS
-TS_C = ts.c
-endif
-
if KDRIVE_HW
KDRIVE_HW_SOURCES = \
agp.c \
@@ -30,5 +26,4 @@ liblinux_a_SOURCES = \
ms.c \
ps2.c \
$(KDRIVE_HW_SOURCES) \
- $(TSLIB_C) \
- $(TS_C)
+ $(TSLIB_C)
diff --git a/xorg-server/hw/kdrive/linux/Makefile.in b/xorg-server/hw/kdrive/linux/Makefile.in
index 331f45ec7..7615299c3 100644
--- a/xorg-server/hw/kdrive/linux/Makefile.in
+++ b/xorg-server/hw/kdrive/linux/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -43,7 +43,6 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-server.h \
$(top_builddir)/include/dix-config.h \
- $(top_builddir)/include/xgl-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
@@ -54,23 +53,18 @@ ARFLAGS = cru
liblinux_a_AR = $(AR) $(ARFLAGS)
liblinux_a_LIBADD =
am__liblinux_a_SOURCES_DIST = bus.c klinux.h mouse.c ms.c ps2.c agp.c \
- agp.h evdev.c keyboard.c linux.c tslib.c ts.c
+ agp.h evdev.c keyboard.c linux.c tslib.c
@KDRIVE_HW_TRUE@am__objects_1 = agp.$(OBJEXT) evdev.$(OBJEXT) \
@KDRIVE_HW_TRUE@ keyboard.$(OBJEXT) linux.$(OBJEXT)
@TSLIB_TRUE@am__objects_2 = tslib.$(OBJEXT)
-@H3600_TS_TRUE@am__objects_3 = ts.$(OBJEXT)
am_liblinux_a_OBJECTS = bus.$(OBJEXT) mouse.$(OBJEXT) ms.$(OBJEXT) \
- ps2.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
- $(am__objects_3)
+ ps2.$(OBJEXT) $(am__objects_1) $(am__objects_2)
liblinux_a_OBJECTS = $(am_liblinux_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
@@ -85,8 +79,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
-APPDEFAULTDIR = @APPDEFAULTDIR@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
+APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
@@ -107,10 +102,6 @@ CFLAGS = @CFLAGS@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -132,6 +123,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DOLT_BASH = @DOLT_BASH@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
@@ -141,18 +133,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
-FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
-FREETYPE_LIBS = @FREETYPE_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -171,7 +160,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@
KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
-LAUNCHD = @LAUNCHD@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -185,7 +174,10 @@ LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUXDOC = @LINUXDOC@
+LIPO = @LIPO@
LN_S = @LN_S@
+LTCOMPILE = @LTCOMPILE@
+LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
@@ -197,8 +189,7 @@ MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
-MKFONTDIR = @MKFONTDIR@
-MKFONTSCALE = @MKFONTSCALE@
+NM = @NM@
NMEDIT = @NMEDIT@
OBJC = @OBJC@
OBJCCLD = @OBJCCLD@
@@ -207,8 +198,8 @@ OBJCFLAGS = @OBJCFLAGS@
OBJCLINK = @OBJCLINK@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -241,7 +232,6 @@ VENDOR_NAME = @VENDOR_NAME@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
-X11APP_ARCHS = @X11APP_ARCHS@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -251,27 +241,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
XDMX_CFLAGS = @XDMX_CFLAGS@
XDMX_LIBS = @XDMX_LIBS@
XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
-XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
-XEGL_LIBS = @XEGL_LIBS@
-XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
-XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XF86CONFIGFILE = @XF86CONFIGFILE@
-XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
-XF86MISC_LIBS = @XF86MISC_LIBS@
XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
-XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
-XGLMODULES_LIBS = @XGLMODULES_LIBS@
-XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
-XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
-XGLX_LIBS = @XGLX_LIBS@
-XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
-XGL_LIBS = @XGL_LIBS@
-XGL_MODULE_PATH = @XGL_MODULE_PATH@
-XGL_SYS_LIBS = @XGL_SYS_LIBS@
XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
@@ -282,10 +257,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_LIBS = @XNEST_LIBS@
XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
-XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
-XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
-XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
-XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
@@ -294,13 +265,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
XORG_OS = @XORG_OS@
XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
-XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
-XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
-XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
-XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
-XPRINT_CFLAGS = @XPRINT_CFLAGS@
-XPRINT_LIBS = @XPRINT_LIBS@
-XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
+XPBPROXY_LIBS = @XPBPROXY_LIBS@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -333,8 +299,7 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -354,7 +319,6 @@ driverdir = @driverdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
extdir = @extdir@
-ft_config = @ft_config@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -364,12 +328,12 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-launchagentsdir = @launchagentsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
logdir = @logdir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
moduledir = @moduledir@
@@ -387,8 +351,6 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-xglmoduledir = @xglmoduledir@
-xpconfigdir = @xpconfigdir@
INCLUDES = \
@KDRIVE_INCS@ \
@KDRIVE_CFLAGS@
@@ -396,7 +358,6 @@ INCLUDES = \
AM_CFLAGS = -DHAVE_DIX_CONFIG_H
noinst_LIBRARIES = liblinux.a
@TSLIB_TRUE@TSLIB_C = tslib.c
-@H3600_TS_TRUE@TS_C = ts.c
@KDRIVE_HW_TRUE@KDRIVE_HW_SOURCES = \
@KDRIVE_HW_TRUE@ agp.c \
@KDRIVE_HW_TRUE@ agp.h \
@@ -411,8 +372,7 @@ liblinux_a_SOURCES = \
ms.c \
ps2.c \
$(KDRIVE_HW_SOURCES) \
- $(TSLIB_C) \
- $(TS_C)
+ $(TSLIB_C)
all: all-am
@@ -422,8 +382,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -469,7 +429,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ms.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps2.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tslib.Po@am__quote@
.c.o:
@@ -504,7 +463,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/xorg-server/hw/kdrive/linux/evdev.c b/xorg-server/hw/kdrive/linux/evdev.c
index 2eaa1e332..4ccd82239 100644
--- a/xorg-server/hw/kdrive/linux/evdev.c
+++ b/xorg-server/hw/kdrive/linux/evdev.c
@@ -251,13 +251,12 @@ EvdevPtrEnable (KdPointerInfo *pi)
close (fd);
return BadMatch;
}
- ke = xalloc (sizeof (Kevdev));
+ ke = xcalloc (1, sizeof (Kevdev));
if (!ke)
{
close (fd);
return BadAlloc;
}
- memset (ke, '\0', sizeof (Kevdev));
if (ISBITSET (ev, EV_KEY))
{
if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
@@ -440,12 +439,11 @@ EvdevKbdEnable (KdKeyboardInfo *ki)
return BadMatch;
}
- ke = xalloc (sizeof (Kevdev));
+ ke = xcalloc (1, sizeof (Kevdev));
if (!ke) {
close (fd);
return BadAlloc;
}
- memset (ke, '\0', sizeof (Kevdev));
if (!KdRegisterFd (fd, EvdevKbdRead, ki)) {
xfree (ke);
diff --git a/xorg-server/hw/kdrive/linux/keyboard.c b/xorg-server/hw/kdrive/linux/keyboard.c
index 3193ab761..ae981b776 100644
--- a/xorg-server/hw/kdrive/linux/keyboard.c
+++ b/xorg-server/hw/kdrive/linux/keyboard.c
@@ -42,6 +42,8 @@
#include <sys/ioctl.h>
extern int LinuxConsoleFd;
+static unsigned char mediumraw_data, mediumraw_up;
+static enum { DEFAULT, EXTBYTE1, EXTBYTE2 } mediumraw_state = DEFAULT;
static const KeySym linux_to_x[256] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
@@ -701,7 +703,29 @@ LinuxKeyboardRead (int fd, void *closure)
else
#endif
scancode = b[0] & 0x7f;
- KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
+ /* This is extended medium raw mode interpreter
+ see linux/drivers/keyboard.c (kbd->kbdmode == VC_MEDIUMRAW) */
+ switch (mediumraw_state)
+ {
+ case DEFAULT:
+ if (scancode == 0)
+ {
+ mediumraw_state = EXTBYTE1;
+ mediumraw_up = b[0] & 0x80;
+ }
+ else
+ KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
+ break;
+ case EXTBYTE1:
+ mediumraw_data = scancode;
+ mediumraw_state = EXTBYTE2;
+ break;
+ case EXTBYTE2:
+ /* Note: Only codes < 256 will pass correctly through KdEnqueueKeyboardEvent() */
+ KdEnqueueKeyboardEvent (closure, (int)mediumraw_data << 7 | scancode, mediumraw_up);
+ mediumraw_state = DEFAULT;
+ break;
+ }
b++;
}
}
diff --git a/xorg-server/hw/kdrive/linux/ts.c b/xorg-server/hw/kdrive/linux/ts.c
deleted file mode 100644
index 831953f02..000000000
--- a/xorg-server/hw/kdrive/linux/ts.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Derived from ps2.c by Jim Gettys
- *
- * Copyright © 1999 Keith Packard
- * Copyright © 2000 Compaq Computer Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard or Compaq not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard and Compaq makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "kdrive.h"
-#include <sys/ioctl.h>
-#include <linux/h3600_ts.h> /* touch screen events */
-
-static long lastx = 0, lasty = 0;
-
-int KdTsPhyScreen = 0;
-
-static int
-TsReadBytes (int fd, char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len)
- {
- n = read (fd, buf, len);
- if (n > 0)
- {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0)
- break;
- FD_ZERO (&set);
- FD_SET (fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select (fd + 1, &set, 0, 0, &tv);
- if (n <= 0)
- break;
- }
- return tot;
-}
-
-static void
-TsRead (int tsPort, void *closure)
-{
- KdPointerInfo *pi = closure;
- TS_EVENT event;
- int n;
- long x, y;
- unsigned long flags;
-
- n = TsReadBytes (tsPort, (char *) &event, sizeof (event), sizeof (event));
- if (n == sizeof (event))
- {
- if (event.pressure)
- {
- /*
- * HACK ATTACK. (static global variables used !)
- * Here we test for the touch screen driver actually being on the
- * 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 (KdCurScreen == KdTsPhyScreen) {
- flags = KD_BUTTON_1;
- x = event.x;
- y = event.y;
- }
- else
- {
- flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA;
- if ((lastx == 0) || (lasty == 0)) {
- x = 0;
- y = 0;
- } else {
- x = event.x - lastx;
- y = event.y - lasty;
- }
- lastx = event.x;
- lasty = event.y;
- }
- } else {
- flags = KD_MOUSE_DELTA;
- x = 0;
- y = 0;
- lastx = 0;
- lasty = 0;
- }
- KdEnqueuePointerEvent (pi, flags, x, y, 0);
- }
-}
-
-char *TsNames[] = {
- "/dev/ts",
- "/dev/h3600_ts" /* temporary name; note this code can try
- to open more than one device */
-};
-
-#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
-
-static Status
-TsInit (KdPointerInfo *pi)
-{
- int i;
- int fd;
- int n = 0;
-
- if (!pi->path || strcmp(pi->path, "auto") == 0) {
- for (i = 0; i < NUM_TS_NAMES; i++) {
- fd = open (TsNames[i], 0);
- if (fd >= 0) {
- pi->path = KdSaveString (TsNames[i]);
- break;
- }
- }
- }
- else {
- fd = open (pi->path, 0);
- }
-
- if (fd < 0) {
- ErrorF("TsInit: Couldn't open %s\n", pi->path);
- return BadMatch;
- }
- close(fd);
-
- pi->name = KdSaveString("H3600 Touchscreen");
-
- return Success;
-}
-
-static Status
-TsEnable (KdPointerInfo *pi)
-{
- int fd;
-
- if (!pi || !pi->path)
- return BadImplementation;
-
- fd = open(pi->path, 0);
-
- if (fd < 0) {
- ErrorF("TsInit: Couldn't open %s\n", pi->path);
- return BadMatch;
- }
-
- struct h3600_ts_calibration cal;
- /*
- * Check to see if this is a touch screen
- */
- if (ioctl (fd, TS_GET_CAL, &cal) != -1) {
- mi->driverPrivate = (void *) fd;
- if (!KdRegisterFd (fd, TsRead, (void *) mi)) {
- close(fd);
- return BadAlloc;
- }
- }
- else {
- ErrorF("TsEnable: %s is not a touchscreen\n", pi->path);
- close (fd);
- return BadMatch;
- }
-
- return Success;
-}
-
-static void
-TsFini (KdPointerInfo *pi)
-{
- KdUnregisterFds (pi, (int)pi->driverPrivate, TRUE);
- mi->driverPrivate = NULL;
-}
-
-KdPointerDriver TsDriver = {
- TsInit,
- TsEnable,
- TsDisable,
- TsFini,
- NULL,
-};
diff --git a/xorg-server/hw/kdrive/linux/tslib.c b/xorg-server/hw/kdrive/linux/tslib.c
index 371aeced9..e0e860e48 100644
--- a/xorg-server/hw/kdrive/linux/tslib.c
+++ b/xorg-server/hw/kdrive/linux/tslib.c
@@ -95,8 +95,8 @@ TsRead (int fd, void *closure)
y = event.y - private->lasty;
}
}
- private->lastx = x;
- private->lasty = y;
+ private->lastx = event.x;
+ private->lasty = event.y;
} else {
flags = 0;
x = private->lastx;
@@ -114,6 +114,10 @@ TslibEnable (KdPointerInfo *pi)
private->raw_event_hook = NULL;
private->raw_event_closure = NULL;
+ if (!pi->path) {
+ pi->path = "/dev/input/touchscreen0";
+ ErrorF("[tslib/TslibEnable] no device path given, trying %s\n", pi->path);
+ }
private->tsDev = ts_open(pi->path, 0);
private->fd = ts_fd(private->tsDev);
if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {