summaryrefslogtreecommitdiff
path: root/driver/openbsd-input-usbtablet
diff options
context:
space:
mode:
Diffstat (limited to 'driver/openbsd-input-usbtablet')
-rw-r--r--driver/openbsd-input-usbtablet/Makefile.am17
-rw-r--r--driver/openbsd-input-usbtablet/Makefile.bsd-wrapper3
-rw-r--r--driver/openbsd-input-usbtablet/autogen.sh12
-rw-r--r--driver/openbsd-input-usbtablet/configure.ac92
-rw-r--r--driver/openbsd-input-usbtablet/man/Makefile.am45
-rw-r--r--driver/openbsd-input-usbtablet/man/Makefile.in406
-rw-r--r--driver/openbsd-input-usbtablet/man/usbtablet.man104
-rw-r--r--driver/openbsd-input-usbtablet/src/Makefile.am21
-rw-r--r--driver/openbsd-input-usbtablet/src/Makefile.in491
-rw-r--r--driver/openbsd-input-usbtablet/src/usbtablet.c1038
10 files changed, 2229 insertions, 0 deletions
diff --git a/driver/openbsd-input-usbtablet/Makefile.am b/driver/openbsd-input-usbtablet/Makefile.am
new file mode 100644
index 000000000..52b7eba15
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/Makefile.am
@@ -0,0 +1,17 @@
+#
+# Copyright (c) 2006 Matthieu Herrb
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, 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.
+#
+AUTOMAKE_OPTIONS= foreign
+SUBDIRS= src man
diff --git a/driver/openbsd-input-usbtablet/Makefile.bsd-wrapper b/driver/openbsd-input-usbtablet/Makefile.bsd-wrapper
new file mode 100644
index 000000000..b0057c567
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/Makefile.bsd-wrapper
@@ -0,0 +1,3 @@
+# $Xenocara: Makefile.bsd-wrapper,v 1.2 2006/04/17 13:31:18 matthieu Exp $
+
+.include <bsd.xorg.mk>
diff --git a/driver/openbsd-input-usbtablet/autogen.sh b/driver/openbsd-input-usbtablet/autogen.sh
new file mode 100644
index 000000000..904cd6746
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/autogen.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/driver/openbsd-input-usbtablet/configure.ac b/driver/openbsd-input-usbtablet/configure.ac
new file mode 100644
index 000000000..95ee0f21f
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/configure.ac
@@ -0,0 +1,92 @@
+# Copyright 2005 Adam Jackson.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Process this file with autoconf to produce a configure script
+
+AC_PREREQ(2.57)
+AC_INIT([openbsd-input-usbtablet],
+ 1.0,
+ [http://www.openbsd.org/],
+ openbsd-input-usbtablet)
+
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE([dist-bzip2])
+
+AM_MAINTAINER_MODE
+
+DRIVER_NAME=usbtablet
+AC_SUBST([DRIVER_NAME])
+
+AM_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_PROG_CC
+
+AH_TOP([#include "xorg-server.h"])
+
+#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers])
+#
+AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput],
+ [Build XInput support (default: yes)]),
+ [XINPUT=$enableval],[XINPUT=yes])
+AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes")
+if test "x$XINPUT" = "xyes" ; then
+ AC_DEFINE(XINPUT,1,[Enable XInput support])
+fi
+#
+#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb],
+# [Build XKB support (default: yes)]),
+# [XKB=$enableval],[XKB=yes])
+#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes")
+#if test "x$XKB" = "xyes" ; then
+# AC_DEFINE(XKB,1,[Enable XKB support])
+#fi
+
+AC_ARG_WITH(xorg-module-dir,
+ AC_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+inputdir=${moduledir}/input
+AC_SUBST(inputdir)
+
+# Checks for extensions
+# XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
+
+# Checks for pkg-config packages
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto $REQUIRED_MODULES)
+sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+
+CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
+AC_SUBST([CFLAGS])
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+
+XORG_MANPAGE_SECTIONS
+XORG_RELEASE_VERSION
+
+AC_OUTPUT([Makefile src/Makefile man/Makefile])
diff --git a/driver/openbsd-input-usbtablet/man/Makefile.am b/driver/openbsd-input-usbtablet/man/Makefile.am
new file mode 100644
index 000000000..fe8810dfe
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/man/Makefile.am
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2006 Matthieu Herrb
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, 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.
+#
+drivermandir= $(DRIVER_MAN_DIR)
+driverman_PRE= @DRIVER_NAME@.man
+driverman_DATA= $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+
+EXTRA_DIST= @DRIVER_NAME@.man
+
+CLEANFILES= $(driverman_DATA)
+
+SED= sed
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+ XORGMANNAME = X Version 11
+
+MAN_SUBSTS = \
+ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__xservername__|Xorg|g' \
+ -e 's|__xconfigfile__|xorg.conf|g' \
+ -e 's|__projectroot__|$(prefix)|g' \
+ -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+ -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+ -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+ -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+.man.$(DRIVER_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
diff --git a/driver/openbsd-input-usbtablet/man/Makefile.in b/driver/openbsd-input-usbtablet/man/Makefile.in
new file mode 100644
index 000000000..8d33596c6
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/man/Makefile.in
@@ -0,0 +1,406 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(drivermandir)"
+drivermanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(driverman_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRIVER_NAME = @DRIVER_NAME@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XINPUT_FALSE = @XINPUT_FALSE@
+XINPUT_TRUE = @XINPUT_TRUE@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_LIBS = @XORG_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+inputdir = @inputdir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+#
+# Copyright (c) 2006 Matthieu Herrb
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, 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.
+#
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_PRE = @DRIVER_NAME@.man
+driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+EXTRA_DIST = @DRIVER_NAME@.man
+CLEANFILES = $(driverman_DATA)
+SED = sed
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+MAN_SUBSTS = \
+ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__xservername__|Xorg|g' \
+ -e 's|__xconfigfile__|xorg.conf|g' \
+ -e 's|__projectroot__|$(prefix)|g' \
+ -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+ -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+ -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+ -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .$(DRIVER_MAN_SUFFIX) .man
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-drivermanDATA: $(driverman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(drivermandir)" || $(mkdir_p) "$(DESTDIR)$(drivermandir)"
+ @list='$(driverman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(drivermanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(drivermandir)/$$f'"; \
+ $(drivermanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(drivermandir)/$$f"; \
+ done
+
+uninstall-drivermanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(driverman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(drivermandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(drivermandir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(drivermandir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-drivermanDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-drivermanDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-drivermanDATA \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am uninstall uninstall-am uninstall-drivermanDATA \
+ uninstall-info-am
+
+
+.man.$(DRIVER_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/driver/openbsd-input-usbtablet/man/usbtablet.man b/driver/openbsd-input-usbtablet/man/usbtablet.man
new file mode 100644
index 000000000..e20a3e45e
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/man/usbtablet.man
@@ -0,0 +1,104 @@
+.\" $OpenBSD: usbtablet.man,v 1.1 2006/11/26 22:29:39 matthieu Exp $
+.\"
+.\" Copyright (c) 1999-2004 Matthieu Herrb and Lennart Augustsson
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH USBTABLET __drivermansuffix__ __vendorversion__
+.SH NAME
+usbtablet \- USB tablet input driver for *BSD
+.SH SYNOPSIS
+.nf
+.B "Section \*qInputDevice\*q"
+.BI " Identifier \*q" idevname \*q
+.B " Driver \*qusbtablet\*q"
+.BI " Option \*qDevice\*q \*q" devpath \*q
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B usbtablet
+is an XFree86 input driver for USB tablet devices.
+.PP
+The
+.B usbtablet
+driver functions as a pointer input device, and may be used as the
+X server's core pointer.
+.SH SUPPORTED HARDWARE
+This driver supports most USB tablets like the Wacom Graphire or
+PenPartner tablets.
+.SH CONFIGURATION DETAILS
+Please refer to xorg.conf(__filemansuffix__) for general configuration
+details and for options that can be used with all input drivers. This
+section only covers configuration details specific to this driver.
+.PP
+Each device
+supports the following entries:
+.RS 8
+.TP 4
+.B Option \fI"Type"\fP \fI"stylus"|"eraser"|"cursor"\fP
+sets the type of tool the device represent. This option is mandatory.
+.TP 4
+.B Option \fI"Device"\fP \fI"path"\fP
+sets the path to the special file which represents serial line where
+the tablet is plugged. You have to specify it for each subsection with
+the same value if you want to have multiple devices with the same tablet.
+This option is mandatory.
+.TP 4
+.B Option \fI"Suppress"\fP \fI"Inumber"\fP
+sets the position increment under which not to transmit coordinates.
+ If you don't specify this entry, the default value is 2.
+.TP 4
+.B Option \fI"Threshold"\fP \fI"number"\fP
+sets the pressure threshold used to generate a button 1 events of stylus
+devices. The default value is 5.
+.TP 4
+.B Option \fI"Mode"\fP \fI"Relative"|"Absolute"\fP
+sets the mode of the device.
+.TP 4
+.B Option \fI"HistorySize"\fP \fI"number"\fP
+sets the motion history size. By default the value is zero.
+.TP 4
+.B Option \fI"FactorX"\fP \fI"number"\fP
+Scaling factor between tablet coordinates and X screen coordinates. If
+you don't specify it, it will be calculated to match the width of your
+tablet to the width of your screen.
+.TP 4
+.B Option \fI"FactorY"\fP \fI"number"\fP
+Scaling factor between tablet coordinates and X screen coordinates. If
+you don't specify it, it will be calculated to match the height of your
+tablet to the height of your screen.
+.TP 4
+.TP 4
+.B Option \fI"DebugLevel"\fP \fInumber \fP
+sets the level of debugging info reported.
+.TP 4
+.RE
+.SH "SEE ALSO"
+Xorg(1), xorg.conf(__filemansuffix__), Xserver(1), X(__miscmansuffix__).
+.SH AUTHORS
+Lennart Augustsson <augustss@netbsd.org> wrote the original version
+for XFree86 3.3.6, Matthieu Herrb <matthieu@openbsd.org> adapted it to
+XFree86 4.x.
+
diff --git a/driver/openbsd-input-usbtablet/src/Makefile.am b/driver/openbsd-input-usbtablet/src/Makefile.am
new file mode 100644
index 000000000..8da7a06fe
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/src/Makefile.am
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2006 Matthieu Herrb
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, 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.
+#
+
+@DRIVER_NAME@_drv_la_LTLIBRARIES= @DRIVER_NAME@_drv.la
+@DRIVER_NAME@_drv_la_LDFLAGS= -module -avoid-version
+@DRIVER_NAME@_drv_ladir= @inputdir@
+
+@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c
diff --git a/driver/openbsd-input-usbtablet/src/Makefile.in b/driver/openbsd-input-usbtablet/src/Makefile.in
new file mode 100644
index 000000000..3c5008266
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/src/Makefile.in
@@ -0,0 +1,491 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# Copyright (c) 2006 Matthieu Herrb
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, 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.
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)"
+@DRIVER_NAME@_drv_laLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(@DRIVER_NAME@_drv_la_LTLIBRARIES)
+@DRIVER_NAME@_drv_la_LIBADD =
+am_@DRIVER_NAME@_drv_la_OBJECTS = @DRIVER_NAME@.lo
+@DRIVER_NAME@_drv_la_OBJECTS = $(am_@DRIVER_NAME@_drv_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+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 --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(@DRIVER_NAME@_drv_la_SOURCES)
+DIST_SOURCES = $(@DRIVER_NAME@_drv_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRIVER_NAME = @DRIVER_NAME@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XINPUT_FALSE = @XINPUT_FALSE@
+XINPUT_TRUE = @XINPUT_TRUE@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_LIBS = @XORG_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+inputdir = @inputdir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
+@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
+@DRIVER_NAME@_drv_ladir = @inputdir@
+@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-@DRIVER_NAME@_drv_laLTLIBRARIES: $(@DRIVER_NAME@_drv_la_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(@DRIVER_NAME@_drv_ladir)" || $(mkdir_p) "$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)"
+ @list='$(@DRIVER_NAME@_drv_la_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(@DRIVER_NAME@_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(@DRIVER_NAME@_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-@DRIVER_NAME@_drv_laLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(@DRIVER_NAME@_drv_la_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)/$$p"; \
+ done
+
+clean-@DRIVER_NAME@_drv_laLTLIBRARIES:
+ -test -z "$(@DRIVER_NAME@_drv_la_LTLIBRARIES)" || rm -f $(@DRIVER_NAME@_drv_la_LTLIBRARIES)
+ @list='$(@DRIVER_NAME@_drv_la_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+@DRIVER_NAME@_drv.la: $(@DRIVER_NAME@_drv_la_OBJECTS) $(@DRIVER_NAME@_drv_la_DEPENDENCIES)
+ $(LINK) -rpath $(@DRIVER_NAME@_drv_ladir) $(@DRIVER_NAME@_drv_la_LDFLAGS) $(@DRIVER_NAME@_drv_la_OBJECTS) $(@DRIVER_NAME@_drv_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/@DRIVER_NAME@.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-@DRIVER_NAME@_drv_laLTLIBRARIES clean-generic \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-@DRIVER_NAME@_drv_laLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-@DRIVER_NAME@_drv_laLTLIBRARIES \
+ uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-@DRIVER_NAME@_drv_laLTLIBRARIES clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install \
+ install-@DRIVER_NAME@_drv_laLTLIBRARIES install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-@DRIVER_NAME@_drv_laLTLIBRARIES \
+ uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/driver/openbsd-input-usbtablet/src/usbtablet.c b/driver/openbsd-input-usbtablet/src/usbtablet.c
new file mode 100644
index 000000000..cbb78e893
--- /dev/null
+++ b/driver/openbsd-input-usbtablet/src/usbtablet.c
@@ -0,0 +1,1038 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $OpenBSD: usbtablet.c,v 1.1 2006/11/26 22:29:40 matthieu Exp $ */
+
+/*
+ * Driver for USB HID tablet devices.
+ * Works for:
+ * Wacom PenPartner
+ * Wacom Graphire
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <unistd.h>
+#include <errno.h>
+
+#include <dev/usb/usb.h>
+#include <dev/usb/usbhid.h>
+
+#include <misc.h>
+#include <xf86.h>
+#include <xf86_OSproc.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <xf86Xinput.h>
+#include <xisb.h>
+#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
+#include <extnsionst.h>
+#include <extinit.h>
+
+#ifdef XFree86LOADER
+#include "xf86Module.h"
+#endif
+
+
+#ifdef USB_GET_REPORT_ID
+#define USB_NEW_HID
+#endif
+
+#include <usbhid.h>
+
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+#define ABS(x) ((x) > 0 ? (x) : -(x))
+#define mils(res) (res * 1000 / 2.54) /* resolution */
+
+#define STYLUS_SEC "usbstylus" /* config section name */
+#define STYLUS_XI "Stylus" /* X device name for the stylus */
+#define STYLUS_ID 1 /* local id */
+
+#define ERASER_SEC "usberaser" /* config section name */
+#define ERASER_XI "Eraser" /* X device name for the stylus */
+#define ERASER_ID 2 /* local id */
+
+#define ABSOLUTE_FLAG 0x10000
+
+#define NBUTTONS 4
+#define NAXES 5 /* X, Y, Pressure, Tilt-X, Tilt-Y */
+
+typedef struct USBTDevice USBTDevice, *USBTDevicePtr;
+
+typedef struct {
+ char *devName;
+ int nDevs;
+ InputInfoPtr *devices;
+ double factorX;
+ double factorY;
+ hid_item_t hidX;
+ hid_item_t hidY;
+ hid_item_t hidTiltX;
+ hid_item_t hidTiltY;
+ hid_item_t hidIn_Range;
+ hid_item_t hidTip_Pressure;
+ hid_item_t hidBarrel_Switch[NBUTTONS];
+ hid_item_t hidInvert;
+ int reportSize;
+ int reportId;
+ int nSwitch;
+ USBTDevicePtr currentProxDev;
+} USBTCommon, *USBTCommonPtr;
+
+typedef struct {
+ int x, y, pressure, buttons, xTilt, yTilt, proximity;
+} USBTState;
+
+struct USBTDevice {
+ USBTCommonPtr comm;
+ USBTDevicePtr next;
+ InputInfoPtr info;
+ USBTState state;
+ int threshold;
+ int thresCent;
+ int suppress;
+ int flags;
+};
+
+/* Function prototypes */
+#ifdef XFree86LOADER
+static MODULESETUPPROTO(SetupProc);
+static void TearDownProc(pointer);
+static const OptionInfoRec *UsbTabletAvailableOptions(void *);
+#endif
+
+static LocalDevicePtr UsbTabletAllocateStylus(InputDriverPtr);
+static LocalDevicePtr UsbTabletAllocateEraser(InputDriverPtr);
+static LocalDevicePtr UsbTabletAllocate(InputDriverPtr, char *, int);
+static InputInfoPtr UsbTabletPreInit(InputDriverPtr, IDevPtr, int);
+static int UsbTabletProc(DeviceIntPtr, int);
+static void UsbTabletReadInput(InputInfoPtr);
+static int UsbTabletChangeControl(InputInfoPtr, xDeviceCtl *);
+static int UsbTabletSwitchMode(ClientPtr, DeviceIntPtr, int);
+static void UsbTabletClose(InputInfoPtr);
+static Bool UsbTabletConvert(InputInfoPtr, int, int, int, int, int,
+ int, int, int, int *, int *);
+static Bool UsbTabletReverseConvert(InputInfoPtr, int, int, int *);
+static void UsbTabletControlProc(DeviceIntPtr, PtrCtrl *);
+static int UsbTabletOpenDevice(DeviceIntPtr);
+static void UsbTabletSendEvents(InputInfoPtr, int, USBTState *);
+static void UsbTabletSendButtons(InputInfoPtr, int, int, int, int, int, int);
+static void UsbTabletOutOfProx(USBTDevicePtr prx);
+static void UsbTabletIntoProx(USBTDevicePtr prx, USBTState *ds);
+
+
+#ifdef XFree86LOADER
+static XF86ModuleVersionInfo VersionRec = {
+ "usbtablet",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_XINPUT,
+ ABI_XINPUT_VERSION,
+ MOD_CLASS_XINPUT,
+ {0, 0, 0, 0} /* signature to be patched into the file */
+};
+#endif
+
+typedef enum {
+ USBTOPT_DEVICE,
+ USBTOPT_DEBUG_LEVEL,
+ USBTOPT_HISTORY_SIZE,
+ USBTOPT_THRESHOLD,
+ USBTOPT_SUPPRESS,
+} USBTOpts;
+
+static const OptionInfoRec USBTOptions[] = {
+ { USBTOPT_DEVICE, "device", OPTV_STRING, {0}, FALSE },
+ { USBTOPT_DEBUG_LEVEL, "debuglevel", OPTV_INTEGER, {0}, FALSE},
+ { USBTOPT_HISTORY_SIZE, "historysize", OPTV_INTEGER, {0}, FALSE},
+ { USBTOPT_THRESHOLD, "threshold", OPTV_INTEGER, {0}, FALSE},
+ { USBTOPT_SUPPRESS, "suppress", OPTV_INTEGER, {0}, FALSE},
+ { -1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+
+#ifdef XFree86LOADER
+
+XF86ModuleData usbtabletModuleData = {&VersionRec,
+ SetupProc, TearDownProc };
+
+ModuleInfoRec UsbTabletInfo = {
+ 1,
+ "USBTABLET",
+ NULL,
+ 0,
+ UsbTabletAvailableOptions,
+};
+
+#endif
+
+InputDriverRec USBTABLET = {
+ 1,
+ "usbtablet",
+ NULL,
+ UsbTabletPreInit,
+ NULL,
+ 0
+};
+
+/*
+ * Debugging macro
+ */
+#ifdef DBG
+#undef DBG
+#endif
+#ifdef DEBUG
+#undef DEBUG
+#endif
+
+static int debug_level = 0;
+#define DEBUG 1
+#if DEBUG
+#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
+#else
+#define DBG(lvl, f)
+#endif
+
+
+/**
+ ** Function definitions
+ **/
+
+#ifdef XFree86LOADER
+static pointer
+SetupProc(pointer module,
+ pointer options,
+ int *errmaj,
+ int *errmin)
+{
+ static Bool Initialised = FALSE;
+
+ if (!Initialised) {
+ Initialised = TRUE;
+#ifndef REMOVE_LOADER_CHECK_MODULE_INFO
+ if (xf86LoaderCheckSymbol("xf86AddModuleInfo"))
+#endif
+ xf86AddModuleInfo(&UsbTabletInfo, module);
+
+ xf86Msg(X_INFO, "USB Tablet driver\n");
+ xf86AddInputDriver(&USBTABLET, module, 0);
+ }
+ return module;
+}
+
+static void
+TearDownProc(pointer p)
+{
+ DBG(1, ErrorF("USB Tablet TearDownProc Called\n"));
+}
+
+#endif /* XFree86LOADER */
+
+static int
+UsbTabletProc(DeviceIntPtr pUSBT, int what)
+{
+ InputInfoPtr pInfo = (InputInfoPtr)pUSBT->public.devicePrivate;
+ USBTDevicePtr priv = (USBTDevicePtr)XI_PRIVATE(pUSBT);
+ CARD8 map[NBUTTONS+1];
+ int i;
+
+ switch (what) {
+ case DEVICE_INIT:
+ DBG(1, ErrorF("UsbTabletProc DEVICE_INIT\n"));
+ pUSBT->public.on = FALSE;
+ for (i = 1; i <= NBUTTONS; i++) {
+ map[i] = i;
+ }
+ if (InitButtonClassDeviceStruct(pUSBT,
+ NBUTTONS,
+ map) == FALSE) {
+ xf86Msg(X_ERROR,
+ "unable to allocate Button class device\n");
+ return !Success;
+ }
+ if (InitFocusClassDeviceStruct(pUSBT) == FALSE) {
+ xf86Msg(X_ERROR,
+ "unable to init Focus class device\n");
+ return !Success;
+ }
+
+ if (InitPtrFeedbackClassDeviceStruct(pUSBT,
+ UsbTabletControlProc) == FALSE) {
+ xf86Msg(X_ERROR, "unable to init ptr feedback\n");
+ return !Success;
+ }
+
+ if (InitProximityClassDeviceStruct(pUSBT) == FALSE) {
+ xf86Msg(X_ERROR,
+ "unable to init proximity class device\n");
+ return !Success;
+ }
+
+ if (InitValuatorClassDeviceStruct(
+ pUSBT, NAXES, xf86GetMotionEvents,
+ pInfo->history_size,
+ ((priv->flags & ABSOLUTE_FLAG) ? Absolute : Relative) |
+ OutOfProximity) == FALSE) {
+ xf86Msg(X_ERROR,
+ "unable to allocate Valuator class device\n");
+ return !Success;
+ } else {
+ /* allocate the motion history buffer if needed */
+ xf86MotionHistoryAllocate(pInfo);
+
+ AssignTypeAndName(pUSBT, pInfo->atom, pInfo->name);
+ }
+
+ /* open the device to gather informations */
+ UsbTabletOpenDevice(pUSBT);
+ break;
+
+ case DEVICE_ON:
+ DBG(1, ErrorF("UsbTabletProc DEVICE_ON\n"));
+ if ((pInfo->fd < 0) && (!UsbTabletOpenDevice(pUSBT))) {
+ return !Success;
+ }
+ xf86AddEnabledDevice(pInfo);
+ pUSBT->public.on = TRUE;
+
+ break;
+ case DEVICE_OFF:
+ DBG(1, ErrorF("UsbTabletProc DEVICE_OFF\n"));
+ if (pInfo->fd >= 0) {
+ xf86RemoveEnabledDevice(pInfo);
+ UsbTabletClose(pInfo);
+ }
+ pUSBT->public.on = FALSE;
+ break;
+
+ case DEVICE_CLOSE:
+ DBG(1, ErrorF("UsbTabletProc DEVICE_CLOSE\n"));
+ UsbTabletClose(pInfo);
+ break;
+
+ default:
+ xf86Msg(X_ERROR, "UsbTabletProc: unsupported mode %d\n",
+ what);
+ return !Success;
+ } /* switch */
+ return Success;
+}
+
+static void
+UsbTabletReadInput(InputInfoPtr pInfo)
+{
+ USBTDevicePtr priv = (USBTDevicePtr)pInfo->private;
+ USBTCommonPtr comm = priv->comm;
+ int invert, len, i;
+ unsigned char buffer[200], *p;
+ USBTState ds;
+
+ DBG(7, ErrorF("UsbTabletReadInput BEGIN device=%s fd=%d\n",
+ comm->devName, pInfo->fd));
+
+ for(;;) {
+ p = buffer;
+ DBG(10, ErrorF("UsbTabletReadInput reading fd=%d len=%d\n",
+ pInfo->fd, comm->reportSize));
+
+ len = xf86ReadSerial(pInfo->fd, p, comm->reportSize);
+#ifdef XFree86LOADER
+ /* XXX there's a bug in XFree86 4.1 that requires this magic */
+ /* It's fixed in 4.2 */
+ errno = xf86GetErrno();
+#endif
+ DBG(8, ErrorF("UsbTabletReadInput len=%d\n", len));
+
+ if (len <= 0) {
+ if (errno != EAGAIN) {
+ Error("error reading USBT device");
+ }
+ break;
+ }
+
+#ifndef USB_NEW_HID
+ if (comm->reportId)
+ p++;
+#endif
+ ds.x = hid_get_data(p, &comm->hidX);
+ ds.y = hid_get_data(p, &comm->hidY);
+ ds.buttons = 0;
+ for (i = 0; i < comm->nSwitch; i++) {
+ if (hid_get_data(p, &comm->hidBarrel_Switch[i])) {
+ ds.buttons |= (1 << (i+1));
+ }
+ }
+ invert = hid_get_data(p, &comm->hidInvert);
+ ds.pressure = hid_get_data(p, &comm->hidTip_Pressure);
+ if (ds.pressure > priv->threshold)
+ ds.buttons |= 1;
+ ds.proximity = hid_get_data(p, &comm->hidIn_Range);
+ ds.xTilt = hid_get_data(p, &comm->hidTiltX);
+ ds.yTilt = hid_get_data(p, &comm->hidTiltY);
+
+ if (!ds.proximity)
+ UsbTabletOutOfProx(comm->currentProxDev);
+
+ for (i = 0; i < comm->nDevs; i++) {
+ DBG(7, ErrorF("UsbTabletReadInput sending to %s\n",
+ comm->devices[i]->name));
+
+ UsbTabletSendEvents(comm->devices[i], invert, &ds);
+ }
+ }
+ DBG(7, ErrorF("UsbTabletReadInput END pInfo=%p priv=%p\n",
+ pInfo, priv));
+}
+
+static void
+UsbTabletOutOfProx(USBTDevicePtr prx)
+{
+ USBTState *ods;
+
+ if (!prx)
+ return;
+
+ DBG(1, ErrorF("Out of proximity %s\n", prx->info->name));
+
+ ods = &prx->state;
+ prx->comm->currentProxDev = 0;
+
+ if (prx->state.buttons) {
+ /* Report buttons up when the device goes out of proximity. */
+ DBG(9, ErrorF("xf86USBTOutOfProx: reset buttons\n"));
+ UsbTabletSendButtons(prx->info, 0,
+ ods->x, ods->y, ods->pressure,
+ ods->xTilt, ods->yTilt);
+ prx->state.buttons = 0;
+ }
+ if (!xf86IsCorePointer(prx->info->dev)) {
+ DBG(1, ErrorF("xf86USBTSendEvents: out proximity\n"));
+ xf86PostProximityEvent(prx->info->dev, 0, 0, 5,
+ ods->x, ods->y, ods->pressure,
+ ods->xTilt, ods->yTilt);
+ }
+}
+
+static void
+UsbTabletIntoProx(USBTDevicePtr prx, USBTState *ds)
+{
+ if (prx->comm->currentProxDev == prx)
+ return;
+ UsbTabletOutOfProx(prx->comm->currentProxDev);
+ prx->comm->currentProxDev = prx;
+
+ DBG(1, ErrorF("Into proximity %s\n", prx->info->name));
+
+ if (!xf86IsCorePointer(prx->info->dev)) {
+ DBG(1, ErrorF("xf86USBTSendEvents: in proximity\n"));
+ xf86PostProximityEvent(prx->info->dev, 1, 0, 5,
+ ds->x, ds->y, ds->pressure,
+ ds->xTilt, ds->yTilt);
+ }
+
+}
+
+static void
+UsbTabletSendButtons(InputInfoPtr pInfo, int buttons,
+ int rx, int ry, int rz,
+ int rtx, int rty)
+{
+ USBTDevicePtr priv = (USBTDevicePtr) pInfo->private;
+ int button, mask;
+
+ for (button = 1; button < NBUTTONS; button++) {
+ mask = 1 << (button-1);
+
+ if ((mask & priv->state.buttons) != (mask & buttons)) {
+ DBG(4, ErrorF("UsbTabletSendButtons button=%d is %d\n",
+ button, (buttons & mask) != 0));
+ xf86PostButtonEvent(pInfo->dev,
+ (priv->flags & ABSOLUTE_FLAG),
+ button, (buttons & mask) != 0,
+ 0, 5, rx, ry, rz, rtx, rty);
+ }
+ }
+}
+
+static void
+UsbTabletSendEvents(InputInfoPtr pInfo, int invert, USBTState *ds)
+{
+ USBTDevicePtr priv = (USBTDevicePtr)pInfo->private;
+ USBTState *ods = &priv->state;
+ int is_abs;
+ int rx, ry, rz, rtx, rty;
+
+ DBG(9, ErrorF("UsbTabletSendEvents %s x=%d y=%d pressure=%d buttons=%x "
+ "xTilt=%d yTilt=%d proximity=%d, invert=%d, eraser=%d\n",
+ pInfo->name,
+ ds->x, ds->y, ds->pressure, ds->buttons,
+ ds->xTilt, ds->yTilt, ds->proximity,
+ invert, (priv->flags & ERASER_ID) != 0));
+
+ if (!ds->proximity)
+ return;
+ if (((priv->flags & ERASER_ID) != 0) != invert)
+ return;
+
+ UsbTabletIntoProx(priv, ds);
+
+ if (ds->buttons == ods->buttons && ds->proximity == ods->proximity &&
+ ABS(ds->x - ods->x) < priv->suppress &&
+ ABS(ds->y - ods->y) < priv->suppress &&
+ ds->pressure == ods->pressure &&
+ ds->xTilt == ods->xTilt &&
+ ds->yTilt == ods->yTilt) {
+ DBG(9, ErrorF("UsbTabletSendEvents no change\n"));
+ return;
+ }
+ is_abs = 1;
+ rx = ds->x; ry = ds->y; rz = ds->pressure;
+ rtx = ds->xTilt; rty = ds->yTilt;
+
+ if (rx != ods->x || ry != ods->y || rz != ods->pressure ||
+ rtx != ods->xTilt || rty != ods->yTilt) {
+ DBG(9, ErrorF("UsbTabletSendEvents: motion\n"));
+ xf86PostMotionEvent(pInfo->dev, is_abs, 0, 5,
+ rx, ry, rz, rtx, rty);
+
+ }
+ if (ds->buttons != ods->buttons)
+ UsbTabletSendButtons(pInfo, ds->buttons,
+ rx, ry, rz, rtx, rty);
+
+ *ods = *ds;
+}
+
+static int
+UsbTabletChangeControl(InputInfoPtr pInfo, xDeviceCtl *control)
+{
+ return BadMatch;
+}
+
+static int
+UsbTabletSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ return BadMatch;
+}
+
+static void
+UsbTabletClose(InputInfoPtr pInfo)
+{
+ USBTDevicePtr priv = (USBTDevicePtr)pInfo->private;
+ USBTCommonPtr comm = priv->comm;
+ int num, i;
+
+ for (num = 0, i = 0; i < comm->nDevs; i++)
+ if (comm->devices[i]->fd >= 0)
+ num++;
+ DBG(4, ErrorF("USB tablet number of open devices = %d\n", num));
+
+ if (num == 1) {
+ SYSCALL(close(pInfo->fd));
+ }
+
+ pInfo->fd = -1;
+}
+
+static Bool
+UsbTabletConvert(InputInfoPtr pInfo, int first, int num,
+ int v0, int v1, int v2, int v3, int v4, int v5,
+ int *x, int *y)
+{
+ USBTCommonPtr comm = ((USBTDevicePtr)pInfo->private)->comm;
+
+ DBG(6, ErrorF("UsbTabletConvert\n"));
+
+ if (first != 0 || num == 1)
+ return FALSE;
+
+ *x = v0 * comm->factorX;
+ *y = v1 * comm->factorY;
+
+ DBG(6, ErrorF("USB tablet converted v0=%d v1=%d to x=%d y=%d\n",
+ v0, v1, *x, *y));
+
+ return TRUE;
+}
+
+static Bool
+UsbTabletReverseConvert(InputInfoPtr pInfo, int x, int y,
+ int *valuators)
+{
+ USBTCommonPtr comm = ((USBTDevicePtr)pInfo->private)->comm;
+
+ valuators[0] = x / comm->factorX;
+ valuators[1] = y / comm->factorY;
+
+ DBG(6, ErrorF("USB tablet converted x=%d y=%d to v0=%d v1=%d\n", x, y,
+ valuators[0], valuators[1]));
+
+ return TRUE;
+}
+
+static void
+UsbTabletControlProc(DeviceIntPtr device, PtrCtrl *ctrl)
+{
+ DBG(2, ErrorF("UsbTabletControlProc\n"));
+}
+
+static Bool
+UsbTabletOpen(InputInfoPtr pInfo)
+{
+ USBTDevicePtr priv = (USBTDevicePtr)pInfo->private;
+ USBTCommonPtr comm = priv->comm;
+ hid_data_t d;
+ hid_item_t h;
+ report_desc_t rd;
+ int nSwitch = 0;
+#ifdef USB_NEW_HID
+ int r;
+#endif
+ int i;
+
+ DBG(1, ErrorF("opening %s\n", comm->devName));
+
+ /* Use this since O_NDELAY is not implemented by libc open wrapper */
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1) {
+ xf86Msg(X_ERROR, "Error opening %s: %s\n",
+ comm->devName, strerror(errno));
+ return !Success;
+ }
+#ifdef USB_NEW_HID
+ SYSCALL(r = ioctl(pInfo->fd, USB_GET_REPORT_ID, &comm->reportId));
+ if (r == -1) {
+ ErrorF("Error ioctl USB_GET_REPORT_ID on %s : %s\n",
+ comm->devName, strerror(errno));
+ return !Success;
+ }
+#endif
+
+ DBG(1, ErrorF("initializing tablet\n"));
+
+ rd = hid_get_report_desc(pInfo->fd);
+ if (rd == 0) {
+ Error(comm->devName);
+ SYSCALL(close(pInfo->fd));
+ return !Success;
+ }
+
+ memset(&comm->hidX, 0, sizeof (hid_item_t));
+ memset(&comm->hidY, 0, sizeof (hid_item_t));
+ memset(&comm->hidTiltX, 0, sizeof (hid_item_t));
+ memset(&comm->hidTiltY, 0, sizeof (hid_item_t));
+ memset(&comm->hidIn_Range, 0, sizeof (hid_item_t));
+ memset(&comm->hidInvert, 0, sizeof (hid_item_t));
+ memset(&comm->hidTip_Pressure, 0, sizeof (hid_item_t));
+ for (i = 0; i < NBUTTONS; i++) {
+ memset(&comm->hidBarrel_Switch[i], 0, sizeof (hid_item_t));
+ }
+ for (d = hid_start_parse(rd, 1<<hid_input
+#ifdef USB_NEW_HID
+ , comm->reportId
+#endif
+ ); hid_get_item(d, &h); ) {
+ if (h.kind != hid_input || (h.flags & HIO_CONST))
+ continue;
+ if (h.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X))
+ comm->hidX = h;
+ if (h.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y))
+ comm->hidY = h;
+ if (h.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUD_X_TILT))
+ comm->hidTiltX = h;
+ if (h.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUD_Y_TILT))
+ comm->hidTiltY = h;
+ if (h.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_INVERT))
+ comm->hidInvert = h;
+ if (h.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE))
+ comm->hidIn_Range = h;
+ if (h.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_PRESSURE))
+ comm->hidTip_Pressure = h;
+ if (h.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_BARREL_SWITCH))
+ comm->hidBarrel_Switch[nSwitch++] = h;
+ }
+ hid_end_parse(d);
+ comm->nSwitch = nSwitch;
+#ifdef USB_NEW_HID
+ comm->reportSize = hid_report_size(rd, hid_input, comm->reportId);
+#else
+ comm->reportSize = hid_report_size(rd, hid_input, &comm->reportId);
+#endif
+ hid_dispose_report_desc(rd);
+ if (comm->hidX.report_size == 0 ||
+ comm->hidY.report_size == 0 ||
+ comm->hidIn_Range.report_size == 0) {
+ xf86Msg(X_ERROR, "%s has no X, Y, or In_Range report\n",
+ comm->devName);
+ return !Success;
+ }
+ DBG(2, ErrorF("Found X at %d, size=%d\n",
+ comm->hidX.pos, comm->hidX.report_size));
+ DBG(2, ErrorF("Found Y at %d, size=%d\n",
+ comm->hidY.pos, comm->hidY.report_size));
+ DBG(2, ErrorF("Found Invert at %d, size=%d\n",
+ comm->hidInvert.pos, comm->hidInvert.report_size));
+ DBG(2, ErrorF("Found In_Range at %d, size=%d\n",
+ comm->hidIn_Range.pos, comm->hidIn_Range.report_size));
+ DBG(2, ErrorF("Found Tip_Pressure at %d, size=%d\n",
+ comm->hidTip_Pressure.pos,
+ comm->hidTip_Pressure.report_size));
+ for (i = 0; i < comm->nSwitch; i++) {
+ DBG(2, ErrorF("Found Barrel_Switch at %d, size=%d\n",
+ comm->hidBarrel_Switch[i].pos,
+ comm->hidBarrel_Switch[i].report_size));
+ }
+ DBG(2, ErrorF("Report size=%d, report id=%d\n",
+ comm->reportSize, comm->reportId));
+
+ comm->factorX = ((double) screenInfo.screens[0]->width)
+ / (comm->hidX.logical_maximum - comm->hidX.logical_minimum);
+ comm->factorY = ((double) screenInfo.screens[0]->height)
+ / (comm->hidY.logical_maximum - comm->hidY.logical_minimum);
+
+ xf86Msg(X_PROBED, "USBT tablet X=%d..%d, Y=%d..%d",
+ comm->hidX.logical_minimum,
+ comm->hidX.logical_maximum,
+ comm->hidY.logical_minimum,
+ comm->hidY.logical_maximum);
+ if (comm->hidTip_Pressure.report_size != 0)
+ xf86Msg(X_NONE, ", pressure=%d..%d",
+ comm->hidTip_Pressure.logical_minimum,
+ comm->hidTip_Pressure.logical_maximum);
+ xf86Msg(X_NONE, "\n");
+
+ return Success;
+}
+
+static int
+UsbTabletOpenDevice(DeviceIntPtr pUSBT)
+{
+ InputInfoPtr pInfo = (InputInfoPtr)pUSBT->public.devicePrivate;
+ USBTDevicePtr priv = (USBTDevicePtr)XI_PRIVATE(pUSBT);
+ USBTCommonPtr comm = priv->comm;
+ int i;
+
+ hid_item_t *h = &comm->hidTip_Pressure;
+
+ DBG(1, ErrorF("UsbTabletOpenDevice start\n"));
+ if (pInfo->fd < 0) {
+ DBG(2, ErrorF("UsbTabletOpenDevice really open\n"));
+ if (UsbTabletOpen(pInfo) != Success) {
+ if (pInfo->fd >= 0) {
+ SYSCALL(close(pInfo->fd));
+ }
+ pInfo->fd = -1;
+ return 0;
+ }
+ /* report the file descriptor to all devices */
+ for (i = 0; i < comm->nDevs; i++) {
+ comm->devices[i]->fd = pInfo->fd;
+ }
+ }
+
+ priv->threshold =
+ h->logical_minimum +
+ (h->logical_maximum - h->logical_minimum) * priv->thresCent / 100;
+ if (h->report_size != 0)
+ xf86Msg(X_PROBED,
+ "USBT %s pressure threshold=%d, suppress=%d\n",
+ pInfo->name, priv->threshold, priv->suppress);
+
+
+ /* Set the real values */
+ InitValuatorAxisStruct(pUSBT,
+ 0,
+ comm->hidX.logical_minimum, /* min val */
+ comm->hidX.logical_maximum, /* max val */
+ mils(1000), /* resolution */
+ 0, /* min_res */
+ mils(1000)); /* max_res */
+ InitValuatorAxisStruct(pUSBT,
+ 1,
+ comm->hidY.logical_minimum, /* min val */
+ comm->hidY.logical_maximum, /* max val */
+ mils(1000), /* resolution */
+ 0, /* min_res */
+ mils(1000)); /* max_res */
+ InitValuatorAxisStruct(pUSBT,
+ 2,
+ h->logical_minimum, /* min val */
+ h->logical_maximum, /* max val */
+ mils(1000), /* resolution */
+ 0, /* min_res */
+ mils(1000)); /* max_res */
+ InitValuatorAxisStruct(pUSBT,
+ 3,
+ comm->hidTiltX.logical_minimum, /* min val */
+ comm->hidTiltX.logical_maximum, /* max val */
+ mils(1000), /* resolution */
+ 0, /* min_res */
+ mils(1000)); /* max_res */
+ InitValuatorAxisStruct(pUSBT,
+ 4,
+ comm->hidTiltY.logical_minimum, /* min val */
+ comm->hidTiltY.logical_maximum, /* max val */
+ mils(1000), /* resolution */
+ 0, /* min_res */
+ mils(1000)); /* max_res */
+ return 1;
+}
+
+#ifdef XFree86LOADER
+static const OptionInfoRec *
+UsbTabletAvailableOptions(void *unused)
+{
+ return USBTOptions;
+}
+#endif
+static InputInfoPtr
+UsbTabletAllocate(InputDriverPtr drv, char *name, int flag)
+{
+ InputInfoPtr pInfo = xf86AllocateInput(drv, 0);
+ USBTDevicePtr priv;
+ USBTCommonPtr comm;
+
+ if (pInfo == NULL) {
+ return NULL;
+ }
+
+ priv = (USBTDevicePtr)xalloc(sizeof(USBTDevice));
+ if (priv == NULL) {
+ return NULL;
+ }
+
+ comm = (USBTCommonPtr)xalloc(sizeof(USBTCommon));
+ if (comm == NULL) {
+ xfree(priv);
+ return NULL;
+ }
+ memset(priv, 0, sizeof *priv);
+ memset(comm, 0, sizeof *comm);
+
+ pInfo->name = name;
+ pInfo->device_control = UsbTabletProc;
+ pInfo->read_input = UsbTabletReadInput;
+ pInfo->control_proc = UsbTabletChangeControl;
+ pInfo->switch_mode = UsbTabletSwitchMode;
+ pInfo->conversion_proc = UsbTabletConvert;
+ pInfo->reverse_conversion_proc = UsbTabletReverseConvert;
+ pInfo->fd = -1;
+ pInfo->private = priv;
+ pInfo->old_x = -1;
+ pInfo->old_y = -1;
+
+ priv->info = pInfo;
+ priv->comm = comm;
+ priv->flags = ABSOLUTE_FLAG | flag;
+ priv->suppress = 2;
+ priv->thresCent = 5;
+
+ comm->nDevs = 1;
+ comm->devices = (InputInfoPtr*)xalloc(sizeof(InputInfoPtr));
+ comm->devices[0] = pInfo;
+
+ return pInfo;
+}
+
+static InputInfoPtr
+UsbTabletAllocateStylus(InputDriverPtr drv)
+{
+ InputInfoPtr pInfo = UsbTabletAllocate(drv, STYLUS_XI, STYLUS_ID);
+
+ if (pInfo == NULL) {
+ return NULL;
+ }
+ pInfo->type_name = "USBT Stylus";
+ return pInfo;
+}
+
+static InputInfoPtr
+UsbTabletAllocateEraser(InputDriverPtr drv)
+{
+ InputInfoPtr pInfo = UsbTabletAllocate(drv, ERASER_XI, ERASER_ID);
+
+ if (pInfo == NULL) {
+ return NULL;
+ }
+ pInfo->type_name = "USBT Eraser";
+ return pInfo;
+}
+
+/*
+ * Called when the InputDevice Section is found in XF86Config
+ */
+static InputInfoPtr
+UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
+{
+ InputInfoPtr pInfo = NULL;
+ InputInfoPtr fake = NULL;
+ USBTCommonPtr comm = NULL, c;
+ USBTDevicePtr priv = NULL, p;
+ InputInfoPtr localDevices;
+ char *s;
+ int i;
+
+ fake = (InputInfoPtr)xcalloc(1, sizeof(InputInfoRec));
+ if (fake == NULL) {
+ return NULL;
+ }
+ fake->conf_idev = dev;
+ xf86CollectInputOptions(fake, NULL, NULL);
+ s = xf86FindOptionValue(fake->options, "Type");
+
+ if (s != NULL) {
+ if (xf86NameCmp(s, "stylus") == 0) {
+ pInfo = UsbTabletAllocateStylus(drv);
+ } else if (xf86NameCmp(s, "eraser") == 0) {
+ pInfo = UsbTabletAllocateEraser(drv);
+ } else {
+ xf86Msg(X_ERROR, "%s: Invalid type specified.\n"
+ "Must be one of stylus or eraser.\n",
+ dev->identifier);
+ goto PreInit_fail;
+ }
+ } else {
+ xf86Msg(X_ERROR, "%s: No type specified.\n", dev->identifier);
+ goto PreInit_fail;
+ }
+
+ if (pInfo == NULL) {
+ xfree(fake);
+ return NULL;
+ }
+
+
+ pInfo->options = fake->options;
+ pInfo->conf_idev = fake->conf_idev;
+ pInfo->name = dev->identifier;
+ xfree(fake);
+
+ priv = (USBTDevicePtr)pInfo->private;
+ comm = priv->comm;
+
+ comm->devName = xf86FindOptionValue(pInfo->options, "Device");
+ if (comm->devName == NULL) {
+ xf86Msg(X_ERROR, "%s: No Device specified.\n",
+ dev->identifier);
+ goto PreInit_fail;
+ }
+
+ /* Lookup to see if there is another device sharing
+ * the same device
+ */
+ localDevices = xf86FirstLocalDevice();
+
+ while (localDevices) {
+ p = (USBTDevicePtr)localDevices->private;
+ c = p->comm;
+
+ if ((pInfo != localDevices) &&
+ (localDevices->device_control == UsbTabletProc) &&
+ (strcmp(c->devName, comm->devName) == 0)) {
+ DBG(2, ErrorF("UsbTabletPreInit port share between"
+ " %s and %s\n",
+ pInfo->name, localDevices->name));
+ xfree(comm->devices);
+ xfree(comm);
+ comm = priv->comm = c;
+ comm->nDevs++;
+ comm->devices = (InputInfoPtr *)
+ xrealloc(comm->devices,
+ sizeof(InputInfoPtr)* comm->nDevs);
+ comm->devices[comm->nDevs - 1] = pInfo;
+ break;
+ }
+ localDevices = localDevices->next;
+ } /* while */
+
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ xf86Msg(X_CONFIG, "%s device is %s\n", dev->identifier, comm->devName);
+
+ /* XXX Handle options */
+ debug_level = xf86SetIntOption(pInfo->options, "DebugLevel",
+ debug_level);
+ if (debug_level > 0) {
+ xf86Msg(X_CONFIG, "UsbTablet: debug level set to %d\n",
+ debug_level);
+ }
+
+ s = xf86FindOptionValue(pInfo->options, "Mode");
+ if (s != NULL) {
+ if (xf86NameCmp(s, "absolute") == 0) {
+ priv->flags |= ABSOLUTE_FLAG;
+ } else if (xf86NameCmp(s, "relative") == 0) {
+ priv->flags &= ~ABSOLUTE_FLAG;
+ } else {
+ xf86Msg(X_ERROR, "%s: invalid Mode "
+ "(should be absolute or relative). "
+ "Using default.\n", dev->identifier);
+ }
+ }
+ xf86Msg(X_CONFIG, "%s is in %s mode\n", pInfo->name,
+ (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative");
+
+
+#if 0
+ pInfo->history_size = xf86SetIntOption(pInfo->options, "HistorySize",
+ pInfo->history_size);
+#endif
+ i = xf86SetIntOption(pInfo->options, "ThreshHold", -1);
+ if (i != -1) {
+ priv->thresCent = i;
+ }
+ xf86Msg(i != -1 ? X_CONFIG : X_DEFAULT, "%s: threshold = %d\n",
+ dev->identifier, priv->thresCent);
+
+
+ i = xf86SetIntOption(pInfo->options, "Suppress", -1);
+ if (i != -1) {
+ priv->suppress = i;
+ }
+ xf86Msg(i != -1 ? X_CONFIG : X_DEFAULT, "%s: suppress = %d\n",
+ dev->identifier, priv->suppress);
+
+
+ pInfo->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED;
+
+ return pInfo;
+
+PreInit_fail:
+ if (comm) {
+ xfree(comm);
+ }
+ if (priv) {
+ xfree(priv);
+ }
+ if (pInfo) {
+ xfree(pInfo);
+ }
+ return NULL;
+}