diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-11-05 13:49:27 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-11-05 13:49:27 +0000 |
commit | ed6e78439cd5002f49537e2e10c6da05029f543d (patch) | |
tree | 494965aefc1fdc13a023260ac59fac1874923b8f /driver/xf86-input-hyperpen | |
parent | 6cbb825417d75ed71edc85fc7950ff8eb407ad97 (diff) |
Update to xf86-input-hyperpen 1.4.1
Diffstat (limited to 'driver/xf86-input-hyperpen')
-rw-r--r-- | driver/xf86-input-hyperpen/AUTHORS | 8 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/Makefile.in | 8 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/aclocal.m4 | 758 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/configure | 209 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/configure.ac | 22 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/man/Makefile.in | 31 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/src/Makefile.in | 8 | ||||
-rw-r--r-- | driver/xf86-input-hyperpen/src/xf86HyperPen.c | 1476 |
8 files changed, 1418 insertions, 1102 deletions
diff --git a/driver/xf86-input-hyperpen/AUTHORS b/driver/xf86-input-hyperpen/AUTHORS new file mode 100644 index 000000000..e410a589d --- /dev/null +++ b/driver/xf86-input-hyperpen/AUTHORS @@ -0,0 +1,8 @@ +Based on the xf86Summa driver by Steven Lang <tiger@tyger.org> + +Modified for the Aiptek HyperPen 6000 / Tevion MD 9310 +by Roland Jansen <roland@lut.rwth-aachen.de> + +added button and 19200 bps stuff from the DigitalEdge driver on sourceforge +by Christian Herzog <daduke@dataway.ch> + diff --git a/driver/xf86-input-hyperpen/Makefile.in b/driver/xf86-input-hyperpen/Makefile.in index 596397f75..da77d3c97 100644 --- a/driver/xf86-input-hyperpen/Makefile.in +++ b/driver/xf86-input-hyperpen/Makefile.in @@ -42,9 +42,9 @@ 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_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -147,6 +147,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ NMEDIT = @NMEDIT@ @@ -167,6 +168,7 @@ STRIP = @STRIP@ VERSION = @VERSION@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ diff --git a/driver/xf86-input-hyperpen/aclocal.m4 b/driver/xf86-input-hyperpen/aclocal.m4 index 759728874..7d168938f 100644 --- a/driver/xf86-input-hyperpen/aclocal.m4 +++ b/driver/xf86-input-hyperpen/aclocal.m4 @@ -7633,7 +7633,7 @@ AC_SUBST([am__untar]) dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl -dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), @@ -7670,7 +7670,7 @@ dnl DEALINGS IN THE SOFTWARE. # See the "minimum version" comment for each macro you use to see what # version you require. m4_defun([XORG_MACROS_VERSION],[ -m4_define([vers_have], [1.6.1]) +m4_define([vers_have], [1.15.0]) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_if(m4_cmp(maj_have, maj_needed), 0,, @@ -7697,7 +7697,7 @@ AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], # which is not the best choice for supporting other OS'es, but covers most # of the ones we need for now. AC_MSG_CHECKING([if $RAWCPP requires -undef]) -AC_LANG_CONFTEST([Does cpp redefine unix ?]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])]) if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then AC_MSG_RESULT([no]) else @@ -7715,7 +7715,7 @@ fi rm -f conftest.$ac_ext AC_MSG_CHECKING([if $RAWCPP requires -traditional]) -AC_LANG_CONFTEST([Does cpp preserve "whitespace"?]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then AC_MSG_RESULT([no]) else @@ -7738,9 +7738,12 @@ AC_SUBST(RAWCPPFLAGS) # on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files. # Not sure if there's any better way than just hardcoding by OS name. # Override default settings by setting environment variables +# Added MAN_SUBSTS in version 1.8 +# Added AC_PROG_SED in version 1.8 AC_DEFUN([XORG_MANPAGE_SECTIONS],[ AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_SED]) if test x$APP_MAN_SUFFIX = x ; then APP_MAN_SUFFIX=1 @@ -7809,8 +7812,60 @@ AC_SUBST([FILE_MAN_DIR]) AC_SUBST([MISC_MAN_DIR]) AC_SUBST([DRIVER_MAN_DIR]) AC_SUBST([ADMIN_MAN_DIR]) + +XORG_MAN_PAGE="X Version 11" +AC_SUBST([XORG_MAN_PAGE]) +MAN_SUBSTS="\ + -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xservername__|Xorg|g' \ + -e 's|__xconfigfile__|xorg.conf|g' \ + -e 's|__projectroot__|\$(prefix)|g' \ + -e 's|__apploaddir__|\$(appdefaultdir)|g' \ + -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ + -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ + -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ + -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ + -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ + -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" +AC_SUBST([MAN_SUBSTS]) + ]) # XORG_MANPAGE_SECTIONS +# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION]) +# ------------------------ +# Minimum version: 1.7.0 +# +# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent +# provided by xorg-sgml-doctools, if installed. +AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[ +AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])]) +XORG_SGML_PATH= +PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])], + [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`], + [m4_ifval([$1],[:], + [if test x"$cross_compiling" != x"yes" ; then + AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent], + [XORG_SGML_PATH=$prefix/share/sgml]) + fi]) + ]) + +# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing +# the path and the name of the doc stylesheet +if test "x$XORG_SGML_PATH" != "x" ; then + AC_MSG_RESULT([$XORG_SGML_PATH]) + STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11 + XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(XORG_SGML_PATH) +AC_SUBST(STYLESHEET_SRCDIR) +AC_SUBST(XSL_STYLESHEET) +AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"]) +]) # XORG_CHECK_SGML_DOCTOOLS + # XORG_CHECK_LINUXDOC # ------------------- # Minimum version: 1.0.0 @@ -7820,23 +7875,14 @@ AC_SUBST([ADMIN_MAN_DIR]) # Whether or not the necessary tools and files are found can be checked # with the AM_CONDITIONAL "BUILD_LINUXDOC" AC_DEFUN([XORG_CHECK_LINUXDOC],[ -if test x$XORG_SGML_PATH = x ; then - XORG_SGML_PATH=$prefix/share/sgml -fi -HAVE_DEFS_ENT= - -if test x"$cross_compiling" = x"yes" ; then - HAVE_DEFS_ENT=no -else - AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes]) -fi +AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) +AC_REQUIRE([XORG_WITH_PS2PDF]) AC_PATH_PROG(LINUXDOC, linuxdoc) -AC_PATH_PROG(PS2PDF, ps2pdf) AC_MSG_CHECKING([whether to build documentation]) -if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then +if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then BUILDDOC=yes else BUILDDOC=no @@ -7848,7 +7894,7 @@ AC_MSG_RESULT([$BUILDDOC]) AC_MSG_CHECKING([whether to build pdf documentation]) -if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then +if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then BUILDPDFDOC=yes else BUILDPDFDOC=no @@ -7858,7 +7904,7 @@ AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) AC_MSG_RESULT([$BUILDPDFDOC]) -MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt" +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f" MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps" MAKE_PDF="$PS2PDF" MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0" @@ -7878,24 +7924,20 @@ AC_SUBST(MAKE_HTML) # indicates whether the necessary tools and files are found and, if set, # $(MAKE_XXX) blah.sgml will produce blah.xxx. AC_DEFUN([XORG_CHECK_DOCBOOK],[ -if test x$XORG_SGML_PATH = x ; then - XORG_SGML_PATH=$prefix/share/sgml -fi -HAVE_DEFS_ENT= +AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) + BUILDTXTDOC=no BUILDPDFDOC=no BUILDPSDOC=no BUILDHTMLDOC=no -AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes]) - AC_PATH_PROG(DOCBOOKPS, docbook2ps) AC_PATH_PROG(DOCBOOKPDF, docbook2pdf) AC_PATH_PROG(DOCBOOKHTML, docbook2html) AC_PATH_PROG(DOCBOOKTXT, docbook2txt) AC_MSG_CHECKING([whether to build text documentation]) -if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x && +if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x && test x$BUILD_TXTDOC != xno; then BUILDTXTDOC=yes fi @@ -7903,7 +7945,7 @@ AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes]) AC_MSG_RESULT([$BUILDTXTDOC]) AC_MSG_CHECKING([whether to build PDF documentation]) -if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x && +if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x && test x$BUILD_PDFDOC != xno; then BUILDPDFDOC=yes fi @@ -7911,7 +7953,7 @@ AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) AC_MSG_RESULT([$BUILDPDFDOC]) AC_MSG_CHECKING([whether to build PostScript documentation]) -if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x && +if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x && test x$BUILD_PSDOC != xno; then BUILDPSDOC=yes fi @@ -7919,7 +7961,7 @@ AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes]) AC_MSG_RESULT([$BUILDPSDOC]) AC_MSG_CHECKING([whether to build HTML documentation]) -if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x && +if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x && test x$BUILD_HTMLDOC != xno; then BUILDHTMLDOC=yes fi @@ -7937,15 +7979,17 @@ AC_SUBST(MAKE_PDF) AC_SUBST(MAKE_HTML) ]) # XORG_CHECK_DOCBOOK -# XORG_WITH_XMLTO([MIN-VERSION]) +# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT]) # ---------------- # Minimum version: 1.5.0 +# Minimum version for optional DEFAULT argument: 1.11.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the # presence of the tool and obtain it's path in separate variables. Coupled with # the --with-xmlto option, it allows maximum flexibilty in making decisions -# as whether or not to use the xmlto package. +# as whether or not to use the xmlto package. When DEFAULT is not specified, +# --with-xmlto assumes 'auto'. # # Interface to module: # HAVE_XMLTO: used in makefiles to conditionally generate documentation @@ -7954,14 +7998,20 @@ AC_SUBST(MAKE_HTML) # --with-xmlto: 'yes' user instructs the module to use xmlto # 'no' user instructs the module not to use xmlto # +# Added in version 1.10.0 +# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation +# xmlto for text output requires either lynx, links, or w3m browsers +# # If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path. # AC_DEFUN([XORG_WITH_XMLTO],[ AC_ARG_VAR([XMLTO], [Path to xmlto command]) +m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(xmlto, AS_HELP_STRING([--with-xmlto], - [Use xmlto to regenerate documentation (default: yes, if installed)]), - [use_xmlto=$withval], [use_xmlto=auto]) + [Use xmlto to regenerate documentation (default: ]_defopt[)]), + [use_xmlto=$withval], [use_xmlto=]_defopt) +m4_undefine([_defopt]) if test "x$use_xmlto" = x"auto"; then AC_PATH_PROG([XMLTO], [xmlto]) @@ -7985,6 +8035,8 @@ elif test "x$use_xmlto" = x"no" ; then else AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no']) fi + +# Test for a minimum version of xmlto, if provided. m4_ifval([$1], [if test "$have_xmlto" = yes; then # scrape the xmlto version @@ -7999,18 +8051,148 @@ m4_ifval([$1], AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed]) fi]) fi]) + +# Test for the ability of xmlto to generate a text target +have_xmlto_text=no +cat > conftest.xml << "EOF" +EOF +AS_IF([test "$have_xmlto" = yes], + [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], + [have_xmlto_text=yes], + [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])]) +rm -f conftest.xml +AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) ]) # XORG_WITH_XMLTO -# XORG_WITH_ASCIIDOC([MIN-VERSION]) +# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT]) +# -------------------------------------------- +# Minimum version: 1.12.0 +# Minimum version for optional DEFAULT argument: 1.12.0 +# +# XSLT (Extensible Stylesheet Language Transformations) is a declarative, +# XML-based language used for the transformation of XML documents. +# The xsltproc command line tool is for applying XSLT stylesheets to XML documents. +# It is used under the cover by xmlto to generate html files from DocBook/XML. +# The XSLT processor is often used as a standalone tool for transformations. +# It should not be assumed that this tool is used only to work with documnetation. +# When DEFAULT is not specified, --with-xsltproc assumes 'auto'. +# +# Interface to module: +# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation +# XSLTPROC: returns the path of the xsltproc program found +# returns the path set by the user in the environment +# --with-xsltproc: 'yes' user instructs the module to use xsltproc +# 'no' user instructs the module not to use xsltproc +# have_xsltproc: returns yes if xsltproc found in PATH or no +# +# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_XSLTPROC],[ +AC_ARG_VAR([XSLTPROC], [Path to xsltproc command]) +# Preserves the interface, should it be implemented later +m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(xsltproc, + AS_HELP_STRING([--with-xsltproc], + [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]), + [use_xsltproc=$withval], [use_xsltproc=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_xsltproc" = x"auto"; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test "x$XSLTPROC" = "x"; then + AC_MSG_WARN([xsltproc not found - cannot transform XML documents]) + have_xsltproc=no + else + have_xsltproc=yes + fi +elif test "x$use_xsltproc" = x"yes" ; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test "x$XSLTPROC" = "x"; then + AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH]) + fi + have_xsltproc=yes +elif test "x$use_xsltproc" = x"no" ; then + if test "x$XSLTPROC" != "x"; then + AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified]) + fi + have_xsltproc=no +else + AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no']) +fi + +AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes]) +]) # XORG_WITH_XSLTPROC + +# XORG_WITH_PERL([MIN-VERSION], [DEFAULT]) +# ---------------------------------------- +# Minimum version: 1.15.0 +# +# PERL (Practical Extraction and Report Language) is a language optimized for +# scanning arbitrary text files, extracting information from those text files, +# and printing reports based on that information. +# +# When DEFAULT is not specified, --with-perl assumes 'auto'. +# +# Interface to module: +# HAVE_PERL: used in makefiles to conditionally scan text files +# PERL: returns the path of the perl program found +# returns the path set by the user in the environment +# --with-perl: 'yes' user instructs the module to use perl +# 'no' user instructs the module not to use perl +# have_perl: returns yes if perl found in PATH or no +# +# If the user sets the value of PERL, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_PERL],[ +AC_ARG_VAR([PERL], [Path to perl command]) +# Preserves the interface, should it be implemented later +m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(perl, + AS_HELP_STRING([--with-perl], + [Use perl for extracting information from files (default: ]_defopt[)]), + [use_perl=$withval], [use_perl=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_perl" = x"auto"; then + AC_PATH_PROG([PERL], [perl]) + if test "x$PERL" = "x"; then + AC_MSG_WARN([perl not found - cannot extract information and report]) + have_perl=no + else + have_perl=yes + fi +elif test "x$use_perl" = x"yes" ; then + AC_PATH_PROG([PERL], [perl]) + if test "x$PERL" = "x"; then + AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH]) + fi + have_perl=yes +elif test "x$use_perl" = x"no" ; then + if test "x$PERL" != "x"; then + AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified]) + fi + have_perl=no +else + AC_MSG_ERROR([--with-perl expects 'yes' or 'no']) +fi + +AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) +]) # XORG_WITH_PERL + +# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) # ---------------- # Minimum version: 1.5.0 +# Minimum version for optional DEFAULT argument: 1.11.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the # presence of the tool and obtain it's path in separate variables. Coupled with # the --with-asciidoc option, it allows maximum flexibilty in making decisions -# as whether or not to use the asciidoc package. +# as whether or not to use the asciidoc package. When DEFAULT is not specified, +# --with-asciidoc assumes 'auto'. # # Interface to module: # HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation @@ -8023,10 +8205,12 @@ AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) # AC_DEFUN([XORG_WITH_ASCIIDOC],[ AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command]) +m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(asciidoc, AS_HELP_STRING([--with-asciidoc], - [Use asciidoc to regenerate documentation (default: yes, if installed)]), - [use_asciidoc=$withval], [use_asciidoc=auto]) + [Use asciidoc to regenerate documentation (default: ]_defopt[)]), + [use_asciidoc=$withval], [use_asciidoc=]_defopt) +m4_undefine([_defopt]) if test "x$use_asciidoc" = x"auto"; then AC_PATH_PROG([ASCIIDOC], [asciidoc]) @@ -8067,15 +8251,17 @@ fi]) AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) ]) # XORG_WITH_ASCIIDOC -# XORG_WITH_DOXYGEN([MIN-VERSION]) +# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) # -------------------------------- # Minimum version: 1.5.0 +# Minimum version for optional DEFAULT argument: 1.11.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the # presence of the tool and obtain it's path in separate variables. Coupled with # the --with-doxygen option, it allows maximum flexibilty in making decisions -# as whether or not to use the doxygen package. +# as whether or not to use the doxygen package. When DEFAULT is not specified, +# --with-doxygen assumes 'auto'. # # Interface to module: # HAVE_DOXYGEN: used in makefiles to conditionally generate documentation @@ -8088,10 +8274,12 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) # AC_DEFUN([XORG_WITH_DOXYGEN],[ AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) +m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(doxygen, AS_HELP_STRING([--with-doxygen], - [Use doxygen to regenerate documentation (default: yes, if installed)]), - [use_doxygen=$withval], [use_doxygen=auto]) + [Use doxygen to regenerate documentation (default: ]_defopt[)]), + [use_doxygen=$withval], [use_doxygen=]_defopt) +m4_undefine([_defopt]) if test "x$use_doxygen" = x"auto"; then AC_PATH_PROG([DOXYGEN], [doxygen]) @@ -8132,15 +8320,17 @@ fi]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) ]) # XORG_WITH_DOXYGEN -# XORG_WITH_GROFF +# XORG_WITH_GROFF([DEFAULT]) # ---------------- # Minimum version: 1.6.0 +# Minimum version for optional DEFAULT argument: 1.11.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the # presence of the tool and obtain it's path in separate variables. Coupled with # the --with-groff option, it allows maximum flexibilty in making decisions -# as whether or not to use the groff package. +# as whether or not to use the groff package. When DEFAULT is not specified, +# --with-groff assumes 'auto'. # # Interface to module: # HAVE_GROFF: used in makefiles to conditionally generate documentation @@ -8151,6 +8341,12 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) # --with-groff: 'yes' user instructs the module to use groff # 'no' user instructs the module not to use groff # +# Added in version 1.9.0: +# HAVE_GROFF_HTML: groff has dependencies to output HTML format: +# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package. +# psselect from the psutils package. +# the ghostcript package. Refer to the grohtml man pages +# # If the user sets the value of GROFF, AC_PATH_PROG skips testing the path. # # OS and distros often splits groff in a basic and full package, the former @@ -8163,10 +8359,12 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) # AC_DEFUN([XORG_WITH_GROFF],[ AC_ARG_VAR([GROFF], [Path to groff command]) +m4_define([_defopt], m4_default([$1], [auto])) AC_ARG_WITH(groff, AS_HELP_STRING([--with-groff], - [Use groff to regenerate documentation (default: yes, if installed)]), - [use_groff=$withval], [use_groff=auto]) + [Use groff to regenerate documentation (default: ]_defopt[)]), + [use_groff=$withval], [use_groff=]_defopt) +m4_undefine([_defopt]) if test "x$use_groff" = x"auto"; then AC_PATH_PROG([GROFF], [groff]) @@ -8190,6 +8388,7 @@ elif test "x$use_groff" = x"no" ; then else AC_MSG_ERROR([--with-groff expects 'yes' or 'no']) fi + # We have groff, test for the presence of the macro packages if test "x$have_groff" = x"yes"; then AC_MSG_CHECKING([for ${GROFF} -ms macros]) @@ -8207,20 +8406,39 @@ if test "x$have_groff" = x"yes"; then fi AC_MSG_RESULT([$groff_mm_works]) fi + +# We have groff, test for HTML dependencies, one command per package +if test "x$have_groff" = x"yes"; then + AC_PATH_PROGS(GS_PATH, [gs gswin32c]) + AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng]) + AC_PATH_PROG(PSSELECT_PATH, [psselect]) + if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then + have_groff_html=yes + else + have_groff_html=no + AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages]) + fi +fi + +# Set Automake conditionals for Makefiles AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes]) AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes]) AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) +AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) ]) # XORG_WITH_GROFF -# XORG_WITH_FOP -# ---------------- +# XORG_WITH_FOP([MIN-VERSION], [DEFAULT]) +# --------------------------------------- # Minimum version: 1.6.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# Minimum version for optional MIN-VERSION argument: 1.15.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the # presence of the tool and obtain it's path in separate variables. Coupled with # the --with-fop option, it allows maximum flexibilty in making decisions -# as whether or not to use the fop package. +# as whether or not to use the fop package. When DEFAULT is not specified, +# --with-fop assumes 'auto'. # # Interface to module: # HAVE_FOP: used in makefiles to conditionally generate documentation @@ -8233,10 +8451,12 @@ AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) # AC_DEFUN([XORG_WITH_FOP],[ AC_ARG_VAR([FOP], [Path to fop command]) +m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(fop, AS_HELP_STRING([--with-fop], - [Use fop to regenerate documentation (default: yes, if installed)]), - [use_fop=$withval], [use_fop=auto]) + [Use fop to regenerate documentation (default: ]_defopt[)]), + [use_fop=$withval], [use_fop=]_defopt) +m4_undefine([_defopt]) if test "x$use_fop" = x"auto"; then AC_PATH_PROG([FOP], [fop]) @@ -8260,18 +8480,36 @@ elif test "x$use_fop" = x"no" ; then else AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) fi + +# Test for a minimum version of fop, if provided. +m4_ifval([$1], +[if test "$have_fop" = yes; then + # scrape the fop version + AC_MSG_CHECKING([for fop minimum version]) + fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3` + AC_MSG_RESULT([$fop_version]) + AS_VERSION_COMPARE([$fop_version], [$1], + [if test "x$use_fop" = xauto; then + AC_MSG_WARN([fop version $fop_version found, but $1 needed]) + have_fop=no + else + AC_MSG_ERROR([fop version $fop_version found, but $1 needed]) + fi]) +fi]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) ]) # XORG_WITH_FOP -# XORG_WITH_PS2PDF +# XORG_WITH_PS2PDF([DEFAULT]) # ---------------- # Minimum version: 1.6.0 +# Minimum version for optional DEFAULT argument: 1.11.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the # presence of the tool and obtain it's path in separate variables. Coupled with # the --with-ps2pdf option, it allows maximum flexibilty in making decisions -# as whether or not to use the ps2pdf package. +# as whether or not to use the ps2pdf package. When DEFAULT is not specified, +# --with-ps2pdf assumes 'auto'. # # Interface to module: # HAVE_PS2PDF: used in makefiles to conditionally generate documentation @@ -8284,10 +8522,12 @@ AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) # AC_DEFUN([XORG_WITH_PS2PDF],[ AC_ARG_VAR([PS2PDF], [Path to ps2pdf command]) +m4_define([_defopt], m4_default([$1], [auto])) AC_ARG_WITH(ps2pdf, AS_HELP_STRING([--with-ps2pdf], - [Use ps2pdf to regenerate documentation (default: yes, if installed)]), - [use_ps2pdf=$withval], [use_ps2pdf=auto]) + [Use ps2pdf to regenerate documentation (default: ]_defopt[)]), + [use_ps2pdf=$withval], [use_ps2pdf=]_defopt) +m4_undefine([_defopt]) if test "x$use_ps2pdf" = x"auto"; then AC_PATH_PROG([PS2PDF], [ps2pdf]) @@ -8338,14 +8578,12 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) # parm1: specify the default value, yes or no. # AC_DEFUN([XORG_ENABLE_DOCS],[ -default=$1 -if test "x$default" = x ; then - default="yes" -fi +m4_define([docs_default], m4_default([$1], [yes])) AC_ARG_ENABLE(docs, AS_HELP_STRING([--enable-docs], - [Enable building the documentation (default: yes)]), - [build_docs=$enableval], [build_docs=$default]) + [Enable building the documentation (default: ]docs_default[)]), + [build_docs=$enableval], [build_docs=]docs_default) +m4_undefine([docs_default]) AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) AC_MSG_CHECKING([whether to build documentation]) AC_MSG_RESULT([$build_docs]) @@ -8373,14 +8611,12 @@ AC_MSG_RESULT([$build_docs]) # parm1: specify the default value, yes or no. # AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[ -devel_default=$1 -if test "x$devel_default" = x ; then - devel_default="yes" -fi +m4_define([devel_default], m4_default([$1], [yes])) AC_ARG_ENABLE(devel-docs, AS_HELP_STRING([--enable-devel-docs], - [Enable building the developer documentation (default: yes)]), - [build_devel_docs=$enableval], [build_devel_docs=$devel_default]) + [Enable building the developer documentation (default: ]devel_default[)]), + [build_devel_docs=$enableval], [build_devel_docs=]devel_default) +m4_undefine([devel_default]) AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes]) AC_MSG_CHECKING([whether to build developer documentation]) AC_MSG_RESULT([$build_devel_docs]) @@ -8408,19 +8644,205 @@ AC_MSG_RESULT([$build_devel_docs]) # parm1: specify the default value, yes or no. # AC_DEFUN([XORG_ENABLE_SPECS],[ -spec_default=$1 -if test "x$spec_default" = x ; then - spec_default="yes" -fi +m4_define([spec_default], m4_default([$1], [yes])) AC_ARG_ENABLE(specs, AS_HELP_STRING([--enable-specs], - [Enable building the specs (default: yes)]), - [build_specs=$enableval], [build_specs=$spec_default]) + [Enable building the specs (default: ]spec_default[)]), + [build_specs=$enableval], [build_specs=]spec_default) +m4_undefine([spec_default]) AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes]) AC_MSG_CHECKING([whether to build functional specifications]) AC_MSG_RESULT([$build_specs]) ]) # XORG_ENABLE_SPECS +# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto) +# ---------------------------------------------- +# Minimum version: 1.13.0 +# +# This macro enables a builder to enable/disable unit testing +# It makes no assumption about the test cases implementation +# Test cases may or may not use Automake "Support for test suites" +# They may or may not use the software utility library GLib +# +# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL +# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib. +# The variable enable_unit_tests is used by other macros in this file. +# +# Interface to module: +# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests +# enable_unit_tests: used in configure.ac for additional configuration +# --enable-unit-tests: 'yes' user instructs the module to build tests +# 'no' user instructs the module not to build tests +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[ +AC_BEFORE([$0], [XORG_WITH_GLIB]) +AC_BEFORE([$0], [XORG_LD_WRAP]) +m4_define([_defopt], m4_default([$1], [auto])) +AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests], + [Enable building unit test cases (default: ]_defopt[)]), + [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt) +m4_undefine([_defopt]) +AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno]) +AC_MSG_CHECKING([whether to build unit test cases]) +AC_MSG_RESULT([$enable_unit_tests]) +]) # XORG_ENABLE_UNIT_TESTS + +# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT]) +# ---------------------------------------- +# Minimum version: 1.13.0 +# +# GLib is a library which provides advanced data structures and functions. +# This macro enables a module to test for the presence of Glib. +# +# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing. +# Otherwise the value of $enable_unit_tests is blank. +# +# Interface to module: +# HAVE_GLIB: used in makefiles to conditionally build targets +# with_glib: used in configure.ac to know if GLib has been found +# --with-glib: 'yes' user instructs the module to use glib +# 'no' user instructs the module not to use glib +# +AC_DEFUN([XORG_WITH_GLIB],[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib], + [Use GLib library for unit testing (default: ]_defopt[)]), + [with_glib=$withval], [with_glib=]_defopt) +m4_undefine([_defopt]) + +have_glib=no +# Do not probe GLib if user explicitly disabled unit testing +if test "x$enable_unit_tests" != x"no"; then + # Do not probe GLib if user explicitly disabled it + if test "x$with_glib" != x"no"; then + m4_ifval( + [$1], + [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])], + [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])] + ) + fi +fi + +# Not having GLib when unit testing has been explicitly requested is an error +if test "x$enable_unit_tests" = x"yes"; then + if test "x$have_glib" = x"no"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) + fi +fi + +# Having unit testing disabled when GLib has been explicitly requested is an error +if test "x$enable_unit_tests" = x"no"; then + if test "x$with_glib" = x"yes"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) + fi +fi + +# Not having GLib when it has been explicitly requested is an error +if test "x$with_glib" = x"yes"; then + if test "x$have_glib" = x"no"; then + AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found]) + fi +fi + +AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes]) +]) # XORG_WITH_GLIB + +# XORG_LD_WRAP +# ------------ +# Minimum version: 1.13.0 +# +# Check if linker supports -wrap, passed via compiler flags +# +# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing. +# Otherwise the value of $enable_unit_tests is blank. +# +AC_DEFUN([XORG_LD_WRAP],[ +XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no]) +# Not having ld wrap when unit testing has been explicitly requested is an error +if test "x$enable_unit_tests" = x"yes"; then + if test "x$have_ld_wrap" = x"no"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available]) + fi +fi +AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes]) +# +]) # XORG_LD_WRAP + +# XORG_CHECK_LINKER_FLAGS +# ----------------------- +# SYNOPSIS +# +# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# Check whether the given linker FLAGS work with the current language's +# linker, or whether they give an error. +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# NOTE: Based on AX_CHECK_COMPILER_FLAGS. +# +# LICENSE +# +# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org> +# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> +# Copyright (c) 2009 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well.# +AC_DEFUN([XORG_CHECK_LINKER_FLAGS], +[AC_MSG_CHECKING([whether the linker accepts $1]) +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: +AS_LITERAL_IF([$1], + [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [ + ax_save_FLAGS=$LDFLAGS + LDFLAGS="$1" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, + AS_TR_SH(xorg_cv_linker_flags_[$1])=no) + LDFLAGS=$ax_save_FLAGS])], + [ax_save_FLAGS=$LDFLAGS + LDFLAGS="$1" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, + eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no) + LDFLAGS=$ax_save_FLAGS]) +eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1]) +AC_MSG_RESULT($xorg_check_linker_flags) +if test "x$xorg_check_linker_flags" = xyes; then + m4_default([$2], :) +else + m4_default([$3], :) +fi +]) # XORG_CHECK_LINKER_FLAGS + # XORG_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 @@ -8437,18 +8859,16 @@ AC_ARG_ENABLE(malloc0returnsnull, AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then - AC_RUN_IFELSE([ -char *malloc(); -char *realloc(); -char *calloc(); -main() { + AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include <stdlib.h> +],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); - c0 = calloc(0); - exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); -}], + c0 = calloc(0,10); + exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); +])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) @@ -8474,38 +8894,69 @@ AC_SUBST([XTMALLOC_ZERO_CFLAGS]) # ---------------- # Minimum version: 1.1.0 # -# Sets up flags for source checkers such as lint and sparse if --with-lint -# is specified. (Use --with-lint=sparse for sparse.) -# Sets $LINT to name of source checker passed with --with-lint (default: lint) -# Sets $LINT_FLAGS to flags to pass to source checker -# Sets LINT automake conditional if enabled (default: disabled) +# This macro enables the use of a tool that flags some suspicious and +# non-portable constructs (likely to be bugs) in C language source code. +# It will attempt to locate the tool and use appropriate options. +# There are various lint type tools on different platforms. +# +# Interface to module: +# LINT: returns the path to the tool found on the platform +# or the value set to LINT on the configure cmd line +# also an Automake conditional +# LINT_FLAGS: an Automake variable with appropriate flags +# +# --with-lint: 'yes' user instructs the module to use lint +# 'no' user instructs the module not to use lint (default) +# +# If the user sets the value of LINT, AC_PATH_PROG skips testing the path. +# If the user sets the value of LINT_FLAGS, they are used verbatim. # AC_DEFUN([XORG_WITH_LINT],[ -# Allow checking code with lint, sparse, etc. +AC_ARG_VAR([LINT], [Path to a lint-style command]) +AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command]) AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], [Use a lint-style source code checker (default: disabled)])], [use_lint=$withval], [use_lint=no]) -if test "x$use_lint" = "xyes" ; then - LINT="lint" + +# Obtain platform specific info like program name and options +# The lint program on FreeBSD and NetBSD is different from the one on Solaris +case $host_os in + *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*) + lint_name=splint + lint_options="-badflag" + ;; + *freebsd* | *netbsd*) + lint_name=lint + lint_options="-u -b" + ;; + *solaris*) + lint_name=lint + lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" + ;; +esac + +# Test for the presence of the program (either guessed by the code or spelled out by the user) +if test "x$use_lint" = x"yes" ; then + AC_PATH_PROG([LINT], [$lint_name]) + if test "x$LINT" = "x"; then + AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH]) + fi +elif test "x$use_lint" = x"no" ; then + if test "x$LINT" != "x"; then + AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified]) + fi else - LINT="$use_lint" + AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.]) fi -if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then - case $LINT in - lint|*/lint) - case $host_os in - solaris*) - LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" - ;; - esac - ;; - esac + +# User supplied flags override default flags +if test "x$LINT_FLAGS" != "x"; then + lint_options=$LINT_FLAGS fi -AC_SUBST(LINT) -AC_SUBST(LINT_FLAGS) -AM_CONDITIONAL(LINT, [test x$LINT != xno]) +AC_SUBST([LINT_FLAGS],[$lint_options]) +AM_CONDITIONAL(LINT, [test "x$LINT" != x]) ]) # XORG_WITH_LINT @@ -8515,33 +8966,51 @@ AM_CONDITIONAL(LINT, [test x$LINT != xno]) # # Sets up flags for building lint libraries for checking programs that call # functions in the library. -# Disabled by default, enable with --enable-lint-library -# Sets: -# @LINTLIB@ - name of lint library file to make -# MAKE_LINT_LIB - automake conditional # +# Interface to module: +# LINTLIB - Automake variable with the name of lint library file to make +# MAKE_LINT_LIB - Automake conditional +# +# --enable-lint-library: - 'yes' user instructs the module to created a lint library +# - 'no' user instructs the module not to create a lint library (default) AC_DEFUN([XORG_LINT_LIBRARY],[ AC_REQUIRE([XORG_WITH_LINT]) -# Build lint "library" for more indepth checks of programs calling this library AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], [Create lint library (default: disabled)])], [make_lint_lib=$enableval], [make_lint_lib=no]) -if test "x$make_lint_lib" != "xno" ; then - if test "x$LINT" = "xno" ; then - AC_MSG_ERROR([Cannot make lint library without --with-lint]) - fi - if test "x$make_lint_lib" = "xyes" ; then - LINTLIB=llib-l$1.ln - else - LINTLIB=$make_lint_lib - fi + +if test "x$make_lint_lib" = x"yes" ; then + LINTLIB=llib-l$1.ln + if test "x$LINT" = "x"; then + AC_MSG_ERROR([Cannot make lint library without --with-lint]) + fi +elif test "x$make_lint_lib" != x"no" ; then + AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.]) fi + AC_SUBST(LINTLIB) AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) ]) # XORG_LINT_LIBRARY +# XORG_COMPILER_BRAND +# ------------------- +# Minimum version: 1.14.0 +# +# Checks for various brands of compilers and sets flags as appropriate: +# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" +# clang compiler - sets CLANGCC to "yes" +# Intel compiler - sets INTELCC to "yes" +# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" +# +AC_DEFUN([XORG_COMPILER_BRAND], [ +AC_REQUIRE([AC_PROG_CC_C99]) +AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) +AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) +AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) +]) # XORG_COMPILER_BRAND + # XORG_CWARNFLAGS # --------------- # Minimum version: 1.2.0 @@ -8549,7 +9018,8 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) # Defines CWARNFLAGS to enable C compiler warnings. # AC_DEFUN([XORG_CWARNFLAGS], [ -AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_CC_C99]) +AC_REQUIRE([XORG_COMPILER_BRAND]) if test "x$GCC" = xyes ; then CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ @@ -8560,7 +9030,6 @@ if test "x$GCC" = xyes ; then ;; esac else - AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) if test "x$SUNCC" = "xyes"; then CWARNFLAGS="-v" fi @@ -8572,28 +9041,43 @@ AC_SUBST(CWARNFLAGS) # ----------------------- # Minimum version: 1.3.0 # -# Add configure option to enable strict compilation +# Add configure option to enable strict compilation flags, such as treating +# warnings as fatal errors. +# If --enable-strict-compilation is passed to configure, adds strict flags to +# $CWARNFLAGS. +# +# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or +# when strict compilation is unconditionally desired. AC_DEFUN([XORG_STRICT_OPTION], [ -AC_REQUIRE([AC_PROG_CC]) +# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89 AC_REQUIRE([AC_PROG_CC_C99]) +AC_REQUIRE([XORG_COMPILER_BRAND]) AC_REQUIRE([XORG_CWARNFLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) +if test "x$GCC" = xyes ; then + STRICT_CFLAGS="-pedantic -Werror" + # Add -Werror=attributes if supported (gcc 4.2 & later) + AC_MSG_CHECKING([if $CC supports -Werror=attributes]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])], + [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + CFLAGS="$save_CFLAGS" +elif test "x$SUNCC" = "xyes"; then + STRICT_CFLAGS="-errwarn" +elif test "x$INTELCC" = "xyes"; then + STRICT_CFLAGS="-Werror" +fi if test "x$STRICT_COMPILE" = "xyes"; then - AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) - AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) - if test "x$GCC" = xyes ; then - STRICT_CFLAGS="-pedantic -Werror" - elif test "x$SUNCC" = "xyes"; then - STRICT_CFLAGS="-errwarn" - elif test "x$INTELCC" = "xyes"; then - STRICT_CFLAGS="-Werror" - fi + CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" fi -CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" +AC_SUBST([STRICT_CFLAGS]) AC_SUBST([CWARNFLAGS]) ]) # XORG_STRICT_OPTION @@ -8604,6 +9088,7 @@ AC_SUBST([CWARNFLAGS]) # Defines default options for X.Org modules. # AC_DEFUN([XORG_DEFAULT_OPTIONS], [ +AC_REQUIRE([AC_PROG_INSTALL]) XORG_CWARNFLAGS XORG_STRICT_OPTION XORG_RELEASE_VERSION @@ -8657,22 +9142,9 @@ dnl # XORG_RELEASE_VERSION # -------------------- -# Adds --with/without-release-string and changes the PACKAGE and -# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION". If -# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged. Also -# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. +# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. AC_DEFUN([XORG_RELEASE_VERSION],[ - AC_ARG_WITH(release-version, - AS_HELP_STRING([--with-release-version=STRING], - [Use release version string in package name]), - [RELEASE_VERSION="$withval"], - [RELEASE_VERSION=""]) - if test "x$RELEASE_VERSION" != "x"; then - PACKAGE="$PACKAGE-$RELEASE_VERSION" - PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION" - AC_MSG_NOTICE([Building with package name set to $PACKAGE]) - fi AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], [`echo $PACKAGE_VERSION | cut -d . -f 1`], [Major version of this package]) diff --git a/driver/xf86-input-hyperpen/configure b/driver/xf86-input-hyperpen/configure index a8113459c..00c3470b7 100644 --- a/driver/xf86-input-hyperpen/configure +++ b/driver/xf86-input-hyperpen/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for xf86-input-hyperpen 1.3.0. +# Generated by GNU Autoconf 2.62 for xf86-input-hyperpen 1.4.1. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='xf86-input-hyperpen' PACKAGE_TARNAME='xf86-input-hyperpen' -PACKAGE_VERSION='1.3.0' -PACKAGE_STRING='xf86-input-hyperpen 1.3.0' +PACKAGE_VERSION='1.4.1' +PACKAGE_STRING='xf86-input-hyperpen 1.4.1' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' ac_unique_file="Makefile.am" @@ -914,6 +914,8 @@ FILE_MAN_DIR MISC_MAN_DIR DRIVER_MAN_DIR ADMIN_MAN_DIR +XORG_MAN_PAGE +MAN_SUBSTS LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -929,7 +931,6 @@ enable_libtool_lock with_pic with_tags with_xorg_module_dir -with_release_version ' ac_precious_vars='build_alias host_alias @@ -1501,7 +1502,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xf86-input-hyperpen 1.3.0 to adapt to many kinds of systems. +\`configure' configures xf86-input-hyperpen 1.4.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1572,7 +1573,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xf86-input-hyperpen 1.3.0:";; + short | recursive ) echo "Configuration of xf86-input-hyperpen 1.4.1:";; esac cat <<\_ACEOF @@ -1600,8 +1601,6 @@ Optional Packages: --with-xorg-module-dir=DIR Default xorg module directory [default=$libdir/xorg/modules] - --with-release-version=STRING - Use release version string in package name Some influential environment variables: CC C compiler command @@ -1687,7 +1686,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xf86-input-hyperpen configure 1.3.0 +xf86-input-hyperpen configure 1.4.1 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1701,7 +1700,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xf86-input-hyperpen $as_me 1.3.0, which was +It was created by xf86-input-hyperpen $as_me 1.4.1, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -2352,7 +2351,7 @@ fi # Define the identity of the package. PACKAGE='xf86-input-hyperpen' - VERSION='1.3.0' + VERSION='1.4.1' cat >>confdefs.h <<_ACEOF @@ -4417,7 +4416,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4420 "configure"' > conftest.$ac_ext + echo '#line 4419 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7525,11 +7524,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7528: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7527: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7532: \$? = $ac_status" >&5 + echo "$as_me:7531: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7815,11 +7814,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7818: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7817: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7822: \$? = $ac_status" >&5 + echo "$as_me:7821: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7919,11 +7918,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7922: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7921: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7926: \$? = $ac_status" >&5 + echo "$as_me:7925: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10319,7 +10318,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10322 "configure" +#line 10321 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10419,7 +10418,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10422 "configure" +#line 10421 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12828,11 +12827,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12831: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12830: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12835: \$? = $ac_status" >&5 + echo "$as_me:12834: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12932,11 +12931,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12935: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12934: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12939: \$? = $ac_status" >&5 + echo "$as_me:12938: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14515,11 +14514,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14518: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14517: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14522: \$? = $ac_status" >&5 + echo "$as_me:14521: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14619,11 +14618,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14622: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14621: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14626: \$? = $ac_status" >&5 + echo "$as_me:14625: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16834,11 +16833,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16837: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16836: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16841: \$? = $ac_status" >&5 + echo "$as_me:16840: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17124,11 +17123,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17127: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17126: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17131: \$? = $ac_status" >&5 + echo "$as_me:17130: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17228,11 +17227,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17231: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17230: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17235: \$? = $ac_status" >&5 + echo "$as_me:17234: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20715,24 +20714,6 @@ fi -#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 - # Check whether --with-xorg-module-dir was given. if test "${with_xorg_module_dir+set}" = set; then @@ -20997,12 +20978,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_XORG_CFLAGS="$XORG_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.0.99.901 xproto \$REQUIRED_MODULES\"") >&5 - ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.10.0 xproto \$REQUIRED_MODULES\"") >&5 + ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.10.0 xproto $REQUIRED_MODULES") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES" 2>/dev/null` + pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.10.0 xproto $REQUIRED_MODULES" 2>/dev/null` else pkg_failed=yes fi @@ -21015,12 +20996,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_XORG_LIBS="$XORG_LIBS" else if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.0.99.901 xproto \$REQUIRED_MODULES\"") >&5 - ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.10.0 xproto \$REQUIRED_MODULES\"") >&5 + ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.10.0 xproto $REQUIRED_MODULES") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES" 2>/dev/null` + pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.10.0 xproto $REQUIRED_MODULES" 2>/dev/null` else pkg_failed=yes fi @@ -21039,14 +21020,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES"` + XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xorg-server >= 1.10.0 xproto $REQUIRED_MODULES"` else - XORG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES"` + XORG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xorg-server >= 1.10.0 xproto $REQUIRED_MODULES"` fi # Put the nasty error message in config.log where it belongs echo "$XORG_PKG_ERRORS" >&5 - { { $as_echo "$as_me:$LINENO: error: Package requirements (xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES) were not met: + { { $as_echo "$as_me:$LINENO: error: Package requirements (xorg-server >= 1.10.0 xproto $REQUIRED_MODULES) were not met: $XORG_PKG_ERRORS @@ -21057,7 +21038,7 @@ Alternatively, you may set the environment variables XORG_CFLAGS and XORG_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -$as_echo "$as_me: error: Package requirements (xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES) were not met: +$as_echo "$as_me: error: Package requirements (xorg-server >= 1.10.0 xproto $REQUIRED_MODULES) were not met: $XORG_PKG_ERRORS @@ -21285,6 +21266,78 @@ _ACEOF fi +{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + $as_unset ac_script || ac_script= + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + @@ -21356,21 +21409,25 @@ fi +XORG_MAN_PAGE="X Version 11" + +MAN_SUBSTS="\ + -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xservername__|Xorg|g' \ + -e 's|__xconfigfile__|xorg.conf|g' \ + -e 's|__projectroot__|\$(prefix)|g' \ + -e 's|__apploaddir__|\$(appdefaultdir)|g' \ + -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ + -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ + -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ + -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ + -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ + -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" + -# Check whether --with-release-version was given. -if test "${with_release_version+set}" = set; then - withval=$with_release_version; RELEASE_VERSION="$withval" -else - RELEASE_VERSION="" -fi - if test "x$RELEASE_VERSION" != "x"; then - PACKAGE="$PACKAGE-$RELEASE_VERSION" - PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION" - { $as_echo "$as_me:$LINENO: Building with package name set to $PACKAGE" >&5 -$as_echo "$as_me: Building with package name set to $PACKAGE" >&6;} - fi cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1` @@ -21852,7 +21909,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xf86-input-hyperpen $as_me 1.3.0, which was +This file was extended by xf86-input-hyperpen $as_me 1.4.1, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21905,7 +21962,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -xf86-input-hyperpen config.status 1.3.0 +xf86-input-hyperpen config.status 1.4.1 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/driver/xf86-input-hyperpen/configure.ac b/driver/xf86-input-hyperpen/configure.ac index 9c8d46029..8a777eef8 100644 --- a/driver/xf86-input-hyperpen/configure.ac +++ b/driver/xf86-input-hyperpen/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-input-hyperpen], - 1.3.0, + 1.4.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-input-hyperpen) @@ -44,24 +44,6 @@ 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]]]), @@ -75,7 +57,7 @@ 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) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10.0] xproto $REQUIRED_MODULES) sdkdir=$(pkg-config --variable=sdkdir xorg-server) CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src' diff --git a/driver/xf86-input-hyperpen/man/Makefile.in b/driver/xf86-input-hyperpen/man/Makefile.in index ed63e9979..9a400d0d1 100644 --- a/driver/xf86-input-hyperpen/man/Makefile.in +++ b/driver/xf86-input-hyperpen/man/Makefile.in @@ -49,9 +49,9 @@ 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_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -139,6 +139,18 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +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' + MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ NMEDIT = @NMEDIT@ @@ -159,6 +171,7 @@ STRIP = @STRIP@ VERSION = @VERSION@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ @@ -218,18 +231,6 @@ CLEANFILES = $(driverman_DATA) # 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 diff --git a/driver/xf86-input-hyperpen/src/Makefile.in b/driver/xf86-input-hyperpen/src/Makefile.in index b9b6c288d..3dcbdd09f 100644 --- a/driver/xf86-input-hyperpen/src/Makefile.in +++ b/driver/xf86-input-hyperpen/src/Makefile.in @@ -43,9 +43,9 @@ 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_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -149,6 +149,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ NMEDIT = @NMEDIT@ @@ -169,6 +170,7 @@ STRIP = @STRIP@ VERSION = @VERSION@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ diff --git a/driver/xf86-input-hyperpen/src/xf86HyperPen.c b/driver/xf86-input-hyperpen/src/xf86HyperPen.c index 3920a0493..45ddfcaad 100644 --- a/driver/xf86-input-hyperpen/src/xf86HyperPen.c +++ b/driver/xf86-input-hyperpen/src/xf86HyperPen.c @@ -1,17 +1,18 @@ +// -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* * xf86HyperPen * * Based on the xf86Summa driver. - * + * * Modified for the Aiptek HyperPen 6000 / Tevion MD 9310 * (c) 2000 Roland Jansen <roland@lut.rwth-aachen.de> - * - * - * + * + * + * * added button and 19200 bps stuff from the DigitalEdge driver on sourceforge * (c) 2000 Christian Herzog <daduke@dataway.ch> - * - * + * + * */ /* xf86Summa @@ -35,7 +36,6 @@ * TORTIOUS ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/hyperpen/xf86HyperPen.c,v 1.9 2003/09/24 03:16:59 dawes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -46,6 +46,7 @@ #include <unistd.h> #include <errno.h> #include <string.h> +#include <termios.h> #include <misc.h> #include <xf86.h> @@ -55,47 +56,27 @@ #endif #include <xf86_OSproc.h> #include <xf86Xinput.h> -#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ +#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ #include <X11/keysym.h> #include <mipointer.h> - -#ifdef XFree86LOADER #include <xf86Module.h> -#endif -#define wait_for_fd(fd) xf86WaitForInput((fd), 1000) -#define tcflush(fd, n) xf86FlushInput((fd)) -#undef read -#define read(a,b,c) xf86ReadSerial((a),(b),(c)) -#undef write -#define write(a,b,c) xf86WriteSerial((a),(char*)(b),(c)) -#undef close -#define close(a) xf86CloseSerial((a)) -#define XCONFIG_PROBED "(==)" -#define XCONFIG_GIVEN "(**)" -#define xf86Verbose 1 -#undef PRIVATE -#define PRIVATE(x) XI_PRIVATE(x) - -/* +/* * Be sure to set vmin appropriately for your device's protocol. You want to * read a full packet before returning */ -static const char *default_options[] = -{ - "BaudRate", "9600", - "DataBits", "8", - "StopBits", "1", - "Parity", "Odd", - "FlowControl", "Xoff", - "VTime", "10", - "VMin", "7", - NULL +static char *default_options[] = { + "BaudRate", "9600", + "DataBits", "8", + "StopBits", "1", + "Parity", "Odd", + "FlowControl", "Xoff", + "VTime", "10", + "VMin", "7", + NULL }; -static InputDriverPtr hypDrv; - /* @@ -115,359 +96,267 @@ static InputDriverPtr hypDrv; static int debug_level = INI_DEBUG_LEVEL; #define DEBUG 1 #if DEBUG -#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} +#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} #else -#define DBG(lvl, f) +#define DBG(lvl, f) #endif /* ** Device records */ -#define ABSOLUTE_FLAG 1 -#define STYLUS_FLAG 2 -#define INVX_FLAG 4 -#define INVY_FLAG 8 -#define BAUD_19200_FLAG 16 +#define ABSOLUTE_FLAG 1 +#define STYLUS_FLAG 2 +#define INVX_FLAG 4 +#define INVY_FLAG 8 +#define BAUD_19200_FLAG 16 int stylus; -typedef struct -{ - char *hypDevice; /* device file name */ - int hypButTrans; /* button translation flags */ - int hypOldX; /* previous X position */ - int hypOldY; /* previous Y position */ - int hypOldZ; /* previous Z position */ - int hypOldProximity; /* previous proximity */ - int hypOldPush; /* previous buttons state */ - int hypOldButtons; /* previous buttons state */ - int hypOldBarrel; /* previous buttons state */ - int hypOldBarrel1; /* previous buttons state */ - int hypOldPressure; /* previous pen pressure */ - int hypMaxX; /* max X value */ - int hypMaxY; /* max Y value */ - int hypMaxZ; /* max Z value */ - int hypXSize; /* active area X size */ - int hypXOffset; /* active area X offset */ - int hypYSize; /* active area Y size */ - int hypYOffset; /* active area Y offset */ - int hypRes; /* resolution in lines per inch */ - int flags; /* various flags */ - int hypIndex; /* number of bytes read */ - int modelid; /* model id */ - int PT; /* pressure threshold */ - int AutoPT; /* automatically set PT*/ - int PMax; /* maximum pressure read from tablet */ - unsigned char hypData[7]; /* data read on the device */ +typedef struct { + char *hypDevice; /* device file name */ + int hypButTrans; /* button translation flags */ + int hypOldX; /* previous X position */ + int hypOldY; /* previous Y position */ + int hypOldZ; /* previous Z position */ + int hypOldProximity; /* previous proximity */ + int hypOldPush; /* previous buttons state */ + int hypOldButtons; /* previous buttons state */ + int hypOldBarrel; /* previous buttons state */ + int hypOldBarrel1; /* previous buttons state */ + int hypOldPressure; /* previous pen pressure */ + int hypMaxX; /* max X value */ + int hypMaxY; /* max Y value */ + int hypMaxZ; /* max Z value */ + int hypXSize; /* active area X size */ + int hypXOffset; /* active area X offset */ + int hypYSize; /* active area Y size */ + int hypYOffset; /* active area Y offset */ + int hypRes; /* resolution in lines per inch */ + int flags; /* various flags */ + int hypIndex; /* number of bytes read */ + int modelid; /* model id */ + int PT; /* pressure threshold */ + int AutoPT; /* automatically set PT*/ + int PMax; /* maximum pressure read from tablet */ + unsigned char hypData[7]; /* data read on the device */ } HyperPenDeviceRec, *HyperPenDevicePtr; /* ** List of model IDs */ static struct MODEL_ID { - unsigned id; - char* name; + unsigned id; + char* name; } models[] = { - {0x32, "HyperPen 3000"}, - {0x43, "HyperPen 4000"}, - {0x54, "HyperPen 5000"}, - {0x64, "HyperPen 6000"}, - {0, NULL} + {0x32, "HyperPen 3000"}, + {0x43, "HyperPen 4000"}, + {0x54, "HyperPen 5000"}, + {0x64, "HyperPen 6000"}, + {0, NULL} }; /* -** Configuration data -*/ -#define HYPERPEN_SECTION_NAME "HyperPen" - - -/* ** Contants and macro */ -#define BUFFER_SIZE 256 /* size of reception buffer */ -#define XI_NAME "HYPERPEN" /* X device name for the stylus */ +#define BUFFER_SIZE 256 /* size of reception buffer */ #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) -#define SS_RESET "\0" /* Reset */ -#define SS_GETID "\5" /* Get Model ID */ -#define SS_CONFIG "a" /* Send configuration (max coords) */ -#define SS_PROMPT_MODE "D" /* Prompt mode */ -#define SS_STREAM_MODE "@" /* Stream mode */ -#define SS_RATE "\xb5" /* 19200 bps */ -#define SS_ABSOLUTE "F" /* absolute mode */ -#define SS_RELATIVE "E" /* relative mode */ -#define SS_MACROKEY "U" /* enable F-keys */ -#define SS_MACRO_4K "\2" /* start F-keys for Hyperpen 4000 */ -#define SS_MACRO_56K "\1" /* start F-keys for Hyperpen 5000/6000 */ -static const char * ss_initstr = SS_STREAM_MODE; - -#define PHASING_BIT 0x80 -#define PROXIMITY_BIT 0x40 -#define XSIGN_BIT 0x10 -#define YSIGN_BIT 0x08 -#define BUTTON_BITS 0x07 -#define COORD_BITS 0x7f -#define XAXIS_BITS 0x03 -#define YAXIS_BITS 0x0C -#define ZMASK_BIT 0x70 -#define TIP_BITS 0x01 -#define F_BIT 0x20 +#define SS_RESET "\0" /* Reset */ +#define SS_GETID "\5" /* Get Model ID */ +#define SS_CONFIG "a" /* Send configuration (max coords) */ +#define SS_PROMPT_MODE "D" /* Prompt mode */ +#define SS_STREAM_MODE "@" /* Stream mode */ +#define SS_RATE "\xb5" /* 19200 bps */ +#define SS_ABSOLUTE "F" /* absolute mode */ +#define SS_RELATIVE "E" /* relative mode */ +#define SS_MACROKEY "U" /* enable F-keys */ +#define SS_MACRO_4K "\2" /* start F-keys for Hyperpen 4000 */ +#define SS_MACRO_56K "\1" /* start F-keys for Hyperpen 5000/6000 */ +static const char * ss_initstr = SS_STREAM_MODE; + +#define PHASING_BIT 0x80 +#define PROXIMITY_BIT 0x40 +#define XSIGN_BIT 0x10 +#define YSIGN_BIT 0x08 +#define BUTTON_BITS 0x07 +#define COORD_BITS 0x7f +#define XAXIS_BITS 0x03 +#define YAXIS_BITS 0x0C +#define ZMASK_BIT 0x70 +#define TIP_BITS 0x01 +#define F_BIT 0x20 /* macro from counts/inch to counts/meter */ -#define LPI2CPM(res) (res * 1000 / 25.4) - -/* -** External declarations -*/ - - -/* -** xf86HypConvert -** Convert valuators to X and Y. -*/ -static Bool -xf86HypConvert(LocalDevicePtr local, - int first, - int num, - int v0, - int v1, - int v2, - int v3, - int v4, - int v5, - int* x, - int* y) -{ - HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; - - if (first != 0 || num == 1) - return FALSE; - *x = (v0 * screenInfo.screens[0]->width) / priv->hypXSize; - *y = (v1 * screenInfo.screens[0]->height) / priv->hypYSize; - if (priv->flags & INVX_FLAG) - *x = screenInfo.screens[0]->width - *x; - if (*x < 0) - *x = 0; - if (priv->flags & INVY_FLAG) - *y = screenInfo.screens[0]->height - *y; - if (*y < 0) - *y = 0; - if (*x > screenInfo.screens[0]->width) - *x = screenInfo.screens[0]->width; - if (*y > screenInfo.screens[0]->height) - *y = screenInfo.screens[0]->height; - - - - return TRUE; -} - -/* -** xf86HypReverseConvert -** Convert X and Y to valuators. -*/ -static Bool -xf86HypReverseConvert(LocalDevicePtr local, - int x, - int y, - int *valuators) -{ - HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; - valuators[0] = ((x * priv->hypXSize) / screenInfo.screens[0]->width); - valuators[1] = ((y * priv->hypYSize) / screenInfo.screens[0]->height); - - - - return TRUE; -} +#define LPI2CPM(res) (res * 1000 / 25.4) /* ** xf86HypReadInput ** Reads from the HyperPen and posts any new events to the server. */ static void -xf86HypReadInput(LocalDevicePtr local) +xf86HypReadInput(InputInfoPtr pInfo) { - HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; - int len, loop; - int is_absolute; + HyperPenDevicePtr priv = (HyperPenDevicePtr) pInfo->private; + int len, loop; + int is_absolute; int f_keys, f_key, tip; int x, y, bx, by, barrel, barrel1, prox, pressure, button, push; int hw_pressure; - DeviceIntPtr device; - unsigned char buffer[BUFFER_SIZE]; - - + DeviceIntPtr device; + unsigned char buffer[BUFFER_SIZE]; - - SYSCALL(len = read(local->fd, buffer, sizeof(buffer))); + SYSCALL(len = read(pInfo->fd, buffer, sizeof(buffer))); if (len <= 0) { - Error("error reading HyperPen device"); - return; - } else { - + Error("error reading HyperPen device"); + return; } for(loop=0; loop<len; loop++) { + if ((priv->hypIndex == 0) && !(buffer[loop] & PHASING_BIT)) { + /* magic bit is not OK */ + DBG(6, ErrorF("xf86HypReadInput bad magic number 0x%x\n", buffer[loop]));; + continue; + } - if ((priv->hypIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ - DBG(6, ErrorF("xf86HypReadInput bad magic number 0x%x\n", buffer[loop]));; - continue; - } - - priv->hypData[priv->hypIndex++] = buffer[loop]; - - if (priv->hypIndex == (priv->flags & ABSOLUTE_FLAG? 7 : 5)) { -/* the packet is OK */ -/* reset char count for next read */ - priv->hypIndex = 0; + priv->hypData[priv->hypIndex++] = buffer[loop]; - prox = (priv->hypData[0] & PROXIMITY_BIT)? 0: 1; - tip = (priv->hypData[0] & TIP_BITS)? 1:0; - button = (priv->hypData[0] & BUTTON_BITS); + if (priv->hypIndex == (priv->flags & ABSOLUTE_FLAG? 7 : 5)) { + /* the packet is OK */ + /* reset char count for next read */ + priv->hypIndex = 0; - f_keys = (priv->hypData[0] & F_BIT); - pressure = (int) priv->hypData[6] + (((int) priv->hypData[5] & ZMASK_BIT) << 3); + prox = (priv->hypData[0] & PROXIMITY_BIT)? 0: 1; + tip = (priv->hypData[0] & TIP_BITS)? 1:0; + button = (priv->hypData[0] & BUTTON_BITS); - if ((tip==0) && (button==0) && (pressure>2) && (pressure != 1022)) {priv->flags |= STYLUS_FLAG; stylus=1;} else - if ((tip==0) && (button==0) && (pressure==0)) {priv->flags &= ~STYLUS_FLAG; stylus=0; pressure = 1019;} + f_keys = (priv->hypData[0] & F_BIT); + pressure = (int) priv->hypData[6] + (((int) priv->hypData[5] & ZMASK_BIT) << 3); -is_absolute = stylus; + if ((tip==0) && (button==0) && (pressure>2) && (pressure != 1022)) { + priv->flags |= STYLUS_FLAG; stylus=1; + } else if ((tip==0) && (button==0) && (pressure==0)) { + priv->flags &= ~STYLUS_FLAG; stylus=0; pressure = 1019; + } - x = priv->hypData[1] + (priv->hypData[2] << 7) + ((priv->hypData[5] & XAXIS_BITS) << 14); - y = priv->hypData[3] + (priv->hypData[4] << 7) + ((priv->hypData[5] & YAXIS_BITS) << 12); + is_absolute = stylus; - if ((f_keys) && (tip)) (f_key = ((x >> 7) + 1) >> 1); else f_key =0; + x = priv->hypData[1] + (priv->hypData[2] << 7) + ((priv->hypData[5] & XAXIS_BITS) << 14); + y = priv->hypData[3] + (priv->hypData[4] << 7) + ((priv->hypData[5] & YAXIS_BITS) << 12); - x -= priv->hypXOffset; - y = priv->hypYSize - y + priv->hypYOffset; - if (x < 0) x = 0; - if (y < 0) y = 0; - if (x > priv->hypXSize) x = priv->hypXSize; - if (y > priv->hypYSize) y = priv->hypYSize; - bx=x; - by=y; + if ((f_keys) && (tip)) (f_key = ((x >> 7) + 1) >> 1); else f_key =0; - if (!is_absolute) { - x -= priv->hypOldX; - y -= priv->hypOldY; - } + x -= priv->hypXOffset; + y = priv->hypYSize - y + priv->hypYOffset; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x > priv->hypXSize) x = priv->hypXSize; + if (y > priv->hypYSize) y = priv->hypYSize; + bx=x; + by=y; + if (!is_absolute) { + x -= priv->hypOldX; + y -= priv->hypOldY; + } + hw_pressure=pressure; + if (!priv->PMax) priv->PMax=1000; + if (pressure>1020) pressure=priv->PT; + if (priv->AutoPT) { + if ((pressure>1) && !(tip)) priv->PT = pressure; + pressure = 511 * (pressure - priv->PT - 10) / (priv->PMax - priv->PT); + } else { + pressure = 511 * (pressure - priv->PT) / (priv->PMax - priv->PT); + button &= ~1; + if (pressure>0) button |=1; + }; - - - hw_pressure=pressure; - + if (pressure > 511) pressure = 511; + if (pressure < 0) pressure = 0; - if (!priv->PMax) priv->PMax=1000; - if (pressure>1020) pressure=priv->PT; - if (priv->AutoPT) - { - if ((pressure>1) && !(tip)) priv->PT = pressure; - pressure = 511 * (pressure - priv->PT - 10) / (priv->PMax - priv->PT); - } - else - { - pressure = 511 * (pressure - priv->PT) / (priv->PMax - priv->PT); - button &= ~1; - if (pressure>0) button |=1; + push = button & 1; + barrel = button & 2; + barrel1 = button & 4; - }; + DBG(6, ErrorF("hw-press=%d\ttip=%d\tbarrel=%d\tbarrel1=%d\tpush=%d\tpressure=%d\tPT=%d\tbuttons=%d\tf-key=%d\n",hw_pressure, priv->hypData[0] & TIP_BITS, barrel, barrel1, push, pressure, priv->PT, priv->hypData[0] & BUTTON_BITS,f_key)); + device = pInfo->dev; - if (pressure > 511) pressure = 511; - if (pressure < 0) pressure = 0; + /* coordonates are ready we can send events */ - + if ((prox) && !(f_keys)) { + if (!(priv->hypOldProximity)) + xf86PostProximityEvent(device, 1, 0, 3, x, y, pressure); - push = button & 1; - barrel = button & 2; - barrel1 = button & 4; - - DBG(6, ErrorF("hw-press=%d\ttip=%d\tbarrel=%d\tbarrel1=%d\tpush=%d\tpressure=%d\tPT=%d\tbuttons=%d\tf-key=%d\n",hw_pressure, priv->hypData[0] & TIP_BITS, barrel, barrel1, push, pressure, priv->PT, priv->hypData[0] & BUTTON_BITS,f_key)); - - device = local->dev; - -/* coordonates are ready we can send events */ - - if ((prox) && !(f_keys)) { - if (!(priv->hypOldProximity)) - xf86PostProximityEvent(device, 1, 0, 3, x, y, pressure); - - if ((is_absolute && ((priv->hypOldX != x) || + if ((is_absolute && ((priv->hypOldX != x) || (priv->hypOldY != y) || (priv->hypOldZ != pressure))) - || (!is_absolute && (x || y))) { - if (is_absolute || priv->hypOldProximity) { - xf86PostMotionEvent(device, is_absolute, 0, 3, x, y, pressure); - } - } - + || (!is_absolute && (x || y))) { + if (is_absolute || priv->hypOldProximity) { + xf86PostMotionEvent(device, is_absolute, 0, 3, x, y, pressure); + } + } - if (priv->hypOldBarrel1 != barrel1) { - int delta; - delta = barrel1 - priv->hypOldBarrel1; - if (priv->hypOldBarrel1 != barrel1) { + if (priv->hypOldBarrel1 != barrel1) { + int delta; + delta = barrel1 - priv->hypOldBarrel1; + if (priv->hypOldBarrel1 != barrel1) { - xf86PostButtonEvent(device, is_absolute, 2, (delta > 0), 0, 3, x, y, pressure); - } - } - if (priv->hypOldBarrel != barrel) { - int delta; - delta = barrel - priv->hypOldBarrel; - if (priv->hypOldBarrel != barrel) { + xf86PostButtonEvent(device, is_absolute, 2, (delta > 0), 0, 3, x, y, pressure); + } + } - xf86PostButtonEvent(device, is_absolute, 3, (delta > 0), 0, 3, x, y, pressure); - } - } + if (priv->hypOldBarrel != barrel) { + int delta; + delta = barrel - priv->hypOldBarrel; + if (priv->hypOldBarrel != barrel) { - if ((priv->hypOldPush != push) && !barrel && !barrel1) { - int delta; - delta = push - priv->hypOldPush; - if (priv->hypOldPush != push) { + xf86PostButtonEvent(device, is_absolute, 3, (delta > 0), 0, 3, x, y, pressure); + } + } - xf86PostButtonEvent(device, is_absolute, 1, (delta > 0), 0, 3, x, y, pressure); - } - } + if ((priv->hypOldPush != push) && !barrel && !barrel1) { + int delta; + delta = push - priv->hypOldPush; + if (priv->hypOldPush != push) { - - priv->hypOldX = bx; - priv->hypOldY = by; - priv->hypOldPush = push; - priv->hypOldBarrel = barrel; - priv->hypOldBarrel1 = barrel1; - priv->hypOldProximity = prox; + xf86PostButtonEvent(device, is_absolute, 1, (delta > 0), 0, 3, x, y, pressure); + } + } + priv->hypOldX = bx; + priv->hypOldY = by; + priv->hypOldPush = push; + priv->hypOldBarrel = barrel; + priv->hypOldBarrel1 = barrel1; + priv->hypOldProximity = prox; - } else { /* !PROXIMITY */ -/* Any changes in buttons are ignored when !proximity */ + } else { /* !PROXIMITY */ + /* Any changes in buttons are ignored when !proximity */ if (priv->hypOldProximity) xf86PostProximityEvent(device, 0, 0, 3, x, y, pressure); - priv->hypOldProximity = 0; - } - } + priv->hypOldProximity = 0; + } + } } - - } /* ** xf86HypControlProc -** It really does do something. Honest! +** It really does do something. Honest! */ static void -xf86HypControlProc(DeviceIntPtr device, PtrCtrl *ctrl) +xf86HypControlProc(DeviceIntPtr device, PtrCtrl *ctrl) { DBG(2, ErrorF("xf86HypControlProc\n")); } @@ -483,34 +372,34 @@ xf86HypWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) SYSCALL(err = write(fd, data, strlen(data))); if (err == -1) { - Error("HyperPen write"); - return NULL; + Error("HyperPen write"); + return NULL; } while (numread < len) { - err = xf86WaitForInput(fd, 100000); - if (err == -1) { - Error("HyperPen select"); - return NULL; - } - if (!err) { - ErrorF("Timeout while reading HyperPen tablet. No tablet connected ???\n"); - return NULL; - } - - SYSCALL(err = read(fd, buffer + numread++, 1)); - if (err == -1) { - Error("HyperPen read"); - return NULL; - } - if (!err) { - --numread; - break; - } - if (cr_term && buffer[numread - 1] == '\r') { - buffer[numread - 1] = 0; - break; - } + err = xf86WaitForInput(fd, 100000); + if (err == -1) { + Error("HyperPen select"); + return NULL; + } + if (!err) { + ErrorF("Timeout while reading HyperPen tablet. No tablet connected ???\n"); + return NULL; + } + + SYSCALL(err = read(fd, buffer + numread++, 1)); + if (err == -1) { + Error("HyperPen read"); + return NULL; + } + if (!err) { + --numread; + break; + } + if (cr_term && buffer[numread - 1] == '\r') { + buffer[numread - 1] = 0; + break; + } } buffer[numread] = 0; return buffer; @@ -521,192 +410,182 @@ xf86HypWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) ** Open and initialize the tablet, as well as probe for any needed data. */ -#define WAIT(t) \ - err = xf86WaitForInput(-1, ((t) * 1000)); \ - if (err == -1) { \ - ErrorF("HyperPen select error : %s\n", strerror(errno)); \ - return !Success; \ +#define WAIT(t) \ + err = xf86WaitForInput(-1, ((t) * 1000)); \ + if (err == -1) { \ + ErrorF("HyperPen select error : %s\n", strerror(errno)); \ + return !Success; \ } static Bool -xf86HypOpen(LocalDevicePtr local) +xf86HypOpen(InputInfoPtr pInfo) { - char buffer[256]; - int err, idx; - int i, n; - double res100; - double sratio, tratio; - HyperPenDevicePtr priv = (HyperPenDevicePtr)local->private; + char buffer[256]; + int err, idx; + int i, n; + double res100; + double sratio, tratio; + HyperPenDevicePtr priv = (HyperPenDevicePtr)pInfo->private; DBG(1, ErrorF("opening %s\n", priv->hypDevice)); - local->fd = xf86OpenSerial(local->options); - if (local->fd == -1) { - Error(priv->hypDevice); - return !Success; + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) { + Error(priv->hypDevice); + return !Success; } - DBG(2, ErrorF("%s opened as fd %d\n", priv->hypDevice, local->fd)); + DBG(2, ErrorF("%s opened as fd %d\n", priv->hypDevice, pInfo->fd)); - if (xf86SetSerialSpeed(local->fd, 9600) < 0) - return !Success; + if (xf86SetSerialSpeed(pInfo->fd, 9600) < 0) + return !Success; DBG(1, ErrorF("initializing HyperPen tablet\n")); -/* Send reset to the tablet */ - - write(local->fd, SS_RESET, strlen(SS_RESET)); - WAIT(1000); - -/* Put it in prompt mode so it doesn't say anything before we're ready */ - SYSCALL(err = write(local->fd, SS_PROMPT_MODE, strlen(SS_PROMPT_MODE))); - if (err == -1) { - Error("HyperPen write"); - return !Success; - } -/* Clear any pending input */ - tcflush(local->fd, TCIFLUSH); - + /* Send reset to the tablet */ + + write(pInfo->fd, SS_RESET, strlen(SS_RESET)); + WAIT(1000); + + /* Put it in prompt mode so it doesn't say anything before we're ready */ + SYSCALL(err = write(pInfo->fd, SS_PROMPT_MODE, strlen(SS_PROMPT_MODE))); + if (err == -1) { + Error("HyperPen write"); + return !Success; + } + /* Clear any pending input */ + tcflush(pInfo->fd, TCIFLUSH); + DBG(2, ErrorF("reading model\n")); - if (!xf86HypWriteAndRead(local->fd, SS_GETID, buffer, 1, 0)) - return !Success; - + if (!xf86HypWriteAndRead(pInfo->fd, SS_GETID, buffer, 1, 0)) + return !Success; + priv->modelid=buffer[0]; for (n = -1, i = 0; models[i].id != 0; i++) - if (models[i].id == priv->modelid) - n = i; - - if (xf86Verbose) - ErrorF("%s HyperPen Model: 0x%x (%s)\n", - XCONFIG_PROBED, priv->modelid, n==-1? "UNKNOWN":models[n].name); + if (models[i].id == priv->modelid) + n = i; + xf86Msg(X_PROBED, " HyperPen Model: 0x%x (%s)\n", + priv->modelid, n==-1? "UNKNOWN":models[n].name); - /* enable F-Keys */ - SYSCALL(err = write(local->fd, SS_MACROKEY, strlen(SS_MACROKEY))); - if (err == -1) { - ErrorF("HyperPen write error : %s\n", strerror(errno)); - return !Success; - } - DBG(6, ErrorF("prepared F-keys\n")); - - /* start sequence depends on model ID */ - if (priv->modelid == 0x43) SYSCALL(err = write(local->fd, SS_MACRO_4K, strlen(SS_MACRO_4K))); else SYSCALL(err = write(local->fd, SS_MACRO_56K, strlen(SS_MACRO_56K))); + /* enable F-Keys */ + SYSCALL(err = write(pInfo->fd, SS_MACROKEY, strlen(SS_MACROKEY))); + if (err == -1) { + ErrorF("HyperPen write error : %s\n", strerror(errno)); + return !Success; + } - if (err == -1) { - ErrorF("HyperPen write error : %s\n", strerror(errno)); - return !Success; - } + DBG(6, ErrorF("prepared F-keys\n")); - DBG(6, ErrorF("started F-keys\n")); + /* start sequence depends on model ID */ + if (priv->modelid == 0x43) SYSCALL(err = write(pInfo->fd, SS_MACRO_4K, strlen(SS_MACRO_4K))); else SYSCALL(err = write(pInfo->fd, SS_MACRO_56K, strlen(SS_MACRO_56K))); + if (err == -1) { + xf86Msg(X_ERROR, "HyperPen write error : %s\n", strerror(errno)); + return !Success; + } + DBG(6, ErrorF("started F-keys\n")); priv->hypRes = 500; res100 = priv->hypRes / 100; DBG(2, ErrorF("reading max coordinates\n")); - if (!xf86HypWriteAndRead(local->fd, SS_CONFIG, buffer, 5, 0)) - return !Success; - + if (!xf86HypWriteAndRead(pInfo->fd, SS_CONFIG, buffer, 5, 0)) + return !Success; + priv->hypMaxX = (buffer[1] & 0x7f) | (buffer[2] << 7); priv->hypMaxY = (buffer[3] & 0x7f) | (buffer[4] << 7); priv->hypMaxZ = 512; - -if (xf86Verbose) - ErrorF("%s HyperPen max tablet size %d.%02dinx%d.%02din, %dx%d " - "lines of resolution\n", XCONFIG_PROBED, - priv->hypMaxX / priv->hypRes, - (priv->hypMaxX * 100 / priv->hypRes) % 100, - priv->hypMaxY / priv->hypRes, - (priv->hypMaxY * 100 / priv->hypRes) % 100, - priv->hypMaxX, priv->hypMaxY); + + xf86Msg(X_PROBED, "HyperPen max tablet size %d.%02dinx%d.%02din, %dx%d " + "lines of resolution\n", + priv->hypMaxX / priv->hypRes, + (priv->hypMaxX * 100 / priv->hypRes) % 100, + priv->hypMaxY / priv->hypRes, + (priv->hypMaxY * 100 / priv->hypRes) % 100, + priv->hypMaxX, priv->hypMaxY); if (priv->hypXOffset >= 0 && priv->hypYOffset >= 0) { - priv->hypXOffset *= res100; - priv->hypYOffset *= res100; - priv->hypMaxX -= priv->hypXOffset; - priv->hypMaxY -= priv->hypYOffset; + priv->hypXOffset *= res100; + priv->hypYOffset *= res100; + priv->hypMaxX -= priv->hypXOffset; + priv->hypMaxY -= priv->hypYOffset; } if (priv->hypXSize > 0 && priv->hypYSize > 0) { - if ((priv->hypXSize * res100) <= priv->hypMaxX && - (priv->hypYSize * res100) <= priv->hypMaxY) { - priv->hypXSize *= res100; - priv->hypYSize *= res100; - } else { - ErrorF("%s HyperPen active area bigger than tablet, " - "assuming maximum\n", XCONFIG_PROBED); - priv->hypXSize = priv->hypMaxX; - priv->hypYSize = priv->hypMaxY; - } + if ((priv->hypXSize * res100) <= priv->hypMaxX && + (priv->hypYSize * res100) <= priv->hypMaxY) { + priv->hypXSize *= res100; + priv->hypYSize *= res100; + } else { + xf86Msg(X_PROBED, "HyperPen active area bigger than tablet, " + "assuming maximum\n"); + priv->hypXSize = priv->hypMaxX; + priv->hypYSize = priv->hypMaxY; + } } else { - priv->hypXSize = priv->hypMaxX; - priv->hypYSize = priv->hypMaxY; + priv->hypXSize = priv->hypMaxX; + priv->hypYSize = priv->hypMaxY; } /* map tablet area by screen aspect ratio */ sratio = (double)screenInfo.screens[0]->height / - (double)screenInfo.screens[0]->width; + (double)screenInfo.screens[0]->width; tratio = (double)priv->hypMaxY / (double)priv->hypMaxX; - if (tratio <= 1.0) { /* tablet horizontal > vertical */ - priv->hypXSize = (double)priv->hypYSize / sratio; - if (priv->hypXSize > priv->hypMaxX) priv->hypXSize = priv->hypMaxX; - } - else { - priv->hypYSize = (double)priv->hypXSize / sratio; - if (priv->hypYSize > priv->hypMaxY) priv->hypYSize = priv->hypMaxY; + if (tratio <= 1.0) { /* tablet horizontal > vertical */ + priv->hypXSize = (double)priv->hypYSize / sratio; + if (priv->hypXSize > priv->hypMaxX) priv->hypXSize = priv->hypMaxX; + } else { + priv->hypYSize = (double)priv->hypXSize / sratio; + if (priv->hypYSize > priv->hypMaxY) priv->hypYSize = priv->hypMaxY; } - ErrorF("%s HyperPen using tablet area %d by %d, at res %d lpi\n", - XCONFIG_PROBED, priv->hypXSize, priv->hypYSize, priv->hypRes); + xf86Msg(X_PROBED, "HyperPen using tablet area %d by %d, at res %d lpi\n", + priv->hypXSize, priv->hypYSize, priv->hypRes); if (priv->flags & BAUD_19200_FLAG) { -/* Send 19200 baud to the tablet */ - SYSCALL(err = write(local->fd, SS_RATE, strlen(SS_RATE))); - if (err == -1) { - ErrorF("HyperPen write error : %s\n", strerror(errno)); - return !Success; - } - - DBG(6, ErrorF("tablet set to 19200 bps\n")); + /* Send 19200 baud to the tablet */ + SYSCALL(err = write(pInfo->fd, SS_RATE, strlen(SS_RATE))); + if (err == -1) { + ErrorF("HyperPen write error : %s\n", strerror(errno)); + return !Success; + } + DBG(6, ErrorF("tablet set to 19200 bps\n")); - /* Wait 10 mSecs */ - WAIT(10); + /* Wait 10 mSecs */ + WAIT(10); - /* Set the speed of the serial link to 19200 */ - if (xf86SetSerialSpeed(local->fd, 19200) < 0) { - return !Success; - } + /* Set the speed of the serial link to 19200 */ + if (xf86SetSerialSpeed(pInfo->fd, 19200) < 0) { + return !Success; + } - DBG(6, ErrorF("set serial speed to 19200\n")); + DBG(6, ErrorF("set serial speed to 19200\n")); } + /* Sets up the tablet mode to increment, stream, and such */ + for (idx = 0; ss_initstr[idx]; idx++) { + buffer[idx] = ss_initstr[idx]; + } - -/* Sets up the tablet mode to increment, stream, and such */ - for (idx = 0; ss_initstr[idx]; idx++) { - buffer[idx] = ss_initstr[idx]; - } - - buffer[idx] = 0; - - SYSCALL(err = write(local->fd, buffer, idx)); + buffer[idx] = 0; - + SYSCALL(err = write(pInfo->fd, buffer, idx)); - if (err == -1) { - Error("HyperPen write"); - return !Success; - } + if (err == -1) { + Error("HyperPen write"); + return !Success; + } - if (err <= 0) { - SYSCALL(close(local->fd)); - return !Success; - } + if (err <= 0) { + SYSCALL(close(pInfo->fd)); + return !Success; + } return Success; } @@ -717,51 +596,46 @@ if (xf86Verbose) static int xf86HypOpenDevice(DeviceIntPtr pHyp) { - LocalDevicePtr local = (LocalDevicePtr)pHyp->public.devicePrivate; - HyperPenDevicePtr priv = (HyperPenDevicePtr)PRIVATE(pHyp); -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + InputInfoPtr pInfo = (InputInfoPtr)pHyp->public.devicePrivate; + HyperPenDevicePtr priv = (HyperPenDevicePtr)(pInfo->private); Atom axis_labels[3] = { 0 }; -#endif - if (xf86HypOpen(local) != Success) { - if (local->fd >= 0) { - SYSCALL(close(local->fd)); - } - local->fd = -1; + if (xf86HypOpen(pInfo) != Success) { + if (pInfo->fd >= 0) { + SYSCALL(close(pInfo->fd)); + } + pInfo->fd = -1; } -/* Set the real values */ + /* Set the real values */ InitValuatorAxisStruct(pHyp, - 0, -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 - axis_labels[0], -#endif - 0, /* min val */ - priv->hypXSize, /* max val */ - LPI2CPM(priv->hypRes), /* resolution */ - 0, /* min_res */ - LPI2CPM(priv->hypRes)); /* max_res */ + 0, + axis_labels[0], + 0, /* min val */ + priv->hypXSize, /* max val */ + LPI2CPM(priv->hypRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->hypRes), /* max_res */ + (priv->flags & ABSOLUTE_FLAG)? Absolute : Relative); InitValuatorAxisStruct(pHyp, - 1, -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 - axis_labels[1], -#endif - 0, /* min val */ - priv->hypYSize, /* max val */ - LPI2CPM(priv->hypRes), /* resolution */ - 0, /* min_res */ - LPI2CPM(priv->hypRes)); /* max_res */ + 1, + axis_labels[1], + 0, /* min val */ + priv->hypYSize, /* max val */ + LPI2CPM(priv->hypRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->hypRes), /* max_res */ + (priv->flags & ABSOLUTE_FLAG)? Absolute : Relative); InitValuatorAxisStruct(pHyp, - 2, -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 - axis_labels[2], -#endif - 0, /* min val */ - 511, /* max val */ - 512, /* resolution */ - 0, /* min_res */ - 512); /* max_res */ - return (local->fd != -1); + 2, + axis_labels[2], + 0, /* min val */ + 511, /* max val */ + 512, /* resolution */ + 0, /* min_res */ + 512, /* max_res */ + (priv->flags & ABSOLUTE_FLAG)? Absolute : Relative); + return (pInfo->fd != -1); } /* @@ -771,134 +645,111 @@ xf86HypOpenDevice(DeviceIntPtr pHyp) static int xf86HypProc(DeviceIntPtr pHyp, int what) { - CARD8 map[25]; - int nbaxes; - int nbbuttons; - int loop; - LocalDevicePtr local = (LocalDevicePtr)pHyp->public.devicePrivate; - HyperPenDevicePtr priv = (HyperPenDevicePtr)PRIVATE(pHyp); -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + CARD8 map[25]; + int nbaxes; + int nbbuttons; + int loop; + InputInfoPtr pInfo = (InputInfoPtr)pHyp->public.devicePrivate; + HyperPenDevicePtr priv = (HyperPenDevicePtr)(pInfo->private); Atom btn_labels[4] = { 0 }; Atom axis_labels[3] = { 0 }; -#endif switch (what) { - case DEVICE_INIT: - DBG(1, ErrorF("xf86HypProc pHyp=%p what=INIT\n", (void *)pHyp)); - - nbaxes = 3; /* X, Y, Z */ - nbbuttons = (priv->flags & STYLUS_FLAG)? 3 : 4; - - for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; - - if (InitButtonClassDeviceStruct(pHyp, - nbbuttons, -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 - btn_labels, -#endif - map) == FALSE) { - ErrorF("unable to allocate Button class device\n"); - return !Success; - } - - if (InitFocusClassDeviceStruct(pHyp) == FALSE) { - ErrorF("unable to init Focus class device\n"); - return !Success; - } - - if (InitPtrFeedbackClassDeviceStruct(pHyp, - xf86HypControlProc) == FALSE) { - ErrorF("unable to init ptr feedback\n"); - return !Success; - } - - if (InitProximityClassDeviceStruct(pHyp) == FALSE) { - ErrorF("unable to init proximity class device\n"); - return !Success; - } - - if (InitValuatorClassDeviceStruct(pHyp, - nbaxes, -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 - axis_labels, -#endif -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 - xf86GetMotionEvents, -#endif - local->history_size, - (priv->flags & ABSOLUTE_FLAG)? Absolute: Relative) - == FALSE) { - ErrorF("unable to allocate Valuator class device\n"); - return !Success; - } -/* allocate the motion history buffer if needed */ - xf86MotionHistoryAllocate(local); -/* open the device to gather informations */ - xf86HypOpenDevice(pHyp); - break; - - case DEVICE_ON: - DBG(1, ErrorF("xf86HypProc pHyp=%p what=ON\n", (void *)pHyp)); - - if ((local->fd < 0) && (!xf86HypOpenDevice(pHyp))) { - return !Success; - } - xf86AddEnabledDevice(local); - pHyp->public.on = TRUE; - break; - - case DEVICE_OFF: - DBG(1, ErrorF("xf86HypProc pHyp=%p what=%s\n", (void *)pHyp, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - if (local->fd >= 0) - xf86RemoveEnabledDevice(local); - pHyp->public.on = FALSE; - break; - - case DEVICE_CLOSE: - DBG(1, ErrorF("xf86HypProc pHyp=%p what=%s\n", (void *)pHyp, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - SYSCALL(close(local->fd)); - local->fd = -1; - break; - - default: - ErrorF("unsupported mode=%d\n", what); - return !Success; - break; + case DEVICE_INIT: + DBG(1, ErrorF("xf86HypProc pHyp=%p what=INIT\n", (void *)pHyp)); + + nbaxes = 3; /* X, Y, Z */ + nbbuttons = (priv->flags & STYLUS_FLAG)? 3 : 4; + + for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; + + if (InitButtonClassDeviceStruct(pHyp, + nbbuttons, + btn_labels, + map) == FALSE) { + ErrorF("unable to allocate Button class device\n"); + return !Success; + } + + if (InitFocusClassDeviceStruct(pHyp) == FALSE) { + ErrorF("unable to init Focus class device\n"); + return !Success; + } + + if (InitPtrFeedbackClassDeviceStruct(pHyp, + xf86HypControlProc) == FALSE) { + ErrorF("unable to init ptr feedback\n"); + return !Success; + } + + if (InitProximityClassDeviceStruct(pHyp) == FALSE) { + ErrorF("unable to init proximity class device\n"); + return !Success; + } + + if (InitValuatorClassDeviceStruct(pHyp, + nbaxes, + axis_labels, + GetMotionHistorySize(), + (priv->flags & ABSOLUTE_FLAG)? Absolute: Relative) + == FALSE) { + ErrorF("unable to allocate Valuator class device\n"); + return !Success; + } + /* allocate the motion history buffer if needed */ + xf86MotionHistoryAllocate(pInfo); + /* open the device to gather informations */ + xf86HypOpenDevice(pHyp); + break; + + case DEVICE_ON: + DBG(1, ErrorF("xf86HypProc pHyp=%p what=ON\n", (void *)pHyp)); + + if ((pInfo->fd < 0) && (!xf86HypOpenDevice(pHyp))) { + return !Success; + } + xf86AddEnabledDevice(pInfo); + pHyp->public.on = TRUE; + break; + + case DEVICE_OFF: + DBG(1, ErrorF("xf86HypProc pHyp=%p what=%s\n", (void *)pHyp, + (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + if (pInfo->fd >= 0) + xf86RemoveEnabledDevice(pInfo); + pHyp->public.on = FALSE; + break; + + case DEVICE_CLOSE: + DBG(1, ErrorF("xf86HypProc pHyp=%p what=%s\n", (void *)pHyp, + (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + SYSCALL(close(pInfo->fd)); + pInfo->fd = -1; + break; + + default: + ErrorF("unsupported mode=%d\n", what); + return !Success; + break; } DBG(2, ErrorF("END xf86HypProc Success what=%d dev=%p priv=%p\n", - what, (void *)pHyp, (void *)priv)); + what, (void *)pHyp, (void *)priv)); return Success; } - -/* -** xf86HypClose -** It... Uh... Closes the physical device? -*/ -static void -xf86HypClose(LocalDevicePtr local) -{ - if (local->fd >= 0) { - SYSCALL(close(local->fd)); - } - local->fd = -1; -} - /* ** xf86HypChangeControl ** When I figure out what it does, it will do it. */ static int -xf86HypChangeControl(LocalDevicePtr local, xDeviceCtl *control) +xf86HypChangeControl(InputInfoPtr pInfo, xDeviceCtl *control) { - xDeviceResolutionCtl *res; + xDeviceResolutionCtl *res; res = (xDeviceResolutionCtl *)control; - + if ((control->control != DEVICE_RESOLUTION) || - (res->num_valuators < 1)) - return (BadMatch); + (res->num_valuators < 1)) + return (BadMatch); return(Success); } @@ -911,110 +762,49 @@ xf86HypChangeControl(LocalDevicePtr local, xDeviceCtl *control) static int xf86HypSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) { - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - HyperPenDevicePtr priv = (HyperPenDevicePtr)(local->private); - char newmode; + InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate; + HyperPenDevicePtr priv = (HyperPenDevicePtr)(pInfo->private); + char newmode; DBG(3, ErrorF("xf86HypSwitchMode dev=%p mode=%d\n", (void *)dev, mode)); switch(mode) { - case Absolute: - priv->flags |= ABSOLUTE_FLAG; + case Absolute: + priv->flags |= ABSOLUTE_FLAG; - break; + break; - case Relative: - priv->flags &= ~ABSOLUTE_FLAG; + case Relative: + priv->flags &= ~ABSOLUTE_FLAG; - break; + break; - default: - DBG(1, ErrorF("xf86HypSwitchMode dev=%p invalid mode=%d\n", - (void *)dev, mode)); - return BadMatch; + default: + DBG(1, ErrorF("xf86HypSwitchMode dev=%p invalid mode=%d\n", + (void *)dev, mode)); + return BadMatch; } - SYSCALL(write(local->fd, &newmode, 1)); + SYSCALL(write(pInfo->fd, &newmode, 1)); return Success; } /* -** xf86HypAllocate -** Allocates the device structures for the HyperPen. -*/ -static LocalDevicePtr -xf86HypAllocate(void) -{ - LocalDevicePtr local = xf86AllocateInput(hypDrv, 0); - HyperPenDevicePtr priv = (HyperPenDevicePtr)xalloc(sizeof(HyperPenDeviceRec)); -#if defined (sun) && !defined(i386) - char *dev_name = getenv("HYPERPEN_DEV"); -#endif - - local->name = XI_NAME; - local->type_name = "HyperPen Tablet"; - local->flags = 0; /*XI86_NO_OPEN_ON_INIT;*/ - local->device_control = xf86HypProc; - local->read_input = xf86HypReadInput; - local->control_proc = xf86HypChangeControl; - local->close_proc = xf86HypClose; - local->switch_mode = xf86HypSwitchMode; - local->conversion_proc = xf86HypConvert; - local->reverse_conversion_proc = xf86HypReverseConvert; - local->fd = -1; - local->atom = 0; - local->dev = NULL; - local->private = priv; - local->private_flags = 0; - local->history_size = 0; - -#if defined(sun) && !defined(i386) - if (dev_name) { - priv->hypDevice = (char *)xalloc(strlen(dev_name) + 1); - strcpy(priv->hypDevice, dev_name); - ErrorF("xf86HypOpen port changed to '%s'\n", priv->hypDevice); - } else { - priv->hypDevice = ""; - } -#else - priv->hypDevice = ""; /* device file name */ -#endif - priv->hypOldX = -1; /* previous X position */ - priv->hypOldY = -1; /* previous Y position */ - priv->hypOldProximity = 0; /* previous proximity */ - priv->hypOldButtons = 0; /* previous buttons state */ - priv->hypMaxX = -1; /* max X value */ - priv->hypMaxY = -1; /* max Y value */ - priv->hypXSize = -1; /* active area X */ - priv->hypXOffset = 0; /* active area X offset */ - priv->hypYSize = -1; /* active area Y */ - priv->hypYOffset = 0; /* active area Y offset */ - priv->flags = ABSOLUTE_FLAG; /* various flags -- default abs format */ - priv->hypIndex = 0; /* number of bytes read */ - priv->hypRes = 0; /* resolution */ - stylus=0; - - return local; -} - - -/* * xf86HypUninit -- * * called when the driver is unloaded. */ static void -xf86HypUninit(InputDriverPtr drv, - LocalDevicePtr local, - int flags) +xf86HypUninit(InputDriverPtr drv, + InputInfoPtr pInfo, + int flags) { - HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; - + HyperPenDevicePtr priv = (HyperPenDevicePtr) pInfo->private; + DBG(1, ErrorF("xf86HypUninit\n")); - - xf86HypProc(local->dev, DEVICE_OFF); - - xfree (priv); - xf86DeleteInput(local, 0); + + free (priv); + pInfo->private = NULL; + xf86DeleteInput(pInfo, 0); } @@ -1023,198 +813,202 @@ xf86HypUninit(InputDriverPtr drv, * * called when the module subsection is found in XF86Config */ -static InputInfoPtr -xf86HypInit(InputDriverPtr drv, - IDevPtr dev, - int flags) +static int +xf86HypInit(InputDriverPtr drv, + InputInfoPtr pInfo, + int flags) { - LocalDevicePtr local = NULL; - HyperPenDevicePtr priv = NULL; - char *s; - - hypDrv = drv; - - local = xf86HypAllocate(); - local->conf_idev = dev; + HyperPenDevicePtr priv = malloc(sizeof(HyperPenDeviceRec)); + char *s; + int rc = Success; - xf86CollectInputOptions(local, default_options, NULL); - xf86OptionListReport( local->options ); + if (!priv) { + rc = BadAlloc; + goto SetupProc_fail; + } - if (local) - priv = (HyperPenDevicePtr) local->private; + /* Serial Device is mandatory */ + priv->hypDevice = xf86FindOptionValue(pInfo->options, "Device"); - if (!local || !priv) { - goto SetupProc_fail; + if (!priv->hypDevice) { + xf86Msg (X_ERROR, "%s: No Device specified.\n", pInfo->name); + rc = BadMatch; + goto SetupProc_fail; } - - local->name = dev->identifier; + + pInfo->private = priv; + pInfo->device_control = xf86HypProc; + pInfo->read_input = xf86HypReadInput; + pInfo->control_proc = xf86HypChangeControl; + pInfo->switch_mode = xf86HypSwitchMode; + pInfo->type_name = "STYLUS"; + pInfo->fd = -1; priv->AutoPT = 1; - - /* Serial Device is mandatory */ - priv->hypDevice = xf86FindOptionValue(local->options, "Device"); - if (!priv->hypDevice) { - xf86Msg (X_ERROR, "%s: No Device specified.\n", dev->identifier); - goto SetupProc_fail; +#if defined(sun) && !defined(i386) + if (dev_name) { + priv->hypDevice = (char *)alloc(strlen(dev_name) + 1); + strcpy(priv->hypDevice, dev_name); + ErrorF("xf86HypOpen port changed to '%s'\n", priv->hypDevice); + } else { + priv->hypDevice = ""; } +#else + priv->hypDevice = ""; /* device file name */ +#endif - /* Process the common options. */ - xf86ProcessCommonOptions(local, local->options); + priv->hypOldX = -1; /* previous X position */ + priv->hypOldY = -1; /* previous Y position */ + priv->hypOldProximity = 0; /* previous proximity */ + priv->hypOldButtons = 0; /* previous buttons state */ + priv->hypMaxX = -1; /* max X value */ + priv->hypMaxY = -1; /* max Y value */ + priv->hypXSize = -1; /* active area X */ + priv->hypXOffset = 1; /* active area X offset */ + priv->hypYSize = -1; /* active area Y */ + priv->hypYOffset = 0; /* active area Y offset */ + priv->flags = ABSOLUTE_FLAG; /* various flags -- default abs format */ + priv->hypIndex = 0; /* number of bytes read */ + priv->hypRes = 0; /* resolution */ + stylus=0; /* Optional configuration */ + xf86Msg(X_CONFIG, "%s serial device is %s\n", pInfo->name, + priv->hypDevice); - xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, - priv->hypDevice); - - debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); + debug_level = xf86SetIntOption(pInfo->options, "DebugLevel", 0); if (debug_level > 0) { - xf86Msg(X_CONFIG, "%s: debug level set to %d\n", dev->identifier, debug_level); + xf86Msg(X_CONFIG, "%s: debug level set to %d\n", pInfo->name, debug_level); } - - - s = xf86FindOptionValue(local->options, "Mode"); + s = xf86FindOptionValue(pInfo->options, "Mode"); if (s && (xf86NameCmp(s, "absolute") == 0)) { - priv->flags = priv->flags | ABSOLUTE_FLAG; + priv->flags = priv->flags | ABSOLUTE_FLAG; + } else if (s && (xf86NameCmp(s, "relative") == 0)) { + priv->flags = priv->flags & ~ABSOLUTE_FLAG; + } else if (s) { + xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or relative). " + "Using default.\n", pInfo->name); } - else if (s && (xf86NameCmp(s, "relative") == 0)) { - priv->flags = priv->flags & ~ABSOLUTE_FLAG; - } - else if (s) { - 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", local->name, - (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); - + xf86Msg(X_CONFIG, "%s is in %s mode\n", pInfo->name, + (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); - s = xf86FindOptionValue(local->options, "Cursor"); + s = xf86FindOptionValue(pInfo->options, "Cursor"); if (s && (xf86NameCmp(s, "stylus") == 0)) { - priv->flags = priv->flags | STYLUS_FLAG; - } - else if (s && (xf86NameCmp(s, "puck") == 0)) { - priv->flags = priv->flags & ~STYLUS_FLAG; - } - else if (s) { - xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). " - "Using default.\n", dev->identifier); + priv->flags = priv->flags | STYLUS_FLAG; + } else if (s && (xf86NameCmp(s, "puck") == 0)) { + priv->flags = priv->flags & ~STYLUS_FLAG; + } else if (s) { + xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). " + "Using default.\n", pInfo->name); } - xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", local->name, - (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); + xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", pInfo->name, + (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); - priv->hypXSize = xf86SetIntOption(local->options, "XSize", 0); + priv->hypXSize = xf86SetIntOption(pInfo->options, "XSize", 0); if (priv->hypXSize != 0) { - xf86Msg(X_CONFIG, "%s: XSize = %d\n", - dev->identifier, priv->hypXSize); + xf86Msg(X_CONFIG, "%s: XSize = %d\n", + pInfo->name, priv->hypXSize); } - priv->hypYSize = xf86SetIntOption(local->options, "YSize", 0); + priv->hypYSize = xf86SetIntOption(pInfo->options, "YSize", 0); if (priv->hypYSize != 0) { - xf86Msg(X_CONFIG, "%s: YSize = %d\n", - dev->identifier, priv->hypYSize); + xf86Msg(X_CONFIG, "%s: YSize = %d\n", + pInfo->name, priv->hypYSize); } - priv->PT = xf86SetIntOption(local->options, "PMin", 0); + priv->PT = xf86SetIntOption(pInfo->options, "PMin", 0); if (priv->PT > 2) { - xf86Msg(X_CONFIG, "%s: PMin = %d\n", - dev->identifier, priv->PT); - priv->AutoPT = 0; - } - else - xf86Msg(X_ERROR, "%s: invalid PMin value (should be > 2)." - "Using default.\n", dev->identifier); - - - priv->PMax = xf86SetIntOption(local->options, "PMax", 0); + xf86Msg(X_CONFIG, "%s: PMin = %d\n", + pInfo->name, priv->PT); + priv->AutoPT = 0; + } else + xf86Msg(X_ERROR, "%s: invalid PMin value (should be > 2)." + "Using default.\n", pInfo->name); + + priv->PMax = xf86SetIntOption(pInfo->options, "PMax", 0); if (priv->PMax > 3) { - xf86Msg(X_CONFIG, "%s: PMax = %d\n", - dev->identifier, priv->PMax); - } - else - xf86Msg(X_ERROR, "%s: invalid PMax value (should be > 3)." - "Using default.\n", dev->identifier); - + xf86Msg(X_CONFIG, "%s: PMax = %d\n", + pInfo->name, priv->PMax); + } else + xf86Msg(X_ERROR, "%s: invalid PMax value (should be > 3)." + "Using default.\n", pInfo->name); - priv->hypXOffset = xf86SetIntOption(local->options, "XOffset", 0); + priv->hypXOffset = xf86SetIntOption(pInfo->options, "XOffset", 0); if (priv->hypXOffset != 0) { - xf86Msg(X_CONFIG, "%s: XOffset = %d\n", - dev->identifier, priv->hypXOffset); + xf86Msg(X_CONFIG, "%s: XOffset = %d\n", + pInfo->name, priv->hypXOffset); } - priv->hypYOffset = xf86SetIntOption(local->options, "YOffset", 0); + priv->hypYOffset = xf86SetIntOption(pInfo->options, "YOffset", 0); if (priv->hypYOffset != 0) { - xf86Msg(X_CONFIG, "%s: YOffset = %d\n", - dev->identifier, priv->hypYOffset); + xf86Msg(X_CONFIG, "%s: YOffset = %d\n", + pInfo->name, priv->hypYOffset); } - if (xf86SetBoolOption(local->options, "InvX", FALSE)) { - priv->flags |= INVX_FLAG; - xf86Msg(X_CONFIG, "%s: InvX\n", dev->identifier); + if (xf86SetBoolOption(pInfo->options, "InvX", FALSE)) { + priv->flags |= INVX_FLAG; + xf86Msg(X_CONFIG, "%s: InvX\n", pInfo->name); } - if (xf86SetBoolOption(local->options, "InvY", FALSE)) { - priv->flags |= INVY_FLAG; - xf86Msg(X_CONFIG, "%s: InvY\n", dev->identifier); + if (xf86SetBoolOption(pInfo->options, "InvY", FALSE)) { + priv->flags |= INVY_FLAG; + xf86Msg(X_CONFIG, "%s: InvY\n", pInfo->name); } { - int val; - val = xf86SetIntOption(local->options, "BaudRate", 0); - switch (val) { - case 19200: - priv->flags |= BAUD_19200_FLAG; - break; - case 9600: - priv->flags &= ~BAUD_19200_FLAG; - break; - default: - xf86Msg(X_CONFIG, "%s: Illegal speed value (must be 9600 or 19200)\n", dev->identifier); - break; - } + int val; + val = xf86SetIntOption(pInfo->options, "BaudRate", 0); + switch (val) { + case 19200: + priv->flags |= BAUD_19200_FLAG; + break; + case 9600: + priv->flags &= ~BAUD_19200_FLAG; + break; + default: + xf86Msg(X_CONFIG, "%s: Illegal speed value (must be 9600 or 19200)\n", pInfo->name); + break; + } } - /* mark the device configured */ - local->flags |= XI86_POINTER_CAPABLE | XI86_CONFIGURED; - - /* return the LocalDevice */ - return (local); + return rc; - SetupProc_fail: + SetupProc_fail: if (priv) - xfree(priv); - if (local) - xfree(local); - return NULL; + free(priv); + if (pInfo) + free(pInfo); + return rc; } _X_EXPORT InputDriverRec HYPERPEN = { - 1, /* driver version */ - "hyperpen", /* driver name */ - NULL, /* identify */ - xf86HypInit, /* pre-init */ - xf86HypUninit, /* un-init */ - NULL, /* module */ - 0 /* ref count */ + 1, /* driver version */ + "hyperpen", /* driver name */ + NULL, /* identify */ + xf86HypInit, /* pre-init */ + xf86HypUninit, /* un-init */ + NULL, /* module */ + default_options }; /* - *************************************************************************** - * - * Dynamic loading functions - * - *************************************************************************** - */ -#ifdef XFree86LOADER +*************************************************************************** +* +* Dynamic loading functions +* +*************************************************************************** +*/ /* * xf86HypUnplug -- * * called when the module subsection is found in XF86Config */ static void -xf86HypUnplug(pointer p) +xf86HypUnplug(pointer p) { DBG(1, ErrorF("xf86HypUnplug\n")); } @@ -1225,32 +1019,32 @@ xf86HypUnplug(pointer p) * called when the module subsection is found in XF86Config */ static pointer -xf86HypPlug(pointer module, - pointer options, - int *errmaj, - int *errmin) +xf86HypPlug(pointer module, + pointer options, + int *errmaj, + int *errmin) { DBG(1, ErrorF("xf86HypPlug\n")); - + xf86AddInputDriver(&HYPERPEN, module, 0); return module; } static XF86ModuleVersionInfo xf86HypVersionRec = -{ - "hyperpen", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, - ABI_CLASS_XINPUT, - ABI_XINPUT_VERSION, - MOD_CLASS_XINPUT, - {0, 0, 0, 0} /* signature, to be patched into the file by */ - /* a tool */ -}; + { + "hyperpen", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + {0, 0, 0, 0} /* signature, to be patched into the file by */ + /* a tool */ + }; _X_EXPORT XF86ModuleData hyperpenModuleData = { &xf86HypVersionRec, @@ -1258,6 +1052,4 @@ _X_EXPORT XF86ModuleData hyperpenModuleData = { xf86HypUnplug }; -#endif /* XFree86LOADER */ - /* end of xf86HyperPen.c */ |