summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--configure.in82
-rw-r--r--src/include/xdrv-config.h.in35
-rwxr-xr-xsrc/util/wacomcfg.c5
-rwxr-xr-xsrc/util/wacomcfg.h3
-rwxr-xr-xsrc/util/wacserial.c2
-rwxr-xr-xsrc/util/wacusb.c4
-rwxr-xr-xsrc/util/xsetwacom.c14
-rw-r--r--src/wacom.4x8
-rwxr-xr-xsrc/wacomxi/wacomcpl-exec153
-rwxr-xr-xsrc/xdrv/Makefile.am6
-rwxr-xr-xsrc/xdrv/wcmCommon.c197
-rwxr-xr-xsrc/xdrv/wcmConfig.c104
-rwxr-xr-xsrc/xdrv/wcmFilter.c18
-rwxr-xr-xsrc/xdrv/wcmISDV4.c243
-rwxr-xr-xsrc/xdrv/wcmSerial.c172
-rwxr-xr-xsrc/xdrv/wcmSerial.h3
-rwxr-xr-xsrc/xdrv/wcmUSB.c15
-rw-r--r--src/xdrv/wcmXCommand.c58
-rwxr-xr-xsrc/xdrv/xf86Wacom.c339
-rwxr-xr-xsrc/xdrv/xf86Wacom.h13
-rwxr-xr-xsrc/xdrv/xf86WacomDefs.h61
22 files changed, 980 insertions, 566 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ea8768..b2f2a26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-03-30 Ping Cheng <pingc@wacom.com>
+ Updated configure.in for keystrokes (Magnus Vigerlöf)
+ Added touch support for serial TabletPC (ISDv4)
+ Added autoprobe patch (Matthias Hopf @ Suse)
+
+2008-03-07 Ping Cheng <pingc@wacom.com>
+ * Updated wacomcpl for keystrokes
+ * Excluded keystroke support for XFree86
+ * Introduced wacom defined keymap (Magnus Vigerlöf)
+ * Support building outside the source-directory (Magnus Vigerlöf)
+
2008-02-28 Ping Cheng <pingc@wacom.com>
* Added support for Cintiq 20WSX
* Fixed Bug 1875050 (Kovid Goyal)
diff --git a/configure.in b/configure.in
index 8a816af..91e93ca 100644
--- a/configure.in
+++ b/configure.in
@@ -375,7 +375,27 @@ if test -n "$WCM_XFREE86_DIR"; then
AC_MSG_RESULT(Tried $WCM_XFREE86_DIR/$XFREE86SUBDIR and $WCM_XFREE86_DIR/xc/$XFREE86SUBDIR)
fi
if test "$WCM_ENV_XFREE86" = "yes"; then
- WCM_XDRIVER_QUIRKS="Libc-wrapper"
+ WCM_XDRIVER_QUIRKS="$WCM_XDRIVER_QUIRKS libc-wrapper"
+
+ dnl Xfree86 > 4.2 support sending keyevents
+ AC_MSG_CHECKING([if XFree86 support sending keys])
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-I$WCM_XFREE86_DIR $CFLAGS"
+ AC_TRY_COMPILE(, [
+#include <programs/Xserver/hw/xfree86/xf86Version.h>
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4, 3, 0, 0, 0)
+# error "XFree86 < 4.3 doesn't support sending keys"
+#endif
+int main(int argc, char** argv) {return 0;}
+], [WCM_SEND_KEYS=yes], [WCM_SEND_KEYS=no])
+ CFLAGS="$save_CFLAGS"
+ AC_MSG_RESULT($WCM_SEND_KEYS)
+
+ if test "$WCM_SEND_KEYS" = "yes"; then
+ WCM_XDRIVER_QUIRKS="$WCM_XDRIVER_QUIRKS key-events"
+ AC_DEFINE(WCM_KEY_SENDING_SUPPORT, 1,
+ [The X-driver can send key events for a button])
+ fi
fi
fi
if test "$WCM_ENV_XFREE86" = yes; then
@@ -444,7 +464,7 @@ if test "$WCM_ENV_XFREE86" != yes; then
AC_MSG_CHECKING([if scaling tablet to screen size is needed])
save_CFLAGS="$CFLAGS"
CFLAGS="-I$WCM_XORGSDK_DIR $CFLAGS"
- AC_TRY_COMPILE(, [
+ AC_TRY_COMPILE([
#include <xorg-server.h>
#include <xorgVersion.h>
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 4, 0, 0, 0)
@@ -452,8 +472,7 @@ if test "$WCM_ENV_XFREE86" != yes; then
#elif XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 4, 99, 2, 0)
# error "X.org >= 1.4.99.2 doesn't need rescaling code"
#endif
-int main(int argc, char** argv) {return 0;}
-], [WCM_TABLET_SCALING=yes], [WCM_TABLET_SCALING=no])
+], , [WCM_TABLET_SCALING=yes], [WCM_TABLET_SCALING=no])
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($WCM_TABLET_SCALING)
fi
@@ -465,13 +484,12 @@ int main(int argc, char** argv) {return 0;}
AC_MSG_CHECKING([if Xorg SDK defines IsXExtensionPointer])
save_CFLAGS="$CFLAGS"
CFLAGS="-I$WCM_XORGSDK_DIR $CFLAGS"
- AC_TRY_COMPILE(, [
+ AC_TRY_COMPILE([
#include <X11/extensions/XI.h>
#ifndef IsXExtensionPointer
# error "X.org SDK does not define IsXExtensionPointer"
#endif
-int main(int argc, char** argv) {return 0;}
-], [WCM_ISXEXTENSIONPOINTER=yes], [WCM_ISXEXTENSIONPOINTER=no])
+], , [WCM_ISXEXTENSIONPOINTER=yes], [WCM_ISXEXTENSIONPOINTER=no])
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($WCM_ISXEXTENSIONPOINTER)
if test "$WCM_ISXEXTENSIONPOINTER" = "yes"; then
@@ -480,6 +498,24 @@ int main(int argc, char** argv) {return 0;}
[IsXExtensionPointer is only defined in later X.org releases])
fi
+ dnl All X.org versions support sending key-events
+ AC_DEFINE(WCM_KEY_SENDING_SUPPORT, 1,
+ [The X-driver can send key events for a button])
+ WCM_XDRIVER_QUIRKS="$WCM_XDRIVER_QUIRKS key-events"
+
+ AC_MSG_CHECKING([if Xorg SDK defines dixScreenOrigins])
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-I$WCM_XORGSDK_DIR $CFLAGS"
+ AC_TRY_COMPILE([#include <globals.h>], [return dixScreenOrigins[0].x;],
+ [WCM_HAVE_DIXSCREENORIGINS=yes], [WCM_HAVE_DIXSCREENORIGINS=no])
+ CFLAGS="$save_CFLAGS"
+ AC_MSG_RESULT($WCM_HAVE_DIXSCREENORIGINS)
+ if test "$WCM_HAVE_DIXSCREENORIGINS" = "yes"; then
+ WCM_XDRIVER_QUIRKS="$WCM_XDRIVER_QUIRKS dixScreenOrigins"
+ AC_DEFINE(WCM_HAVE_DIXSCREENORIGINS,1,
+ [Later X.org version uses dixScreenOrigins for screen positions and sizes])
+ fi
+
dnl Try to get rid of a few warnings, X.org 1.4 need c99
case "$WCM_XORGSDK_VER" in
1.0*|1.1*|1.2*|1.3*)
@@ -817,42 +853,10 @@ fi
dnl =======================================================
dnl Set default defines in src/include/xdrv-config.h (moved from cmd-line)
-AC_DEFINE(AVOID_GLYPHBLT,,[cmdline substitute])
-AC_DEFINE(_BSD_SOURCE,,[cmdline substitute])
-AC_DEFINE(BUILDDEBUG,,[cmdline substitute])
-AC_DEFINE(DPMSExtension,,[cmdline substitute])
-AC_DEFINE(FUNCPROTO,15,[cmdline substitute])
-AC_DEFINE(GCCUSESGAS,,[cmdline substitute])
-AC_DEFINE(_GNU_SOURCE,,[cmdline substitute])
AC_DEFINE(IN_MODULE,,[cmdline substitute])
-AC_DEFINE(LBX,,[cmdline substitute])
-AC_DEFINE(linux,,[cmdline substitute])
-AC_DEFINE(NARROWPROTO,,[cmdline substitute])
-AC_DEFINE(NDEBUG,,[cmdline substitute])
-AC_DEFINE(PIXPRIV,,[cmdline substitute])
-AC_DEFINE(_POSIX_C_SOURCE,,[cmdline substitute])
-AC_DEFINE(_POSIX_SOURCE,,[cmdline substitute])
-AC_DEFINE(RENDER,,[cmdline substitute])
-AC_DEFINE(SHAPE,,[cmdline substitute])
-AC_DEFINE(SINGLEDEPTH,,[cmdline substitute])
-AC_DEFINE(SMART_SCHEDULE,,[cmdline substitute])
-AC_DEFINE(_SVID_SOURCE,,[cmdline substitute])
-AC_DEFINE(TOGCUP,,[cmdline substitute])
-AC_DEFINE(XAPPGROUP,,[cmdline substitute])
-AC_DEFINE(X_BYTE_ORDER,X_LITTLE_ENDIAN,[cmdline substitute])
-AC_DEFINE(XCSECURITY,,[cmdline substitute])
-AC_DEFINE(XF86BIGFONT,,[cmdline substitute])
-AC_DEFINE(XF86VIDMODE,,[cmdline substitute])
AC_DEFINE(XFree86LOADER,,[cmdline substitute])
-AC_DEFINE(XFree86Module,,[cmdline substitute])
-AC_DEFINE(XFree86Server,,[cmdline substitute])
-AC_DEFINE(XFreeXDGA,,[cmdline substitute])
AC_DEFINE(XINPUT,,[cmdline substitute])
AC_DEFINE(XKB,,[cmdline substitute])
-AC_DEFINE(_XOPEN_SOURCE,,[cmdline substitute])
-AC_DEFINE(XResExtension,,[cmdline substitute])
-AC_DEFINE(XvExtension,,[cmdline substitute])
-AC_DEFINE(XvMCExtension,,[cmdline substitute])
dnl Separate test output from file-generation output
echo
diff --git a/src/include/xdrv-config.h.in b/src/include/xdrv-config.h.in
index 74c761e..f0b79a0 100644
--- a/src/include/xdrv-config.h.in
+++ b/src/include/xdrv-config.h.in
@@ -4,42 +4,10 @@
#define _XDRV_CONFIG_H_
/* Misc defines moved from the command line */
-#undef AVOID_GLYPHBLT
-#undef _BSD_SOURCE
-#undef BUILDDEBUG
-#undef DPMSExtension
-#undef FUNCPROTO
-#undef GCCUSESGAS
-#undef _GNU_SOURCE
#undef IN_MODULE
-#undef LBX
-#undef linux
-#undef NARROWPROTO
-#undef NDEBUG
-#undef PIXPRIV
-#undef _POSIX_C_SOURCE
-#undef _POSIX_SOURCE
-#undef RENDER
-#undef SHAPE
-#undef SINGLEDEPTH
-#undef SMART_SCHEDULE
-#undef _SVID_SOURCE
-#undef TOGCUP
-#undef XAPPGROUP
-#undef X_BYTE_ORDER
-#undef XCSECURITY
-#undef XF86BIGFONT
-#undef XF86VIDMODE
#undef XFree86LOADER
-#undef XFree86Module
-#undef XFree86Server
-#undef XFreeXDGA
#undef XINPUT
#undef XKB
-#undef _XOPEN_SOURCE
-#undef XResExtension
-#undef XvExtension
-#undef XvMCExtension
/* Compiling for X.org */
#undef WCM_XORG
@@ -56,4 +24,7 @@
/* Some X.org versions require that the events are scaled to screen size */
#undef WCM_XORG_TABLET_SCALING
+/* The X-driver can send key events for a button */
+#undef WCM_KEY_SENDING_SUPPORT
+
#endif /* _XDRV_CONFIG_H_ */
diff --git a/src/util/wacomcfg.c b/src/util/wacomcfg.c
index 8ce8731..b00234b 100755
--- a/src/util/wacomcfg.c
+++ b/src/util/wacomcfg.c
@@ -2,7 +2,7 @@
** wacomcfg.c
**
** Copyright (C) 2003-2004 - John E. Joganic
-** Copyright (C) 2004-2007 - Ping Cheng
+** Copyright (C) 2004-2008 - Ping Cheng
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
@@ -26,6 +26,7 @@
** 2005-11-17 0.0.5 - PC - update mode code
** 2006-07-17 0.0.6 - PC - Exchange info directly with wacom_drv.o
** 2007-01-10 0.0.7 - PC - don't display uninitialized tools
+** 2008-03-24 0.0.8 - PC - Added touch for serial TabletPC (ISDv4)
**
****************************************************************************/
@@ -181,6 +182,8 @@ int WacomConfigListDevices(WACOMCONFIG *hConfig, WACOMDEVICEINFO** ppInfo,
pInfo->type = WACOMDEVICETYPE_STYLUS;
else if (strstr(devName,"eraser") != NULL)
pInfo->type = WACOMDEVICETYPE_ERASER;
+ else if (strstr(devName,"touch") != NULL)
+ pInfo->type = WACOMDEVICETYPE_TOUCH;
else if (strstr(devName,"pad") != NULL)
pInfo->type = WACOMDEVICETYPE_PAD;
else
diff --git a/src/util/wacomcfg.h b/src/util/wacomcfg.h
index 17100e6..03528df 100755
--- a/src/util/wacomcfg.h
+++ b/src/util/wacomcfg.h
@@ -2,7 +2,7 @@
** wacomcfg.h
**
** Copyright (C) 2003 - John E. Joganic
-** Copyright (C) 2004-2007 - Ping Cheng
+** Copyright (C) 2004-2008 - Ping Cheng
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
@@ -43,6 +43,7 @@ typedef enum
WACOMDEVICETYPE_STYLUS,
WACOMDEVICETYPE_ERASER,
WACOMDEVICETYPE_PAD,
+ WACOMDEVICETYPE_TOUCH,
WACOMDEVICETYPE_MAX
} WACOMDEVICETYPE;
diff --git a/src/util/wacserial.c b/src/util/wacserial.c
index b505d91..0833ca2 100755
--- a/src/util/wacserial.c
+++ b/src/util/wacserial.c
@@ -2,7 +2,7 @@
** wacserial.c
**
** Copyright (C) 2002, 2003 - John E. Joganic
-** Copyright (C) 2002 - 2006 - Ping Cheng
+** Copyright (C) 2002 - 2008 - Ping Cheng
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License
diff --git a/src/util/wacusb.c b/src/util/wacusb.c
index 4160c17..2ed845d 100755
--- a/src/util/wacusb.c
+++ b/src/util/wacusb.c
@@ -272,8 +272,8 @@ static int USBIdentifyModel(USBTABLET* pUSB);
static USBSUBTYPE xCintiqV5[] =
{
{ "DTZ-21ux", "Wacom Cintiq 21UX", 1, 0x3F },
- { "DTZ-20wsx", "Wacom Cintiq 20WSX", 2, 0x65 },
- { "DTZ-12wx", "Wacom Cintiq 12WX", 3, 0x6C },
+ { "DTZ-20wsx", "Wacom Cintiq 20WSX", 2, 0xC5 },
+ { "DTZ-12wx", "Wacom Cintiq 12WX", 3, 0xC6 },
{ NULL }
};
diff --git a/src/util/xsetwacom.c b/src/util/xsetwacom.c
index 8dccb77..7226f15 100755
--- a/src/util/xsetwacom.c
+++ b/src/util/xsetwacom.c
@@ -32,10 +32,11 @@
** 2007-06-05 0.1.3 - PC - Support Suppress and TwinView options
** 2007-07-24 0.1.4 - PC - Support Screen_No option
** 2008-01-17 0.1.5 - PC - Add DISPLAYTOGGLE command
+** 2008-03-24 0.1.6 - PC - Added Touch for serial Tablet PC (ISDv4)
**
****************************************************************************/
-#define XSETWACOM_VERSION "0.1.5"
+#define XSETWACOM_VERSION "0.1.6"
#include "../include/util-config.h"
@@ -655,6 +656,7 @@ static int ListDev(WACOMCONFIG *hConfig, char** argv)
{ WACOMDEVICETYPE_CURSOR, "cursor" },
{ WACOMDEVICETYPE_STYLUS, "stylus" },
{ WACOMDEVICETYPE_ERASER, "eraser" },
+ { WACOMDEVICETYPE_TOUCH, "touch" },
{ WACOMDEVICETYPE_PAD, "pad" }
};
@@ -706,11 +708,19 @@ static int ListParam(WACOMCONFIG *hConfig, char** argv)
"\tor specific keys and any other keys not listed as mod \n");
printf ("Examples:\n"
" xsetwacom set stylus Button1 \"button 5\"\n"
+ "\t(emit mouse button 5 event)\n"
" xsetwacom set stylus Button3 \"dblclick 1\"\n"
+ "\t(emit mouse double left click event)\n"
" xsetwacom set pad Button2 \"core key ctrl alt F2\"\n"
+ "\t(emit ctrl + alt + F2 key event)\n"
+ " xsetwacom set pad Button3 \"core key quotedbl a space test space string quotedbl\"\n");
+ printf ("\t(emit keystroke \"a test string\" event)\n"
" xsetwacom set pad Button3 \"core key quotedbl a test string quotedbl\"\n"
+ "\t(emit keystroke \"ateststring\" event)\n"
" xsetwacom set pad striplup \"core key up\"\n"
- " xsetwacom set pad stripldn \"core key down\"\n");
+ "\t(emit up arrow key event)\n"
+ " xsetwacom set pad stripldn \"core key down\"\n"
+ "\t(emit down arrow key event)\n");
return 0;
}
diff --git a/src/wacom.4x b/src/wacom.4x
index 44cc21c..da49dcc 100644
--- a/src/wacom.4x
+++ b/src/wacom.4x
@@ -36,7 +36,7 @@ to define multiple devices with different active zones. Each device
supports the following entries:
.RS 8
.TP 4
-.B Option \fI"Type"\fP \fI"stylus"|"eraser"|"cursor"|"pad"\fP
+.B Option \fI"Type"\fP \fI"stylus"|"eraser"|"cursor"|"pad"|"touch"\fP
sets the type of tool the device represents. This option is mandatory.
The core options, such as "SendCoreEvents" or "AlwaysCore", are
unnecessary in Gimp if you don't need to move system cursor outside
@@ -44,7 +44,8 @@ of Gimp drawing area. "pad" is for Intuos 3 or Cintiq 21UX tablet
ExpressKeys/menu strips, and Graphire 4 or Bamboo tablet buttons, wheel,
and/or ring. It is required for Intuos3, Cintiq 21UX, Graphire 4, and
Bamboo if you want to use keystroke features. "pad" is reported as a
-second tool in the driver.
+second tool in the driver. "touch" is for the tablet with touch support.
+Right now only a few serial Tablet PC has this feature.
.TP 4
.B Option \fI"Device"\fP \fI"path"\fP
sets the path to the special file which represents serial line where
@@ -97,7 +98,8 @@ to or greater than suppress (if tilt is supported);
sets the mode of the device. The default value for stylus and
eraser is Absolute; cursor is Relative; pad mode is decided
according to its core option due to its nature of not moving
-system cursor: Relative if it is a core device; Absolute, otherwise.
+system cursor: Relative if it is a core device; Absolute, otherwise;
+touch is always in absolute mode.
.TP 4
.B Option \fI"TopX"\fP \fI"number"\fP
X coordinate of the top corner of the active zone. Default to 0.
diff --git a/src/wacomxi/wacomcpl-exec b/src/wacomxi/wacomcpl-exec
index d16c730..92a775e 100755
--- a/src/wacomxi/wacomcpl-exec
+++ b/src/wacomxi/wacomcpl-exec
@@ -179,13 +179,16 @@ proc calibrationSequence {which xDev yDev} {
updateXinitrc $device topy $yDevMin
updateXinitrc $device bottomx $xDevMax
updateXinitrc $device bottomy $yDevMax
- # send the same data to the associated eraser
- set eraser $getDeviceModel($device,eraser)
- if { [ string compare $eraser $device ] } {
- updateXinitrc $eraser topx $xDevMin
- updateXinitrc $eraser topy $yDevMin
- updateXinitrc $eraser bottomx $xDevMax
- updateXinitrc $eraser bottomy $yDevMax
+ # send the same data to the associated eraser if it is a stylus
+ set type $getDeviceModel($device,type)
+ if { ![ string compare $type "stylus" ] } {
+ set eraser $getDeviceModel($device,eraser)
+ if { [ string compare $eraser $device ] } {
+ updateXinitrc $eraser topx $xDevMin
+ updateXinitrc $eraser topy $yDevMin
+ updateXinitrc $eraser bottomx $xDevMax
+ updateXinitrc $eraser bottomy $yDevMax
+ }
}
destroy .topleft .bottomright
@@ -338,8 +341,9 @@ proc disableButtons {} {
}
proc getDeviceOptionProc { dev i } {
- global getOption getOptionDefault Option oldKeys spName numButton modeToggleB
- global displayToggleB ignoreButton doubleClickB keystrokeB numStrips
+ global getOption getOptionDefault Option oldKeys modeToggleB
+ global displayToggleB ignoreButton doubleClickB keystrokeB
+ global numStrips numControls numButton spName
for { set j 1 } { $j < [ expr $i+1 ] } { incr j 1 } {
set value [ exec xsetwacom get $dev $Option($j) ]
@@ -371,7 +375,7 @@ proc getDeviceOptionProc { dev i } {
} else {
set match 0
# are they button/wheel/ring/strip?
- for { set k 1 } { $k <= [ expr ($numButton+$numStrips) ] } { incr k 1 } {
+ for { set k 1 } { $k <= $numControls } { incr k 1 } {
if { ![string compare -nocase $Option($j) $spName($k)] } {
set match 1
break
@@ -408,7 +412,7 @@ proc getDeviceOptionProc { dev i } {
proc updateDevice {} {
global device deviceIndex hasPad isLCD
- global numScreens getDeviceModel
+ global numScreens getDeviceModel hasTouch
set olddev $device
set device [ .workingDev.list get anchor ]
@@ -433,24 +437,20 @@ proc updateDevice {} {
if { $hasPad($model) } {
createPanel 0 1 0 0
}
- } else {
- if { $isLCD($model) } {
- if { ![ string compare $type "stylus" ] } {
- createPanel 1 1 0 1
- } else {
- if { [ string compare $type "cursor" ] } {
- createPanel 1 1 0 0
- } else {
- createPanel 0 0 0 0
- }
- }
- } else {
- if { [ string compare $type "cursor" ] } {
- createPanel 1 1 1 0
- } else {
- createPanel 0 1 1 0
- }
+ } elseif { ![ string compare $type "touch" ] } {
+ if { $hasTouch($model) } {
+ createPanel 0 0 0 1
+ }
+ } elseif { $isLCD($model) } {
+ if { ![ string compare $type "stylus" ] } {
+ createPanel 1 1 0 1
+ } elseif { [ string compare $type "cursor" ] } {
+ createPanel 1 1 0 0
}
+ } elseif { [ string compare $type "cursor" ] } {
+ createPanel 1 1 1 0
+ } else {
+ createPanel 0 1 1 0
}
} else {
#
@@ -603,8 +603,12 @@ proc updateButton {} {
set v "DisplayToggle 1" }
"KeyStroke"
{ set j $keystrokeB
- set v $cKeys($spName($k))
- set oldKeys($spName($k)) $cKeys($spName($k)) }
+ if { $cKeys($spName($k)) == "" } {
+ set v $oldKeys($spName($k))
+ } else {
+ set v $cKeys($spName($k))
+ set oldKeys($spName($k)) $cKeys($spName($k))
+ } }
"Ignore"
{ set j $ignoreButton
set v "Button 0" }
@@ -696,13 +700,13 @@ proc getNumButton { type } {
}
proc setspName {} {
- global numButton spName numStrips startS device Option cKeys oldKeys
+ global numButton spName startS device Option cKeys oldKeys
global numPadRelW numPadStrips numPadRings getDeviceModel
+ global numControls numStrips getOption
for { set i 1 } { $i <= $numButton } { incr i 1 } {
set spName($i) Button$i
}
- getDeviceOptionProc $device $numButton
set spName([expr ($numButton + 1) ]) "RelWUp"
set spName([expr ($numButton + 2) ]) "RelWDn"
@@ -713,10 +717,18 @@ proc setspName {} {
set spName([expr ($numButton + 7) ]) "StripRUp"
set spName([expr ($numButton + 8) ]) "StripRDn"
- for { set i 1 } { $i <= 8 } { incr i 1 } {
- set Option($i) $spName([expr ($numButton + $i)])
+ set numControls [expr ($numButton+8)]
+ for { set i 1 } { $i <= $numControls } { incr i 1 } {
+ set Option($i) $spName($i)
}
- getDeviceOptionProc $device 8
+
+ # initial keys before we call getDeviceOptionProc
+ for { set i 1 } { $i <= $numControls } { incr i 1 } {
+ set oldKeys($spName($i)) ""
+ set cKeys($spName($i)) ""
+ }
+
+ getDeviceOptionProc $device $numControls
set s1 5
set s2 8
@@ -734,11 +746,6 @@ proc setspName {} {
set startS $s1
set numStrips [expr ($s2 - $s1) + 1]
- # initial keys
- for { set i 1 } { $i <= [ expr ($numButton + 8) ] } { incr i 1 } {
- set oldKeys($spName($i)) ""
- set cKeys($spName($i)) ""
- }
}
proc initialButton {} {
@@ -746,8 +753,8 @@ proc initialButton {} {
global spName numStrips
set type $getDeviceModel($device,type)
-
set t $numButton
+
if { [ string compare $type "pad" ] } {
set t [expr ($t+1)]
set Option($t) "Mode"
@@ -755,10 +762,14 @@ proc initialButton {} {
set Option($t) "TPCButton"
}
getDeviceOptionProc $device $t
+
if { [ string compare $type "pad" ] } {
displayMode
}
+ # initial controls
+ setspName
+
for { set i 1 } { $i <= $numButton } { incr i 1 } {
addMenu $i
}
@@ -878,9 +889,9 @@ proc closeTabWindow {} {
proc expressKeys { } {
global db db1 db2 db3 db4 db5 db6 db7 db8 db9 db10
- global db11 db12 db13 db14 startS
+ global db11 db12 db13 db14 startS getOption
global currentW device numButton spName numStrips
- global Option getOption getDeviceModel cKeys oldKeys
+ global getDeviceModel cKeys oldKeys
global displayToggleB ignoreButton keystrokeB
global numPadRings numPadStrips numPadAbsW numPadRelW
@@ -896,15 +907,15 @@ proc expressKeys { } {
set s2 [expr ($startS + $numStrips) - 1]
for { set i $startS } { $i <= $s2 } { incr i 1 } {
set cur [ expr ($numButton + $i - $startS + 1) ]
- set opt $getOption($device,$Option($i))
+ set curOption [ expr ($numButton + $i) ]
+ set opt $getOption($device,$spName($curOption))
if { $opt == "" } { set opt $ignoreButton }
- set curOption [ expr ($numButton + $i) ]
set db$cur $db($opt)
#reset keys
if { $opt != $keystrokeB } {
- set cKeys($Option($i)) ""
- set oldKeys($Option($i)) ""
+ set cKeys($spName($curOption)) ""
+ set oldKeys($spName($curOption)) ""
}
set bmenu [ tk_optionMenu $currentW.f.$cur db$cur $db(1) $db(2) \
$db(3) $db(4) $db(5) $db($displayToggleB) $db($ignoreButton) ]
@@ -950,6 +961,7 @@ proc addMenu { curb } {
set opt [ expr ($opt-8) ]
}
}
+
set db$curb $db($opt)
#reset keys
if { $opt != $keystrokeB } {
@@ -1186,9 +1198,15 @@ proc initialSet {} {
# used by both TwinView and non TwinView multimonitor setup
label $currentW.f.sns -text "Display Mapping: "
- set numS [ exec xsetwacom get $device NumScreen ]
- set tvID [ exec xsetwacom get $device TwinView ]
- set snd [ exec xsetwacom get $device Screen_no ]
+ set Option(1) "NumScreen"
+ set Option(2) "TwinView"
+ set Option(3) "Screen_no"
+ getDeviceOptionProc $device 3
+
+ set numS $getOption($device,NumScreen)
+ set tvID $getOption($device,TwinView)
+ set snd $getOption($device,Screen_no)
+
if { $snd == -1 } {
set snd "Desktop"
} else {
@@ -1298,11 +1316,13 @@ proc initialKeys {} {
set bName(keystroke) 1
text $currentW.f.panelt.input -width 40 -height 10 \
-yscrollcommand "$currentW.f.panelt.srl_y set"
+
if { $cKeys($spName($currentk)) != "" } {
$currentW.f.panelt.input insert end $cKeys($spName($currentk))
} else {
if { $oldKeys($spName($currentk)) != "" } {
$currentW.f.panelt.input insert end $oldKeys($spName($currentk))
+ set cKeys($spName($currentk)) $oldKeys($spName($currentk))
}
}
scrollbar $currentW.f.panelt.srl_y -width 10 -command \
@@ -1427,20 +1447,20 @@ proc updateKeys {} {
set index [ string last "\n" $keys ]
}
- if { $keys != "" } {
- if { $oldKeys($spName($currentk)) != $keys } {
- if { [string compare -nocase -length 8 $keys "core key"] } {
- set cKeys($spName($currentk)) "core key $keys"
- } else {
- set cKeys($spName($currentk)) $keys
- }
- set getOption($device,$spName($currentk)) $keystrokeB
- set db$currentb $db($keystrokeB)
+ if { $oldKeys($spName($currentk)) != $keys } {
+ if { [string compare -nocase -length 8 $keys "core key"] } {
+ set cKeys($spName($currentk)) "core key $keys"
+ } else {
+ set cKeys($spName($currentk)) $keys
}
- } else { # ignore the button
- set getOption($device,$spName($currentk)) $ignoreButton
+ }
+
+ if { $cKeys($spName($currentk)) != "" } {
+ set db$currentb $db($keystrokeB)
+ } else {
set db$currentb $db($ignoreButton)
}
+
if { [ string length $cKeys($spName($currentk)) ] > 240 } {
helpWindow "Help Window " \
"\n\nYou have entered more 240 keys. \n\
@@ -1522,7 +1542,7 @@ proc createPanel { pressure button mapping calibrate } {
}
proc updateModelInfo { } {
- global isLCD numPadButtons numPadRings hasPad
+ global isLCD numPadButtons numPadRings hasPad hasTouch
global numPadStrips numPadAbsW numPadRelW
for { set i 0 } { $i <= 198 } { incr i 1 } {
@@ -1591,6 +1611,14 @@ proc updateModelInfo { } {
set hasPad($i) 0
}
}
+
+ for { set i 0 } { $i <= 198 } { incr i 1 } {
+ if { $i == 144 || $i == 147 } {
+ set hasTouch($i) 1
+ } else {
+ set hasTouch($i) 0
+ }
+ }
}
proc createControls { } {
@@ -1635,7 +1663,6 @@ proc createControls { } {
# up to the max number of buttons
set numButton 10
set numStrips 4
-# setspName
checkbutton .showHelp -text "Turn Help on" -anchor w \
-variable showHelp -state normal
diff --git a/src/xdrv/Makefile.am b/src/xdrv/Makefile.am
index 6e965ac..a0ba643 100755
--- a/src/xdrv/Makefile.am
+++ b/src/xdrv/Makefile.am
@@ -15,11 +15,11 @@ EXTRA_DIST = xf86Wacom.c wcmXCommand.c xf86Wacom.h \
../include/Xwacom.h
if WCM_ENV_XORGSDK
-DRIVER_INCLUDES = -I$(WCM_XORGSDK_DIR) $(X_CFLAGS)
+DRIVER_INCLUDES = -I../include -I$(WCM_XORGSDK_DIR) $(X_CFLAGS)
endif
if WCM_ENV_XFREE86
-DRIVER_INCLUDES = \
+DRIVER_INCLUDES = -I../include \
-I$(WCM_XFREE86_DIR)/programs/Xserver/hw/xfree86/common \
-I$(WCM_XFREE86_DIR)/programs/Xserver/hw/xfree86/loader \
-I$(WCM_XFREE86_DIR)/programs/Xserver/hw/xfree86/os-support \
@@ -62,7 +62,7 @@ depend: .depend
.depend: Makefile
@rm -f .depend
- $(CC) -MM $(CFLAGS) $(DEPFLAGS) $(DRIVER_INCLUDES) $(XF86OBJS:%.o=%.c) > .depend
+ $(CC) -MM $(CFLAGS) $(DEPFLAGS) $(DRIVER_INCLUDES) $(XF86OBJS:%.o=$(srcdir)/%.c) > .depend
-include .depend
diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c
index d4fb288..e3f71b1 100755
--- a/src/xdrv/wcmCommon.c
+++ b/src/xdrv/wcmCommon.c
@@ -368,6 +368,7 @@ static void xf86WcmSendButtons(LocalDevicePtr local, int buttons, int rx, int ry
}
}
+#ifdef WCM_KEY_SENDING_SUPPORT
/*****************************************************************************
* emitKeysym --
* Emit a keydown/keyup event
@@ -430,29 +431,25 @@ static void emitKeysym (DeviceIntPtr keydev, int keysym, int state)
{
for (j = ksr->minKeyCode; j <= ksr->maxKeyCode; j++)
if (ksr->map [(j - ksr->minKeyCode) * ksr->mapWidth] == XK_Shift_L)
- break;
+ break;
if (state)
xf86PostKeyboardEvent (keydev, j, 1);
for (i = ksr->minKeyCode; i <= ksr->maxKeyCode; i++)
if (ksr->map [(i - ksr->minKeyCode) * ksr->mapWidth] == alt_keysym)
- break;
+ break;
xf86PostKeyboardEvent (keydev, i, state);
- if (state)
+ if (!state)
xf86PostKeyboardEvent (keydev, j, 0);
}
else
xf86Msg (X_WARNING, "Couldn't find key with code %08x on keyboard device %s\n",
- keysym, keydev->name);
+ keysym, keydev->name);
return;
}
xf86PostKeyboardEvent (keydev, i, state);
}
-/*****************************************************************************
- * sendAButton --
- * Send one button event, called by xf86WcmSendButtons
- ****************************************************************************/
-static int wcm_modifier [ ] =
+static int wcm_modifier [ ] =
{
XK_Shift_L,
XK_Control_L,
@@ -474,7 +471,40 @@ static int WcmIsModifier(int keysym)
}
return match;
}
+#endif /*WCM_KEY_SENDING_SUPPORT*/
+
+static void sendKeystroke(LocalDevicePtr local, int button, unsigned *keyP, int kPress)
+{
+#ifndef WCM_KEY_SENDING_SUPPORT
+ ErrorF ("Error: [wacom] your X server doesn't support key events!\n");
+#else /* WCM_KEY_SENDING_SUPPORT */
+ if (button & AC_CORE)
+ {
+ int i = 0;
+ for (i=0; i<((button & AC_NUM_KEYS)>>20); i++)
+ {
+ /* modifier and key down then key up events */
+ if(kPress)
+ {
+ emitKeysym (local->dev, keyP[i], 1);
+ if (!WcmIsModifier(keyP[i]))
+ emitKeysym (local->dev, keyP[i], 0);
+ }
+ /* modifier up events */
+ else if (WcmIsModifier(keyP[i]))
+ emitKeysym (local->dev, keyP[i], 0);
+ }
+ }
+ else
+ ErrorF ("WARNING: [%s] without SendCoreEvents. Cannot emit key events!\n", local->name);
+#endif /* WCM_KEY_SENDING_SUPPORT */
+}
+
+/*****************************************************************************
+ * sendAButton --
+ * Send one button event, called by xf86WcmSendButtons
+ ****************************************************************************/
static void sendAButton(LocalDevicePtr local, int button, int mask,
int rx, int ry, int rz, int v3, int v4, int v5)
{
@@ -484,7 +514,7 @@ static void sendAButton(LocalDevicePtr local, int button, int mask,
#if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
int is_core = local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER);
#endif
- int i, button_idx, naxes = priv->naxes;
+ int button_idx, naxes = priv->naxes;
if (IsPad(priv))
button -= 8;
@@ -521,39 +551,13 @@ static void sendAButton(LocalDevicePtr local, int button, int mask,
*/ /* Dynamically modify the button map as required --
* to be moved in the place where button mappings are changed
*/
-#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0
- /* +1 to be able to support Xorg xserver 1.4, which due to a
- * button translation bug will run the translation twice. By
- * adding 1 to the button# we're able to support at least a
- * simple button1 is button1 mapping.
- */
- button_idx++;
-#endif
local->dev->button->map [button_idx] = button & AC_CODE;
xf86PostButtonEvent(local->dev, is_absolute, button_idx,
mask != 0,0,naxes,rx,ry,rz,v3,v4,v5);
-
break;
case AC_KEY:
- if (button & AC_CORE)
- {
- for (i=0; i<((button & AC_NUM_KEYS)>>20); i++)
- {
- /* button down to send modifier and key down then key up */
- if (mask)
- {
- emitKeysym (inputInfo.keyboard, priv->keys[button_idx][i], 1);
- if (!WcmIsModifier(priv->keys[button_idx][i]))
- emitKeysym (inputInfo.keyboard, priv->keys[button_idx][i], 0);
- }
- /* button up to send modifier up */
- else if (WcmIsModifier(priv->keys[button_idx][i]))
- emitKeysym (inputInfo.keyboard, priv->keys[button_idx][i], 0);
- }
- }
- else
- ErrorF ("WARNING: Devices without SendCoreEvents cannot emit key events!\n");
+ sendKeystroke(local, button, priv->keys[button_idx], mask);
break;
case AC_MODETOGGLE:
@@ -598,12 +602,6 @@ static void sendAButton(LocalDevicePtr local, int button, int mask,
* to be moved in the place where button mappings are changed.
* Only left double is supported.
*/
-#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0
- /* Match the button sent to the actual pos due to a bug in Xorg
- * xserver 1.4. I.e. button1 is button1.
- */
- button_idx = 1;
-#endif
local->dev->button->map [button_idx] = 1;
if (mask)
@@ -749,41 +747,18 @@ static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState* d
{
case AC_BUTTON:
/* send both button on/off in the same event for pad */
- i = 0;
-#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0
- /* Match the button sent to the actual pos due to a bug in Xorg
- * xserver 1.4. I.e. button4 is button4. This makes it usable if
- * no exotic configuration is made.
- */
- i = fakeButton & AC_CODE;
-#endif
- local->dev->button->map [i] = fakeButton & AC_CODE;
+ local->dev->button->map [0] = fakeButton & AC_CODE;
- xf86PostButtonEvent(local->dev, is_absolute, i,
+ xf86PostButtonEvent(local->dev, is_absolute, 0,
1,0,naxes,x,y,z,v3,v4,v5);
- xf86PostButtonEvent(local->dev, is_absolute, i,
+ xf86PostButtonEvent(local->dev, is_absolute, 0,
0,0,naxes,x,y,z,v3,v4,v5);
-
break;
case AC_KEY:
- if (fakeButton & AC_CORE)
- {
- /* modifier and key down then key up events */
- for (i=0; i<((fakeButton & AC_NUM_KEYS)>>20); i++)
- {
- emitKeysym (inputInfo.keyboard, keyP[i], 1);
- if (!WcmIsModifier(keyP[i]))
- emitKeysym (inputInfo.keyboard, keyP[i], 0);
- }
- /* modifier up events */
- for (i=0; i<((fakeButton & AC_NUM_KEYS)>>20); i++)
- if (WcmIsModifier(keyP[i]))
- emitKeysym (inputInfo.keyboard, keyP[i], 0);
- }
- else
- ErrorF ("WARNING: [%s] without SendCoreEvents. Cannot emit key events!\n", local->name);
+ sendKeystroke(local, fakeButton, keyP, 1);
+ sendKeystroke(local, fakeButton, keyP, 0);
break;
default:
@@ -874,7 +849,8 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds)
"b=%s b=%d tx=%d ty=%d wl=%d rot=%d th=%d\n",
(type == STYLUS_ID) ? "stylus" :
(type == CURSOR_ID) ? "cursor" :
- (type == ERASER_ID) ? "eraser" : "pad",
+ (type == ERASER_ID) ? "eraser" :
+ (type == TOUCH_ID) ? "touch" : "pad",
priv->oldProximity ? "true" : "false",
x, y, z, is_button ? "true" : "false", buttons,
tx, ty, wheel, rot, throttle));
@@ -884,18 +860,18 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds)
{
tmp_coord = x;
x = y;
- y = common->wcmMaxY - tmp_coord;
+ y = priv->wcmMaxY - tmp_coord;
}
else if (common->wcmRotate == ROTATE_CCW)
{
tmp_coord = y;
y = x;
- x = common->wcmMaxX - tmp_coord;
+ x = priv->wcmMaxX - tmp_coord;
}
else if (common->wcmRotate == ROTATE_HALF)
{
- x = common->wcmMaxX - x;
- y = common->wcmMaxY - y;
+ x = priv->wcmMaxX - x;
+ y = priv->wcmMaxY - y;
}
if (IsCursor(priv))
@@ -994,8 +970,12 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds)
/* The +-0.4 is to increase the sensitivity in relative mode.
* Must be sensitive to which way the tool is moved or one way
* will get a severe penalty for small movements. */
- x = (int)((double)(x - priv->topX) * priv->factorX + (x>=0?0.4:-0.4));
- y = (int)((double)(y - priv->topY) * priv->factorY + (y>=0?0.4:-0.4));
+ if(is_absolute) {
+ x -= priv->topX;
+ y -= priv->topY;
+ }
+ x = (int)((double)x * priv->factorX + (x>=0?0.4:-0.4));
+ y = (int)((double)y * priv->factorY + (y>=0?0.4:-0.4));
/* map to a specific screen */
if (priv->screen_no != -1 || priv->twinview != TV_NONE)
@@ -1004,11 +984,12 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds)
y += priv->screenTopY[priv->currentScreen];
}
#endif
- sendCommonEvents(local, ds, x, y, z, v3, v4, v5);
-
+ /* Move the cursor to where it should be before sending button events */
if(!(priv->flags & BUTTONS_ONLY_FLAG))
xf86PostMotionEvent(local->dev, is_absolute,
0, naxes, x, y, z, v3, v4, v5);
+
+ sendCommonEvents(local, ds, x, y, z, v3, v4, v5);
}
/* not in proximity */
@@ -1020,6 +1001,7 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds)
* down and becomes out of proximity */
if (priv->oldButtons)
xf86WcmSendButtons(local,0,x,y,z,v3,v4,v5);
+
if (priv->oldProximity && local->dev->proximity)
xf86PostProximityEvent(local->dev,0,0,naxes,x,y,z,v3,v4,v5);
} /* not in proximity */
@@ -1376,6 +1358,9 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel,
case CURSOR_DEVICE_ID:
ds->device_type = CURSOR_ID;
break;
+ case TOUCH_DEVICE_ID:
+ ds->device_type = TOUCH_ID;
+ break;
default:
ds->device_type = idtotype(ds->device_id);
}
@@ -1394,6 +1379,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel,
* hand, the one with serial set to 0 if no match with the
* specified serial exists) that is used for this event */
for (tool = common->wcmTool; tool; tool = tool->next)
+ {
if (tool->typeid == ds->device_type)
{
if (tool->serial == ds->serial_num)
@@ -1401,10 +1387,12 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel,
else if (!tool->serial)
tooldef = tool;
}
+ }
/* Use default tool (serial == 0) if no specific was found */
if (!tool)
tool = tooldef;
+
/* 2: Find the associated area, and its InputDevice */
if (tool)
{
@@ -1616,7 +1604,8 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel,
/* or it gets inside wcmCursorProxoutDist */
else
{
- if (abs(filtered.distance - common->wcmMaxCursorDist) > common->wcmCursorProxoutDist && ds->proximity)
+ if (abs(filtered.distance - common->wcmMaxCursorDist) >
+ common->wcmCursorProxoutDist && ds->proximity)
return;
if (!ds->proximity)
return;
@@ -1643,10 +1632,8 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel,
int xf86WcmInitTablet(LocalDevicePtr local, const char* id, float version)
{
- WacomCommonPtr common = ((WacomDevicePtr)(local->private))->common;
- WacomToolPtr toollist = common->wcmTool;
- WacomToolAreaPtr arealist;
- int temp;
+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
+ WacomCommonPtr common = priv->common;
WacomModelPtr model = common->wcmModel;
/* Initialize the tablet */
@@ -1660,26 +1647,6 @@ int xf86WcmInitTablet(LocalDevicePtr local, const char* id, float version)
if (model->GetRanges && (model->GetRanges(local) != Success))
return !Success;
- /* Rotation rotates the Max Y and Y */
- if (common->wcmRotate==ROTATE_CW || common->wcmRotate==ROTATE_CCW)
- {
- temp = common->wcmMaxX;
- common->wcmMaxX = common->wcmMaxY;
- common->wcmMaxY = temp;
- }
-
- for (; toollist; toollist=toollist->next)
- {
- arealist = toollist->arealist;
- for (; arealist; arealist=arealist->next)
- {
- if (!arealist->bottomX)
- arealist->bottomX = common->wcmMaxX;
- if (!arealist->bottomY)
- arealist->bottomY = common->wcmMaxY;
- }
- }
-
/* Default threshold value if not set */
if (common->wcmThreshold <= 0)
{
@@ -1711,18 +1678,18 @@ int xf86WcmInitTablet(LocalDevicePtr local, const char* id, float version)
}
/* change the serial speed, if requested */
- if (common->wcmLinkSpeed != 9600)
+ if (model->SetLinkSpeed)
{
- if (model->SetLinkSpeed)
+ if (common->wcmLinkSpeed != 9600)
{
if (model->SetLinkSpeed(local) != Success)
return !Success;
}
- else
- {
- ErrorF("Tablet does not support setting link "
- "speed, or not yet implemented\n");
- }
+ }
+ else
+ {
+ DBG(2, common->debugLevel, ErrorF("Tablet does not support setting link "
+ "speed, or not yet implemented\n"));
}
/* output tablet state as probed */
@@ -1872,7 +1839,7 @@ void xf86WcmInitialScreens(LocalDevicePtr local)
priv->screenBottomY[0] = 0;
for (i=0; i<screenInfo.numScreens; i++)
{
-#ifdef WCM_XORG
+#ifdef WCM_HAVE_DIXSCREENORIGINS
priv->screenTopX[i] = dixScreenOrigins[i].x;
priv->screenTopY[i] = dixScreenOrigins[i].y;
priv->screenBottomX[i] = dixScreenOrigins[i].x;
@@ -1881,7 +1848,7 @@ void xf86WcmInitialScreens(LocalDevicePtr local)
DBG(10, priv->debugLevel, ErrorF("xf86WcmInitialScreens from dix for \"%s\" "
"ScreenOrigins[%d].x=%d ScreenOrigins[%d].y=%d \n",
local->name, i, priv->screenTopX[i], i, priv->screenTopY[i]));
-#else
+#else /* WCM_HAVE_DIXSCREENORIGINS */
if (i > 0)
{
/* only support left to right in this case */
@@ -1890,7 +1857,7 @@ void xf86WcmInitialScreens(LocalDevicePtr local)
priv->screenBottomX[i] = priv->screenTopX[i];
priv->screenBottomY[i] = 0;
}
-#endif
+#endif /* WCM_HAVE_DIXSCREENORIGINS */
priv->screenBottomX[i] += screenInfo.screens[i]->width;
priv->screenBottomY[i] += screenInfo.screens[i]->height;
diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c
index c1c4b58..21fb2ea 100755
--- a/src/xdrv/wcmConfig.c
+++ b/src/xdrv/wcmConfig.c
@@ -107,6 +107,10 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
priv->topY = 0; /* Y top */
priv->bottomX = 0; /* X bottom */
priv->bottomY = 0; /* Y bottom */
+ priv->wcmMaxX = 0; /* max tool logical X value */
+ priv->wcmMaxY = 0; /* max tool logical Y value */
+ priv->wcmResolX = 0; /* tool X resolution in points/inch */
+ priv->wcmResolY = 0; /* tool Y resolution in points/inch */
priv->sizeX = 0; /* active X size */
priv->sizeY = 0; /* active Y size */
priv->factorX = 0.0; /* X factor */
@@ -117,7 +121,9 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
priv->old_serial = 0; /* last active tool's serial */
priv->old_device_id = IsStylus(priv) ? STYLUS_DEVICE_ID :
(IsEraser(priv) ? ERASER_DEVICE_ID :
- (IsCursor(priv) ? CURSOR_DEVICE_ID : PAD_DEVICE_ID));
+ (IsCursor(priv) ? CURSOR_DEVICE_ID :
+ (IsTouch(priv) ? TOUCH_DEVICE_ID :
+ PAD_DEVICE_ID)));
priv->devReverseCount = 0; /* flag for relative Reverse call */
priv->serial = 0; /* serial number */
@@ -183,18 +189,10 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
common->wcmFlags = RAW_FILTERING_FLAG; /* various flags */
common->wcmDevices = priv;
common->npadkeys = 0; /* Default number of pad keys */
- common->wcmMaxX = 0; /* max X value */
- common->wcmMaxY = 0; /* max Y value */
- common->wcmMaxZ = 0; /* max Z value */
- common->wcmMaxDist = 0; /* max distance value */
- common->wcmResolX = 0; /* X resolution in points/inch */
- common->wcmResolY = 0; /* Y resolution in points/inch */
- common->wcmMaxStripX = 4096; /* Max fingerstrip X */
- common->wcmMaxStripY = 4096; /* Max fingerstrip Y */
common->wcmProtocolLevel = 4; /* protocol level */
common->wcmThreshold = 0; /* unconfigured threshold */
common->wcmLinkSpeed = 9600; /* serial link speed */
- common->wcmISDV4Speed = 19200; /* serial ISDV4 link speed */
+ common->wcmISDV4Speed = 38400; /* serial ISDV4 link speed */
common->debugLevel = 0; /* shared debug level can only
* be changed though xsetwacom */
@@ -204,7 +202,21 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
common->wcmTPCButtonDefault = 0; /* default Tablet PC button support is off */
common->wcmTPCButton =
common->wcmTPCButtonDefault; /* set Tablet PC button on/off */
- common->wcmRotate = ROTATE_NONE; /* default tablet rotation to off */
+ common->wcmRotate = ROTATE_NONE; /* default tablet rotation to off */
+ common->wcmMaxX = 0; /* max digitizer logical X value */
+ common->wcmMaxY = 0; /* max digitizer logical Y value */
+ common->wcmMaxTouchX = 1024; /* max touch X value */
+ common->wcmMaxTouchY = 1024; /* max touch Y value */
+ common->wcmMaxZ = 0; /* max Z value */
+ common->wcmMaxDist = 0; /* max distance value */
+ common->wcmResolX = 0; /* digitizer X resolution in points/inch */
+ common->wcmResolY = 0; /* digitizer Y resolution in points/inch */
+ common->wcmTouchResolX = 0; /* touch X resolution in points/inch */
+ common->wcmTouchResolY = 0; /* touch Y resolution in points/inch */
+ common->wcmMaxStripX = 4096; /* Max fingerstrip X */
+ common->wcmMaxStripY = 4096; /* Max fingerstrip Y */
+ common->wcmMaxtiltX = 128; /* Max tilt in X directory */
+ common->wcmMaxtiltY = 128; /* Max tilt in Y directory */
common->wcmMaxCursorDist = 0; /* Max distance received so far */
common->wcmCursorProxoutDist = 0;
/* Max mouse distance for proxy-out max/256 units */
@@ -219,7 +231,7 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag)
priv->tool = tool;
common->wcmTool = tool;
tool->next = NULL; /* next tool in list */
- tool->typeid = DEVICE_ID(flag); /* tool type (stylus/eraser/cursor/pad) */
+ tool->typeid = DEVICE_ID(flag); /* tool type (stylus/touch/eraser/cursor/pad) */
tool->serial = 0; /* serial id */
tool->current = NULL; /* current area in-prox */
tool->arealist = area; /* list of defined areas */
@@ -247,6 +259,18 @@ LocalDevicePtr xf86WcmAllocateStylus(void)
return local;
}
+/* xf86WcmAllocateTouch */
+
+LocalDevicePtr xf86WcmAllocateTouch(void)
+{
+ LocalDevicePtr local = xf86WcmAllocate(XI_TOUCH, ABSOLUTE_FLAG|TOUCH_ID);
+
+ if (local)
+ local->type_name = "Wacom Touch";
+
+ return local;
+}
+
/* xf86WcmAllocateCursor */
LocalDevicePtr xf86WcmAllocateCursor(void)
@@ -427,6 +451,8 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
if (s && (xf86NameCmp(s, "stylus") == 0))
local = xf86WcmAllocateStylus();
+ else if (s && (xf86NameCmp(s, "touch") == 0))
+ local = xf86WcmAllocateTouch();
else if (s && (xf86NameCmp(s, "cursor") == 0))
local = xf86WcmAllocateCursor();
else if (s && (xf86NameCmp(s, "eraser") == 0))
@@ -436,7 +462,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
else
{
xf86Msg(X_ERROR, "%s: No type or invalid type specified.\n"
- "Must be one of stylus, cursor, eraser, or pad\n",
+ "Must be one of stylus, touch, cursor, eraser, or pad\n",
dev->identifier);
goto SetupProc_fail;
}
@@ -455,26 +481,42 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
local->name = dev->identifier;
xfree(fakeLocal);
- /* Serial Device is mandatory */
common->wcmDevice = xf86FindOptionValue(local->options, "Device");
+#ifdef LINUX_INPUT
+ /* Autoprobe if not given */
+ if (!common->wcmDevice || !strcmp (common->wcmDevice, "auto-dev"))
+ {
+ common->wcmFlags |= AUTODEV_FLAG;
+ if (! (common->wcmDevice = xf86WcmEventAutoDevProbe (local)))
+ {
+ xf86Msg(X_ERROR, "%s: unable to probe device\n",
+ dev->identifier);
+ goto SetupProc_fail;
+ }
+ }
+#else
if (!common->wcmDevice)
{
xf86Msg(X_ERROR, "%s: No Device specified.\n", dev->identifier);
goto SetupProc_fail;
}
+#endif
/* Lookup to see if there is another wacom device sharing
* the same serial line.
*/
localDevices = xf86FirstLocalDevice();
- for (; localDevices != NULL; localDevices = localDevices->next)
+ if (common->wcmDevice)
{
- if (xf86WcmMatchDevice(localDevices,local))
+ for (; localDevices != NULL; localDevices = localDevices->next)
{
- common = priv->common;
- break;
+ if (xf86WcmMatchDevice(localDevices,local))
+ {
+ common = priv->common;
+ break;
+ }
}
}
@@ -608,7 +650,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
* Slightly raised curve might be 0,5,95,100
*/
s = xf86FindOptionValue(local->options, "PressCurve");
- if (s && !IsCursor(priv))
+ if (s && !IsCursor(priv) && !IsTouch(priv))
{
int a,b,c,d;
if ((sscanf(s,"%d,%d,%d,%d",&a,&b,&c,&d) != 4) ||
@@ -736,17 +778,23 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
xf86Msg(X_CONFIG, "%s: threshold = %d\n", dev->identifier,
common->wcmThreshold);
- common->wcmMaxX = xf86SetIntOption(local->options, "MaxX",
- common->wcmMaxX);
- if (common->wcmMaxX != 0)
+ priv->wcmMaxX = xf86SetIntOption(local->options, "MaxX",
+ priv->wcmMaxX);
+ if (priv->wcmMaxX != 0)
xf86Msg(X_CONFIG, "%s: max x = %d\n", dev->identifier,
- common->wcmMaxX);
+ priv->wcmMaxX);
+
+ /* Update tablet logical max X */
+ if (!IsTouch(priv)) common->wcmMaxX = priv->wcmMaxX;
- common->wcmMaxY = xf86SetIntOption(local->options, "MaxY",
- common->wcmMaxY);
- if (common->wcmMaxY != 0)
+ priv->wcmMaxY = xf86SetIntOption(local->options, "MaxY",
+ priv->wcmMaxY);
+ if (priv->wcmMaxY != 0)
xf86Msg(X_CONFIG, "%s: max y = %d\n", dev->identifier,
- common->wcmMaxY);
+ priv->wcmMaxY);
+
+ /* Update tablet logical max Y */
+ if (!IsTouch(priv)) common->wcmMaxY = priv->wcmMaxY;
common->wcmMaxZ = xf86SetIntOption(local->options, "MaxZ",
common->wcmMaxZ);
@@ -786,7 +834,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags)
xf86Msg(X_CONFIG, "%s: Tablet PC buttons on \n", common->wcmDevice);
}
- /* Cursor stays in one monitor in a multimonitor setup */
+ /* Mouse cursor stays in one monitor in a multimonitor setup */
if ( !priv->wcmMMonitor )
{
priv->wcmMMonitor = xf86SetBoolOption(local->options, "MMonitor", 1);
diff --git a/src/xdrv/wcmFilter.c b/src/xdrv/wcmFilter.c
index 7e8d4fd..9bd77da 100755
--- a/src/xdrv/wcmFilter.c
+++ b/src/xdrv/wcmFilter.c
@@ -1,6 +1,6 @@
/*
* Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
- * Copyright 2002-2007 by Ping Cheng, Wacom. <pingc@wacom.com>
+ * Copyright 2002-2008 by Ping Cheng, Wacom. <pingc@wacom.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -219,16 +219,16 @@ static void filterIntuosStylus(WacomCommonPtr common, WacomFilterStatePtr state,
ds->y = y / common->wcmRawSample;
ds->tiltx = tx / common->wcmRawSample;
- if (ds->tiltx > 63)
- ds->tiltx = 63;
- else if (ds->tiltx < -64)
- ds->tiltx = -64;
+ if (ds->tiltx > common->wcmMaxtiltX/2-1)
+ ds->tiltx = common->wcmMaxtiltX/2-1;
+ else if (ds->tiltx < -common->wcmMaxtiltX/2)
+ ds->tiltx = -common->wcmMaxtiltX/2;
ds->tilty = ty / common->wcmRawSample;
- if (ds->tilty > 63)
- ds->tilty = 63;
- else if (ds->tilty < -64)
- ds->tilty = -64;
+ if (ds->tilty > common->wcmMaxtiltY/2-1)
+ ds->tilty = common->wcmMaxtiltY/2-1;
+ else if (ds->tilty < -common->wcmMaxtiltY/2)
+ ds->tilty = -common->wcmMaxtiltY/2;
}
/*****************************************************************************
diff --git a/src/xdrv/wcmISDV4.c b/src/xdrv/wcmISDV4.c
index 7d0bfcd..9c66110 100755
--- a/src/xdrv/wcmISDV4.c
+++ b/src/xdrv/wcmISDV4.c
@@ -1,6 +1,6 @@
/*
* Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
- * Copyright 2002-2007 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
+ * Copyright 2002-2008 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -66,18 +66,38 @@ static Bool isdv4Detect(LocalDevicePtr local)
static Bool isdv4Init(LocalDevicePtr local, char* id, float *version)
{
- int err;
WacomDevicePtr priv = (WacomDevicePtr)local->private;
WacomCommonPtr common = priv->common;
DBG(1, priv->debugLevel, ErrorF("initializing ISDV4 tablet\n"));
- /* Try 19200 first */
+ /* Try 38400 first */
if (xf86WcmSetSerialSpeed(local->fd, common->wcmISDV4Speed) < 0)
return !Success;
+ if(id)
+ strcpy(id, "ISDV4");
+ if(version)
+ *version = common->wcmVersion;
+
+ /*set the model */
+ common->wcmModel = &isdv4General;
+
+ return Success;
+}
+
+/*****************************************************************************
+ * isdv4Query -- Query the device
+ ****************************************************************************/
+
+static int isdv4Query(LocalDevicePtr local, const char* query, char* data)
+{
+ int err;
+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
+ WacomCommonPtr common = priv->common;
+
/* Send stop command to the tablet */
- err = xf86WcmWrite(local->fd, WC_ISDV4_STOP, strlen(WC_ISDV4_STOP));
+ err = xf86WcmWrite(local->fd, query, strlen(query));
if (err == -1)
{
ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
@@ -87,15 +107,40 @@ static Bool isdv4Init(LocalDevicePtr local, char* id, float *version)
/* Wait 250 mSecs */
if (xf86WcmWait(250))
return !Success;
+
+ /* Send query command to the tablet */
+ if (!xf86WcmWriteWait(local->fd, query))
+ {
+ ErrorF("Wacom unable to xf86WcmWrite request %s query command "
+ "after %d tries\n", query, MAXTRY);
+ return !Success;
+ }
- if(id)
- strcpy(id, "ISDV4");
- if(version)
- *version = common->wcmVersion;
-
- /*set the model */
- common->wcmModel = &isdv4General;
+ /* Read the control data */
+ if (!xf86WcmWaitForTablet(local->fd, data, 11))
+ {
+ ErrorF("Wacom unable to read ISDV4 control data "
+ "after %d tries\n", MAXTRY);
+ return !Success;
+ }
+ /* Control data bit check */
+ if ( !(data[0] & 0x40) ) /* baudrate too high? */
+ {
+ /* Try 19200 now */
+ if (common->wcmISDV4Speed != 19200)
+ {
+ common->wcmISDV4Speed = 19200;
+ if(isdv4Init(local, NULL, NULL) != Success)
+ return !Success;
+ return isdv4GetRanges(local);
+ }
+ else
+ {
+ ErrorF("Wacom Query ISDV4 error magic error in %s query\n", query);
+ return !Success;
+ }
+ }
return Success;
}
@@ -104,92 +149,87 @@ static Bool isdv4Init(LocalDevicePtr local, char* id, float *version)
****************************************************************************/
static void isdv4InitISDV4(WacomCommonPtr common, const char* id, float version)
-{
+{
/* set parameters */
common->wcmProtocolLevel = 4;
- common->wcmPktLength = 5; /* length of a packet
+ common->wcmPktLength = 9; /* length of a packet
* device packets are 9 bytes long,
* multitouch are only 5 */
- common->wcmResolX = 2540; /* tablet X resolution in points/inch */
- common->wcmResolY = 2540; /* tablet Y resolution in points/inch */
+
+ /* digitizer X resolution in points/inch */
+ common->wcmResolX = 2540;
+ /* digitizer Y resolution in points/inch */
+ common->wcmResolY = 2540;
+
common->wcmTPCButton = 1; /* Tablet PC buttons on by default */
common->wcmTPCButtonDefault = 1;
common->tablet_id = 0x90;
}
+
+
+/*****************************************************************************
+ * isdv4GetRanges -- get ranges of the device
+ ****************************************************************************/
+
static int isdv4GetRanges(LocalDevicePtr local)
{
char data[BUFFER_SIZE];
WacomDevicePtr priv = (WacomDevicePtr)local->private;
- int maxtry = MAXTRY, nr;
WacomCommonPtr common = priv->common;
DBG(2, priv->debugLevel, ErrorF("getting ISDV4 Ranges\n"));
- /* Send query command to the tablet */
- do
- {
- nr = xf86WcmWrite(local->fd, WC_ISDV4_QUERY, strlen(WC_ISDV4_QUERY));
- if ((nr == -1) && (errno != EAGAIN))
- {
- ErrorF("Wacom xf86WcmWrite error : %s", strerror(errno));
- return !Success;
- }
- maxtry--;
- } while ((nr == -1) && maxtry);
- if (maxtry == 0)
+ /* Send query command to the tablet */
+ if (isdv4Query(local, WC_ISDV4_QUERY, data) == Success)
{
- ErrorF("Wacom unable to xf86WcmWrite request query command "
- "after %d tries\n", MAXTRY);
- return !Success;
+ /* transducer data */
+ common->wcmMaxZ = ( data[5] |
+ ((data[6] & 0x07) << 7) );
+ common->wcmMaxX = ( (data[1] << 9) |
+ (data[2] << 2) | ( (data[6] & 0x60) >> 5) );
+ common->wcmMaxY = ( (data[3] << 9) | (data[4] << 2 )
+ | ( (data[6] & 0x18) >> 3) );
+ common->wcmMaxtiltX = data[7] + 1;
+ common->wcmMaxtiltY = data[8] + 1;
+ common->wcmVersion = ( data[10] | (data[9] << 7) );
}
+ else
+ return !Success;
- /* Read the control data */
- maxtry = MAXTRY;
- do
+ if (common->wcmISDV4Speed != 19200)
{
- if ((nr = xf86WcmWaitForTablet(local->fd)) > 0)
+ /* Touch might be supported. Send a touch query command */
+ if (isdv4Query(local, WC_ISDV4_TOUCH_QUERY, data) == Success)
{
- nr = xf86WcmRead(local->fd, data, 11);
- if ((nr == -1) && (errno != EAGAIN))
+ if (data[0] & 0x41)
{
- ErrorF("Wacom xf86WcmRead error : %s\n", strerror(errno));
- return !Success;
+ switch (data[1])
+ {
+ case 0x00: /* touch is not supported */
+ common->wcmPktLength = 9;
+ break;
+ case 0x0C:
+ common->wcmMaxTouchX = 4096;
+ common->wcmMaxTouchY = 4096;
+ break;
+ case 0x0E:
+ common->wcmMaxTouchX = 16392;
+ common->wcmMaxTouchY = 16392;
+ break;
+ }
}
}
- maxtry--;
- } while ( nr <= 0 && maxtry );
-
- if (maxtry == 0 && nr <= 0 )
- {
- ErrorF("Wacom unable to read ISDV4 control data "
- "after %d tries\n", MAXTRY);
- return !Success;
- }
- /* Control data bit check */
- if ( !(data[0] & 0x40) )
- {
- /* Try 38400 now */
- if (common->wcmISDV4Speed != 38400)
- {
- common->wcmISDV4Speed = 38400;
- if(isdv4Init(local, NULL, NULL) != Success)
- return !Success;
- return isdv4GetRanges(local);
- }
- else
+ if (common->wcmMaxX && common->wcmPktLength == 5)
{
- ErrorF("Wacom Query ISDV4 error magic error \n");
- return !Success;
+ /* Touch resolution */
+ common->wcmTouchResolX = common->wcmMaxTouchX *
+ common->wcmResolX / common->wcmMaxX;
+ common->wcmTouchResolY = common->wcmMaxTouchY *
+ common->wcmResolY / common->wcmMaxY;
+ common->tablet_id = 0x93;
}
}
-
- common->wcmMaxZ = ( data[5] | ((data[6] & 0x07) << 7) );
- common->wcmMaxX = ( (data[1] << 9) | (data[2] << 2)
- | ( (data[6] & 0x60) >> 5) );
- common->wcmMaxY = ( (data[3] << 9) | (data[4] << 2 )
- | ( (data[6] & 0x18) >> 3) );
- common->wcmVersion = ( data[10] | (data[9] << 7) );
return Success;
}
@@ -216,25 +256,32 @@ static int isdv4Parse(LocalDevicePtr local, const unsigned char* data)
WacomCommonPtr common = priv->common;
WacomDeviceState* last = &common->wcmChannel[0].valid.state;
WacomDeviceState* ds;
- int n, cur_type, ismt = 0;
- static int lastismt = 0;
+ int n, cur_type, channel;
DBG(10, common->debugLevel, ErrorF("isdv4Parse \n"));
- /* determine the type of message */
- if (data[0] & 0x10)
+ /* determine the type of message (touch or stylus)*/
+ if (data[0] & 0x18)
{
- ismt = 1;
- common->wcmPktLength = 5;
+ ds = &common->wcmChannel[0].work;
+ if (common->wcmPktLength == 9 && ds->proximity)
+ return 5; /* ignore touch event */
+ else
+ {
+ common->wcmPktLength = 5;
+ channel = 1;
+ }
}
else
{
common->wcmPktLength = 9;
- if (common->buffer + common->bufpos - data < common->wcmPktLength)
- {
- /* we can't handle this yet */
- return 0;
- }
+ channel = 0;
+ }
+
+ if (common->buffer + common->bufpos - data < common->wcmPktLength)
+ {
+ /* we can't handle this yet */
+ return common->wcmPktLength;
}
if ((n = xf86WcmSerialValidate(common,data)) > 0)
@@ -242,34 +289,24 @@ static int isdv4Parse(LocalDevicePtr local, const unsigned char* data)
else
{
/* Coordinate data bit check */
- if (data[0] & 0x40)
+ if (data[0] & 0x40) /* control data*/
return common->wcmPktLength;
}
+
/* pick up where we left off, minus relative values */
- ds = &common->wcmChannel[0].work;
+ ds = &common->wcmChannel[channel].work;
RESET_RELATIVE(*ds);
- if (ismt)
+ if (common->wcmPktLength == 5 ) /* a touch */
{
- if (!lastismt && last->pressure)
- {
- /* pen sends both pen and MultiTouch input,
- * since pressing it creates pressure.
- * We only want the pen input though.
- */
- return common->wcmPktLength;
- }
- lastismt = ismt;
-
- /* MultiTouch input is comparably simple */
- ds->proximity = 0;
- ds->x = (((((int)data[1]) << 7) | ((int)data[2])) - 18) * common->wcmMaxX / 926;
- ds->y = (((((int)data[3]) << 7) | ((int)data[4])) - 51) * common->wcmMaxY / 934;
- ds->pressure = (data[0] & 0x01) * common->wcmMaxZ;
- ds->buttons = 1;
- ds->device_id = STYLUS_DEVICE_ID;
- ds->device_type = 0;
- DBG(8, priv->debugLevel, ErrorF("isdv4Parse MultiTouch\n"));
+ /* MultiTouch input only has 5 bytes of data */
+ ds->x = (((int)data[1]) << 7) | ((int)data[2]);
+ ds->y = (((int)data[3]) << 7) | ((int)data[4]);
+ ds->buttons = ds->proximity = data[0] & 0x01;
+ ds->device_type = TOUCH_ID;
+ ds->device_id = TOUCH_DEVICE_ID;
+ DBG(8, priv->debugLevel, ErrorF("isdv4Parse MultiTouch "
+ "%s proximity \n", ds->proximity ? "in" : "out of"));
}
else
{
@@ -324,7 +361,7 @@ static int isdv4Parse(LocalDevicePtr local, const unsigned char* data)
ds->device_type == ERASER_ID ? "ERASER " :
ds->device_type == STYLUS_ID ? "STYLUS" : "NONE"));
}
- xf86WcmEvent(common,0,ds);
+ xf86WcmEvent(common, channel, ds);
return common->wcmPktLength;
}
diff --git a/src/xdrv/wcmSerial.c b/src/xdrv/wcmSerial.c
index 678ea1c..7bb071b 100755
--- a/src/xdrv/wcmSerial.c
+++ b/src/xdrv/wcmSerial.c
@@ -241,33 +241,76 @@ static void serialParseP4Common(LocalDevicePtr local, const unsigned char* data,
*/
/*****************************************************************************
- * xf86WcmSendRequest --
- * send a request and wait for the answer.
- * the answer must begin with the first two chars of the request.
- * The last character in the answer string is replaced by a \0.
+ * xf86WcmWrite --
+ * send a request
****************************************************************************/
-char* xf86WcmSendRequest(int fd, const char* request, char* answer, int maxlen)
+int xf86WcmWriteWait(int fd, const char* request)
{
- int len, nr;
- int maxtry = MAXTRY;
+ int len, maxtry = MAXTRY;
- if (maxlen < 3)
- return NULL;
-
/* send request string */
do
{
- len = xf86WcmWrite(fd, request, strlen(request));
+ len = xf86WriteSerial(fd, request, strlen(request));
if ((len == -1) && (errno != EAGAIN))
{
ErrorF("Wacom xf86WcmWrite error : %s", strerror(errno));
- return NULL;
+ return 0;
}
+
maxtry--;
- } while ((len == -1) && maxtry);
- if (maxtry == 0)
+ } while ((len <= 0) && maxtry);
+
+ return maxtry;
+}
+
+/*****************************************************************************
+ * xf86WcmWaitForTablet --
+ * wait for tablet data
+ ****************************************************************************/
+
+int xf86WcmWaitForTablet(int fd, char* answer, int size)
+{
+ int len, maxtry = MAXTRY;
+
+ /* Read size bytes of the answer */
+ do
+ {
+ if ((len = xf86WaitForInput(fd, 1000000)) > 0)
+ {
+ len = xf86WcmRead(fd, answer, size);
+ if ((len == -1) && (errno != EAGAIN))
+ {
+ ErrorF("Wacom xf86WcmRead error : %s\n",
+ strerror(errno));
+ return 0;
+ }
+ }
+ maxtry--;
+ } while ((len <= 0) && maxtry);
+
+ return maxtry;
+}
+
+/*****************************************************************************
+ * xf86WcmSendRequest --
+ * send a request and wait for the answer.
+ * the answer must begin with the first two chars of the request.
+ * The last character in the answer string is replaced by a \0.
+ ****************************************************************************/
+
+char* xf86WcmSendRequest(int fd, const char* request, char* answer, int maxlen)
+{
+ int len, nr = 0;
+ int maxtry = MAXTRY;
+
+ if (maxlen < 3)
+ return NULL;
+
+ /* wait for request return */
+ if (!xf86WcmWriteWait(fd, request))
{
ErrorF("Wacom unable to xf86WcmWrite request string '%s' "
"after %d tries\n", request, MAXTRY);
@@ -276,92 +319,63 @@ char* xf86WcmSendRequest(int fd, const char* request, char* answer, int maxlen)
do
{
- maxtry = MAXTRY;
-
/* Read the first byte of the answer which must
* be equal to the first byte of the request.
*/
- do
- {
- if ((nr = xf86WcmWaitForTablet(fd)) > 0)
- {
- nr = xf86WcmRead(fd, answer, 1);
- if ((nr == -1) && (errno != EAGAIN))
- {
- ErrorF("Wacom xf86WcmRead error : %s\n",
- strerror(errno));
- return NULL;
- }
- }
- maxtry--;
- } while ((answer[0] != request[0]) && maxtry);
-
- if (maxtry == 0)
+ maxtry = xf86WcmWaitForTablet(fd, answer, 1);
+ if (answer[0] != request[0])
{
ErrorF("Wacom unable to read first byte of "
"request '%c%c' answer after %d tries\n",
- request[0], request[1], MAXTRY);
+ request[0], request[1], maxtry);
return NULL;
}
/* Read the second byte of the answer which must be equal
* to the second byte of the request. */
- do
+ if (!xf86WcmWaitForTablet(fd, answer+1, 1))
{
- maxtry = MAXTRY;
- do
- {
- if ((nr = xf86WcmWaitForTablet(fd)) > 0)
- {
- nr = xf86WcmRead(fd, answer+1, 1);
- if ((nr == -1) && (errno != EAGAIN))
- {
- ErrorF("Wacom xf86WcmRead error : %s\n",
- strerror(errno));
- return NULL;
- }
- }
- maxtry--;
- } while ((nr <= 0) && maxtry);
-
- if (maxtry == 0)
- {
- ErrorF("Wacom unable to read second byte of "
- "request '%c%c' answer after %d "
- "tries\n", request[0], request[1],
- MAXTRY);
- return NULL;
- }
+ ErrorF("Wacom unable to read second byte of "
+ "request '%c%c' answer after %d "
+ "tries\n", request[0], request[1], maxtry);
+ return NULL;
+ }
- if (answer[1] != request[1])
- answer[0] = answer[1];
+ if (answer[1] != request[1])
+ answer[0] = answer[1];
- } while ((answer[0] == request[0]) && (answer[1] != request[1]));
+ } while ((answer[0] == request[0]) && (answer[1] != request[1]));
- } while ((answer[0] != request[0]) && (answer[1] != request[1]));
/* Read until we don't get anything or timeout. */
len = 2;
- maxtry = MAXTRY;
do
{
- do
+ if (len == 2)
{
- if ((nr = xf86WcmWaitForTablet(fd)) > 0)
+ if (!xf86WcmWaitForTablet(fd, answer+len, 1))
{
- nr = xf86WcmRead(fd, answer+len, 1);
- if ((nr == -1) && (errno != EAGAIN))
- {
- ErrorF("Wacom xf86WcmRead error : %s\n", strerror(errno));
- return NULL;
- }
+ ErrorF("Wacom unable to read last byte of request '%c%c' "
+ "answer after %d tries\n",
+ request[0], request[1], MAXTRY);
+ return NULL;
}
- else
+ len++;
+ }
+
+ErrorF("Wacom xf86WcmWaitForTablet : %s\n", answer);
+ if ((nr = xf86WaitForInput(fd, 1000000)) > 0)
+ {
+ nr = xf86WcmRead(fd, answer+len, 1);
+ if ((nr == -1) && (errno != EAGAIN))
{
- if (len == 2) maxtry--;
+ ErrorF("Wacom xf86WcmRead in xf86WcmSendRequest error : %s\n",
+ strerror(errno));
+ return NULL;
}
- } while ((nr <= 0) && len == 2 && maxtry);
+ }
+ErrorF("Wacom xf86WcmRead : %s\n", answer);
if (nr > 0)
{
@@ -370,12 +384,6 @@ char* xf86WcmSendRequest(int fd, const char* request, char* answer, int maxlen)
return NULL;
}
- if (maxtry == 0)
- {
- ErrorF("Wacom unable to read last byte of request '%c%c' answer after %d tries\n",
- request[0], request[1], MAXTRY);
- break;
- }
} while (nr > 0);
if (len <= 3)
@@ -1234,9 +1242,9 @@ static void serialParseP4Common(LocalDevicePtr local,
ds->tiltx = (data[7] & TILT_BITS);
ds->tilty = (data[8] & TILT_BITS);
if (data[7] & TILT_SIGN_BIT)
- ds->tiltx -= 64;
+ ds->tiltx -= common->wcmMaxtiltX/2;
if (data[8] & TILT_SIGN_BIT)
- ds->tilty -= 64;
+ ds->tilty -= common->wcmMaxtiltY/2;
}
/* first time into prox */
diff --git a/src/xdrv/wcmSerial.h b/src/xdrv/wcmSerial.h
index 0d5f614..2836efd 100755
--- a/src/xdrv/wcmSerial.h
+++ b/src/xdrv/wcmSerial.h
@@ -1,6 +1,6 @@
/*
* Copyright 1995-2003 by Frederic Lepied, France. <Lepied@XFree86.org>
- * Copyright 2002-2007 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
+ * Copyright 2002-2008 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,6 +29,7 @@
#define WC_COORD "~C\r" /* request max coordinates */
#define WC_MODEL "~#\r" /* request model and ROM version */
#define WC_ISDV4_QUERY "*" /* ISDV4 query command */
+#define WC_ISDV4_TOUCH_QUERY "%" /* ISDV4 touch query command */
#define WC_ISDV4_STOP "0" /* ISDV4 stop command */
#define WC_ISDV4_SAMPLING "1" /* ISDV4 sampling command */
diff --git a/src/xdrv/wcmUSB.c b/src/xdrv/wcmUSB.c
index a8b11b2..db2d5fe 100755
--- a/src/xdrv/wcmUSB.c
+++ b/src/xdrv/wcmUSB.c
@@ -556,7 +556,8 @@ int usbWcmGetRanges(LocalDevicePtr local)
int nValues[5];
unsigned long ev[NBITS(EV_MAX)];
unsigned long abs[NBITS(ABS_MAX)];
- WacomCommonPtr common = ((WacomDevicePtr)(local->private))->common;
+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
+ WacomCommonPtr common = priv->common;
if (ioctl(local->fd, EVIOCGBIT(0 /*EV*/, sizeof(ev)), ev) < 0)
{
@@ -858,9 +859,9 @@ static void usbParseChannel(LocalDevicePtr local, int channel, int serial)
else if (event->code == ABS_RZ)
ds->rotation = event->value;
else if (event->code == ABS_TILT_X)
- ds->tiltx = event->value - 64;
+ ds->tiltx = event->value - common->wcmMaxtiltX/2;
else if (event->code == ABS_TILT_Y)
- ds->tilty = event->value - 64;
+ ds->tilty = event->value - common->wcmMaxtiltY/2;
else if (event->code == ABS_PRESSURE)
ds->pressure = event->value;
else if (event->code == ABS_DISTANCE)
@@ -923,7 +924,13 @@ static void usbParseChannel(LocalDevicePtr local, int channel, int serial)
}
else if (event->code == BTN_TOUCH)
{
- /* we use the pressure to determine the button 1 */
+ /* reserved for touch now. Ping March 19, 2008
+ DBG(6, common->debugLevel, ErrorF(
+ "USB Touch detected %x\n",
+ event->code));
+ ds->device_type = TOUCH_ID;
+ ds->proximity = event->value;
+ */
}
else if ((event->code == BTN_STYLUS) ||
(event->code == BTN_MIDDLE))
diff --git a/src/xdrv/wcmXCommand.c b/src/xdrv/wcmXCommand.c
index 3e22d8e..a260008 100644
--- a/src/xdrv/wcmXCommand.c
+++ b/src/xdrv/wcmXCommand.c
@@ -279,7 +279,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
break;
case XWACOM_PARAM_PRESSCURVE:
{
- if ( !IsCursor(priv) && !IsPad (priv) )
+ if ( !IsCursor(priv) && !IsPad (priv) && !IsTouch (priv))
{
char chBuf[64];
int x0 = (value >> 24) & 0xFF;
@@ -326,8 +326,8 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
case XWACOM_PARAM_XYDEFAULT:
xf86WcmSetParam (local, XWACOM_PARAM_TOPX, 0);
xf86WcmSetParam (local, XWACOM_PARAM_TOPY, 0);
- xf86WcmSetParam (local, XWACOM_PARAM_BOTTOMX, common->wcmMaxX);
- xf86WcmSetParam (local, XWACOM_PARAM_BOTTOMY, common->wcmMaxY);
+ xf86WcmSetParam (local, XWACOM_PARAM_BOTTOMX, priv->wcmMaxX);
+ xf86WcmSetParam (local, XWACOM_PARAM_BOTTOMY, priv->wcmMaxY);
break;
case XWACOM_PARAM_MMT:
if ((value != 0) && (value != 1))
@@ -371,9 +371,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
if (value < -1 || value >= priv->numScreen)
return BadValue;
else if (priv->screen_no != value)
- {
xf86WcmChangeScreen(local, value);
- }
break;
case XWACOM_PARAM_TWINVIEW:
if (priv->twinview != value)
@@ -381,7 +379,19 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
if ((value > 2) || (value < 0) || screenInfo.numScreens != 1)
return BadValue;
priv->twinview = value;
- xf86WcmChangeScreen(local, priv->screen_no);
+
+ /* Can not restrict the cursor to a particular screen */
+ if (!value)
+ {
+ value = -1;
+ priv->currentScreen = 0;
+ DBG(10, priv->debugLevel, ErrorF("xf86WcmSetParam(TWINVIEW) TwinView sets to "
+ "TV_NONE: cann't change screen_no. \n"));
+ }
+ else
+ value = priv->screen_no;
+
+ xf86WcmChangeScreen(local, value);
}
break;
case XWACOM_PARAM_TVRESOLUTION0:
@@ -459,16 +469,16 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
return BadValue;
}
oldRotation = common->wcmRotate;
- oldMaxX = common->wcmMaxX;
- oldMaxY = common->wcmMaxY;
+ oldMaxX = priv->wcmMaxX;
+ oldMaxY = priv->wcmMaxY;
common->wcmRotate = value;
if (((oldRotation == ROTATE_NONE || oldRotation == ROTATE_HALF) &&
(value == ROTATE_CW || value == ROTATE_CCW)) ||
((oldRotation == ROTATE_CW || oldRotation == ROTATE_CCW)
&& (value == ROTATE_NONE || value == ROTATE_HALF)))
{
- common->wcmMaxX = oldMaxY;
- common->wcmMaxY = oldMaxX;
+ priv->wcmMaxX = oldMaxY;
+ priv->wcmMaxY = oldMaxX;
}
/* rotate all devices at once! else they get misaligned */
@@ -507,20 +517,20 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
case ROTATE_CW:
tmparea->topX = tmppriv->topX = tmpTopY;
tmparea->bottomX = tmppriv->bottomX = tmpBottomY;
- tmparea->topY = tmppriv->topY = common->wcmMaxY - tmpBottomX;
- tmparea->bottomY = tmppriv->bottomY = common->wcmMaxY - tmpTopX;
+ tmparea->topY = tmppriv->topY = priv->wcmMaxY - tmpBottomX;
+ tmparea->bottomY = tmppriv->bottomY = priv->wcmMaxY - tmpTopX;
break;
case ROTATE_CCW:
- tmparea->topX = tmppriv->topX = common->wcmMaxX - tmpBottomY;
- tmparea->bottomX = tmppriv->bottomX = common->wcmMaxX - tmpTopY;
+ tmparea->topX = tmppriv->topX = priv->wcmMaxX - tmpBottomY;
+ tmparea->bottomX = tmppriv->bottomX = priv->wcmMaxX - tmpTopY;
tmparea->topY = tmppriv->topY = tmpTopX;
tmparea->bottomY = tmppriv->bottomY = tmpBottomX;
break;
case ROTATE_HALF:
- tmparea->topX = tmppriv->topX = common->wcmMaxX - tmpBottomX;
- tmparea->bottomX = tmppriv->bottomX = common->wcmMaxX - tmpTopX;
- tmparea->topY = tmppriv->topY= common->wcmMaxY - tmpBottomY;
- tmparea->bottomY = tmppriv->bottomY = common->wcmMaxY - tmpTopY;
+ tmparea->topX = tmppriv->topX = priv->wcmMaxX - tmpBottomX;
+ tmparea->bottomX = tmppriv->bottomX = priv->wcmMaxX - tmpTopX;
+ tmparea->topY = tmppriv->topY= priv->wcmMaxY - tmpBottomY;
+ tmparea->bottomY = tmppriv->bottomY = priv->wcmMaxY - tmpTopY;
break;
default: /* ROTATE_NONE */
tmparea->topX = tmppriv->topX = tmpTopX;
@@ -825,7 +835,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param)
case XWACOM_PARAM_RAWSAMPLE:
return common->wcmRawSample;
case XWACOM_PARAM_PRESSCURVE:
- if (!IsCursor (priv) && !IsPad (priv))
+ if (!IsCursor (priv) && !IsPad (priv) && !IsTouch (priv))
return (priv->nPressCtrl [0] << 24) |
(priv->nPressCtrl [1] << 16) |
(priv->nPressCtrl [2] << 8) |
@@ -981,9 +991,9 @@ static int xf86WcmGetDefaultParam(LocalDevicePtr local, int param)
case XWACOM_PARAM_TOPY:
return 0;
case XWACOM_PARAM_BOTTOMX:
- return common->wcmMaxX;
+ return priv->wcmMaxX;
case XWACOM_PARAM_BOTTOMY:
- return common->wcmMaxY;
+ return priv->wcmMaxY;
case XWACOM_PARAM_BUTTON1:
case XWACOM_PARAM_BUTTON2:
case XWACOM_PARAM_BUTTON3:
@@ -991,9 +1001,9 @@ static int xf86WcmGetDefaultParam(LocalDevicePtr local, int param)
case XWACOM_PARAM_BUTTON5:
return (param - XWACOM_PARAM_BUTTON1 + 1);
case XWACOM_PARAM_MODE:
- if (IsCursor(priv) || (IsPad(priv) && (priv->flags & COREEVENT_FLAG)))
+ if (IsCursor(priv) || (IsPad(priv) && (priv->flags & COREEVENT_FLAG)))
return 0;
- else
+ else
return 1;
case XWACOM_PARAM_RELWUP:
case XWACOM_PARAM_ABSWUP:
@@ -1016,7 +1026,7 @@ static int xf86WcmGetDefaultParam(LocalDevicePtr local, int param)
case XWACOM_PARAM_TPCBUTTON:
return common->wcmTPCButtonDefault;
case XWACOM_PARAM_PRESSCURVE:
- if (!IsCursor (priv) && !IsPad (priv))
+ if (!IsCursor (priv) && !IsPad (priv) && !IsTouch (priv))
return (0 << 24) | (0 << 16) | (100 << 8) | 100;
return -1;
case XWACOM_PARAM_SUPPRESS:
diff --git a/src/xdrv/xf86Wacom.c b/src/xdrv/xf86Wacom.c
index 4f96383..761fd7a 100755
--- a/src/xdrv/xf86Wacom.c
+++ b/src/xdrv/xf86Wacom.c
@@ -66,9 +66,10 @@
* 2008-01-08 47-pc0.7.9-6 - Configure script change for Xorg 7.3 support
* 2008-01-17 47-pc0.7.9-7 - Preparing for hotplug-aware driver
* 2008-02-27 47-pc0.7.9-8 - Support Cintiq 20
+ * 2008-03-07 47-pc0.7.9-9 - Support keystrokes in wacomcpl
*/
-static const char identification[] = "$Identification: 47-0.7.9-8 $";
+static const char identification[] = "$Identification: 47-0.7.9-9 $";
/****************************************************************************/
@@ -107,9 +108,17 @@ WacomModule gWacomModule =
xf86WcmDevReverseConvert,
};
+#ifdef WCM_KEY_SENDING_SUPPORT
static void xf86WcmKbdLedCallback(DeviceIntPtr di, LedCtrl * lcp)
{
}
+static void xf86WcmBellCallback(int pct, DeviceIntPtr di, pointer ctrl, int x)
+{
+}
+static void xf86WcmKbdCtrlCallback(DeviceIntPtr di, KeybdCtrl* ctrl)
+{
+}
+#endif /* WCM_KEY_SENDING_SUPPORT */
static int xf86WcmInitArea(LocalDevicePtr local)
{
@@ -121,12 +130,12 @@ static int xf86WcmInitArea(LocalDevicePtr local)
DBG(10, priv->debugLevel, ErrorF("xf86WcmInitArea\n"));
/* Verify Box */
- if (priv->topX > common->wcmMaxX)
+ if (priv->topX > priv->wcmMaxX)
{
area->topX = priv->topX = 0;
}
- if (priv->topY > common->wcmMaxY)
+ if (priv->topY > priv->wcmMaxY)
{
area->topY = priv->topY = 0;
}
@@ -135,14 +144,14 @@ static int xf86WcmInitArea(LocalDevicePtr local)
priv->bottomX = xf86SetIntOption(local->options, "BottomX", 0);
if (priv->bottomX < priv->topX || !priv->bottomX)
{
- area->bottomX = priv->bottomX = common->wcmMaxX;
+ area->bottomX = priv->bottomX = priv->wcmMaxX;
}
/* set unconfigured bottom to max */
priv->bottomY = xf86SetIntOption(local->options, "BottomY", 0);
if (priv->bottomY < priv->topY || !priv->bottomY)
{
- area->bottomY = priv->bottomY = common->wcmMaxY;
+ area->bottomY = priv->bottomY = priv->wcmMaxY;
}
if (priv->twinview != TV_NONE)
@@ -167,23 +176,23 @@ static int xf86WcmInitArea(LocalDevicePtr local)
{
screenRatio = ((double)priv->maxWidth / (double)priv->maxHeight);
- tabletRatio = ((double)(common->wcmMaxX - priv->topX) /
- (double)(common->wcmMaxY - priv->topY));
+ tabletRatio = ((double)(priv->wcmMaxX - priv->topX) /
+ (double)(priv->wcmMaxY - priv->topY));
DBG(2, priv->debugLevel, ErrorF("screenRatio = %.3g, "
"tabletRatio = %.3g\n", screenRatio, tabletRatio));
if (screenRatio > tabletRatio)
{
- area->bottomX = priv->bottomX = common->wcmMaxX;
- area->bottomY = priv->bottomY = (common->wcmMaxY - priv->topY) *
+ area->bottomX = priv->bottomX = priv->wcmMaxX;
+ area->bottomY = priv->bottomY = (priv->wcmMaxY - priv->topY) *
tabletRatio / screenRatio + priv->topY;
}
else
{
- area->bottomX = priv->bottomX = (common->wcmMaxX - priv->topX) *
+ area->bottomX = priv->bottomX = (priv->wcmMaxX - priv->topX) *
screenRatio / tabletRatio + priv->topX;
- area->bottomY = priv->bottomY = common->wcmMaxY;
+ area->bottomY = priv->bottomY = priv->wcmMaxY;
}
/* active tablet size has been changed */
xf86WcmMappingFactor(local);
@@ -227,9 +236,11 @@ static int xf86WcmInitArea(LocalDevicePtr local)
if (xf86Verbose)
{
ErrorF("%s Wacom device \"%s\" top X=%d top Y=%d "
- "bottom X=%d bottom Y=%d\n",
+ "bottom X=%d bottom Y=%d "
+ "resol X=%d resol Y=%d\n",
XCONFIG_PROBED, local->name, priv->topX,
- priv->topY, priv->bottomX, priv->bottomY);
+ priv->topY, priv->bottomX, priv->bottomY,
+ priv->wcmResolX, priv->wcmResolY);
}
return TRUE;
}
@@ -241,7 +252,6 @@ static int xf86WcmInitArea(LocalDevicePtr local)
void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
{
WacomDevicePtr priv = (WacomDevicePtr)local->private;
- WacomCommonPtr common = priv->common;
int tabletSize = 0, topx = 0, topy = 0;
int resolution;
@@ -260,7 +270,7 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
if (priv->flags & ABSOLUTE_FLAG)
topx = priv->topX - priv->tvoffsetX;
- resolution = common->wcmResolX;
+ resolution = priv->wcmResolX;
#ifdef WCM_XORG_TABLET_SCALING
/* Ugly hack for Xorg 7.3, which doesn't call xf86WcmDevConvert
* for coordinate conversion at the moment */
@@ -287,7 +297,7 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
if (priv->flags & ABSOLUTE_FLAG)
topy = priv->topY - priv->tvoffsetY;
- resolution = common->wcmResolY;
+ resolution = priv->wcmResolY;
#ifdef WCM_XORG_TABLET_SCALING
/* Ugly hack for Xorg 7.3, which doesn't call xf86WcmDevConvert
* for coordinate conversion at the moment */
@@ -302,6 +312,206 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
}
}
+#ifdef WCM_KEY_SENDING_SUPPORT
+/*****************************************************************************
+ * xf86WcmRegisterX11Devices --
+ * Register the X11 input devices with X11 core.
+ ****************************************************************************/
+
+/* Define our own keymap so we can send key-events with our own device and not
+ * rely on inputInfo.keyboard */
+static KeySym keymap[] = {
+ /* 0x00 */ NoSymbol, NoSymbol, XK_Escape, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, XK_2, XK_at,
+ /* 0x04 */ XK_3, XK_numbersign, XK_4, XK_dollar,
+ /* 0x06 */ XK_5, XK_percent, XK_6, XK_asciicircum,
+ /* 0x08 */ XK_7, XK_ampersand, XK_8, XK_asterisk,
+ /* 0x0a */ XK_9, XK_parenleft, XK_0, XK_parenright,
+ /* 0x0c */ XK_minus, XK_underscore, XK_equal, XK_plus,
+ /* 0x0e */ XK_BackSpace, NoSymbol, XK_Tab, XK_ISO_Left_Tab,
+ /* 0x10 */ XK_q, NoSymbol, XK_w, NoSymbol,
+ /* 0x12 */ XK_e, NoSymbol, XK_r, NoSymbol,
+ /* 0x14 */ XK_t, NoSymbol, XK_y, NoSymbol,
+ /* 0x16 */ XK_u, NoSymbol, XK_i, NoSymbol,
+ /* 0x18 */ XK_o, NoSymbol, XK_p, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, XK_bracketright, XK_braceright,
+ /* 0x1c */ XK_Return, NoSymbol, XK_Control_L, NoSymbol,
+ /* 0x1e */ XK_a, NoSymbol, XK_s, NoSymbol,
+ /* 0x20 */ XK_d, NoSymbol, XK_f, NoSymbol,
+ /* 0x22 */ XK_g, NoSymbol, XK_h, NoSymbol,
+ /* 0x24 */ XK_j, NoSymbol, XK_k, NoSymbol,
+ /* 0x26 */ XK_l, NoSymbol, XK_semicolon, XK_colon,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, XK_quoteleft, XK_asciitilde,
+ /* 0x2a */ XK_Shift_L, NoSymbol, XK_backslash, XK_bar,
+ /* 0x2c */ XK_z, NoSymbol, XK_x, NoSymbol,
+ /* 0x2e */ XK_c, NoSymbol, XK_v, NoSymbol,
+ /* 0x30 */ XK_b, NoSymbol, XK_n, NoSymbol,
+ /* 0x32 */ XK_m, NoSymbol, XK_comma, XK_less,
+ /* 0x34 */ XK_period, XK_greater, XK_slash, XK_question,
+ /* 0x36 */ XK_Shift_R, NoSymbol, XK_KP_Multiply, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, XK_space, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, XK_F1, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, XK_F3, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, XK_F5, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, XK_F7, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, XK_F9, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, XK_Num_Lock, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, XK_KP_Home, XK_KP_7,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, XK_KP_Prior, XK_KP_9,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, XK_KP_Left, XK_KP_4,
+ /* 0x4c */ XK_KP_Begin, XK_KP_5, XK_KP_Right, XK_KP_6,
+ /* 0x4e */ XK_KP_Add, NoSymbol, XK_KP_End, XK_KP_1,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, XK_KP_Next, XK_KP_3,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, XK_KP_Delete, XK_KP_Decimal,
+ /* 0x54 */ NoSymbol, NoSymbol, XK_F13, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, XK_F11, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, XK_F14, NoSymbol,
+ /* 0x5a */ XK_F15, NoSymbol, XK_F16, NoSymbol,
+ /* 0x5c */ XK_F17, NoSymbol, XK_F18, NoSymbol,
+ /* 0x5e */ XK_F19, NoSymbol, XK_F20, NoSymbol,
+ /* 0x60 */ XK_KP_Enter, NoSymbol, XK_Control_R, NoSymbol,
+ /* 0x62 */ XK_KP_Divide, NoSymbol, XK_Print, XK_Sys_Req,
+ /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Home, NoSymbol, XK_Up, NoSymbol,
+ /* 0x68 */ XK_Prior, NoSymbol, XK_Left, NoSymbol,
+ /* 0x6a */ XK_Right, NoSymbol, XK_End, NoSymbol,
+ /* 0x6c */ XK_Down, NoSymbol, XK_Next, NoSymbol,
+ /* 0x6e */ XK_Insert, NoSymbol, XK_Delete, NoSymbol,
+ /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, XK_KP_Equal, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ XK_F21, NoSymbol, XK_F22, NoSymbol,
+ /* 0x7a */ XK_F23, NoSymbol, XK_F24, NoSymbol,
+ /* 0x7c */ XK_KP_Separator, NoSymbol, XK_Meta_L, NoSymbol,
+ /* 0x7e */ XK_Meta_R, NoSymbol, XK_Multi_key, NoSymbol,
+ /* 0x80 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x82 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x84 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x86 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x88 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x8a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x8c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x8e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x90 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x92 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x94 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x96 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x98 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x9a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x9c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x9e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xa0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xa2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xa4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xa6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xa8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xaa */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xac */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xae */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xb0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xb2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xb4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xb6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xb8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xba */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xbc */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xbe */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xc0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xc2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xc4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xc6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xc8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xca */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xcc */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xce */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xd0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xd2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xd4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xd6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xd8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xda */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xdc */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xde */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xe0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xe2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xe4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xe6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xe8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xea */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xec */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xee */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xf0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xf2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xf4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0xf6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol
+};
+
+static struct { KeySym keysym; CARD8 mask; } keymod[] = {
+ { XK_Shift_L, ShiftMask },
+ { XK_Shift_R, ShiftMask },
+ { XK_Control_L, ControlMask },
+ { XK_Control_R, ControlMask },
+ { XK_Caps_Lock, LockMask },
+ { XK_Alt_L, Mod1Mask }, /*AltMask*/
+ { XK_Alt_R, Mod1Mask }, /*AltMask*/
+ { XK_Num_Lock, Mod2Mask }, /*NumLockMask*/
+ { XK_Scroll_Lock, Mod5Mask }, /*ScrollLockMask*/
+ { XK_Mode_switch, Mod3Mask }, /*AltMask*/
+ { NoSymbol, 0 }
+};
+#endif /* WCM_KEY_SENDING_SUPPORT */
+
+/*****************************************************************************
+ * xf86WcmInitialprivSize --
+ * Initialize logical size and resolution for individual tool.
+ ****************************************************************************/
+
+static void xf86WcmInitialToolSize(LocalDevicePtr local)
+{
+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
+ WacomCommonPtr common = priv->common;
+ WacomToolPtr toollist = common->wcmTool;
+ WacomToolAreaPtr arealist;
+ int temp;
+
+ if (IsTouch(priv))
+ {
+ priv->wcmMaxX = common->wcmMaxTouchX;
+ priv->wcmMaxY = common->wcmMaxTouchY;
+ priv->wcmResolX = common->wcmTouchResolX;
+ priv->wcmResolY = common->wcmTouchResolY;
+ }
+ else
+ {
+ priv->wcmMaxX = common->wcmMaxX;
+ priv->wcmMaxY = common->wcmMaxY;
+ priv->wcmResolX = common->wcmResolX;
+ priv->wcmResolY = common->wcmResolY;
+ }
+
+ /* Rotation rotates the Max Y and Y */
+ if (common->wcmRotate==ROTATE_CW || common->wcmRotate==ROTATE_CCW)
+ {
+ temp = priv->wcmMaxX;
+ priv->wcmMaxX = priv->wcmMaxY;
+ priv->wcmMaxY = temp;
+ }
+
+ for (; toollist; toollist=toollist->next)
+ {
+ arealist = toollist->arealist;
+ for (; arealist; arealist=arealist->next)
+ {
+ if (!arealist->bottomX)
+ arealist->bottomX = priv->wcmMaxX;
+ if (!arealist->bottomY)
+ arealist->bottomY = priv->wcmMaxY;
+ }
+ }
+ return;
+}
+
/*****************************************************************************
* xf86WcmRegisterX11Devices --
* Register the X11 input devices with X11 core.
@@ -331,6 +541,8 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local)
IsPad(priv) ? "pad" : "eraser",
nbbuttons, nbkeys, nbaxes));
+ xf86WcmInitialToolSize(local);
+
/* initialize screen bounding rect */
xf86WcmInitialScreens(local);
@@ -390,18 +602,18 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local)
/* only initial KeyClass and LedFeedbackClass once */
if (!priv->wcmInitKeyClassCount)
{
+#ifdef WCM_KEY_SENDING_SUPPORT
if (nbkeys)
{
KeySymsRec wacom_keysyms;
- KeySym keymap[256];
+ CARD8 modmap[MAP_LENGTH];
+ int i,j;
- for (loop = 0; loop < nbkeys; loop++)
- if ((priv->button [loop] & AC_TYPE) == AC_KEY)
- keymap [loop] = priv->button [loop] & AC_CODE;
- else
- keymap [loop] = NoSymbol;
- for(loop = nbkeys; loop<256; loop++)
- keymap [loop] = NoSymbol;
+ memset(modmap, 0, sizeof(modmap));
+ for(i=0; keymod[i].keysym != NoSymbol; i++)
+ for(j=8; j<256; j++)
+ if(keymap[(j-8)*2] == keymod[i].keysym)
+ modmap[j] = keymod[i].mask;
/* There seems to be a long-standing misunderstanding about
* how a keymap should be defined. All tablet drivers from
@@ -421,18 +633,27 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local)
/* minKeyCode = 8 because this is the min legal key code */
wacom_keysyms.minKeyCode = 8;
wacom_keysyms.maxKeyCode = 255;
- wacom_keysyms.mapWidth = 1;
- if (InitKeyClassDeviceStruct(local->dev, &wacom_keysyms, NULL) == FALSE)
+ wacom_keysyms.mapWidth = 2;
+ if (InitKeyClassDeviceStruct(local->dev, &wacom_keysyms, modmap) == FALSE)
{
ErrorF("unable to init key class device\n");
return FALSE;
}
}
+#ifndef WCM_XFREE86
+ if(InitKbdFeedbackClassDeviceStruct(local->dev, xf86WcmBellCallback,
+ xf86WcmKbdCtrlCallback) == FALSE) {
+ ErrorF("unable to init kbd feedback device struct\n");
+ return FALSE;
+ }
+
if(InitLedFeedbackClassDeviceStruct (local->dev, xf86WcmKbdLedCallback) == FALSE) {
ErrorF("unable to init led feedback device struct\n");
return FALSE;
}
+#endif /* WCM_XFREE86 */
+#endif /* WCM_KEY_SENDING_SUPPORT */
}
#if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
@@ -488,6 +709,60 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local)
return TRUE;
}
+#ifdef LINUX_INPUT
+static Bool xf86WcmIsWacomDevice (int fd, CARD16 vendor)
+{
+ struct input_id id;
+ ioctl(fd, EVIOCGID, &id);
+ if (id.vendor == vendor)
+ return TRUE;
+ return FALSE;
+}
+
+/*****************************************************************************
+ * xf86WcmEventAutoDevProbe -- Probe for right input device
+ ****************************************************************************/
+#define DEV_INPUT_EVENT "/dev/input/event%d"
+#define EVDEV_MINORS 32
+char *xf86WcmEventAutoDevProbe (LocalDevicePtr local)
+{
+ /* We are trying to find the right eventX device */
+ int i, wait = 0;
+ const int max_wait = 2000;
+
+ /* If device is not available after Resume, wait some ms */
+ while (wait <= max_wait)
+ {
+ for (i = 0; i < EVDEV_MINORS; i++)
+ {
+ char fname[64];
+ int fd = -1;
+ Bool is_wacom;
+
+ sprintf(fname, DEV_INPUT_EVENT, i);
+ SYSCALL(fd = open(fname, O_RDONLY));
+ if (fd < 0)
+ continue;
+ is_wacom = xf86WcmIsWacomDevice(fd, 0x056a);
+ SYSCALL(close(fd));
+ if (is_wacom)
+ {
+ ErrorF ("%s Wacom probed device to be %s (waited %d msec)\n",
+ XCONFIG_PROBED, fname, wait);
+ xf86ReplaceStrOption(local->options, "Device", fname);
+ return xf86FindOptionValue(local->options, "Device");
+ }
+ }
+ wait += 100;
+ ErrorF("%s waiting 100 msec (total %dms) for device to become ready\n", local->name, wait);
+ usleep(100*1000);
+ }
+ ErrorF("%s no synaptics event device found (checked %d nodes, waited %d msec)\n",
+ local->name, i + 1, wait);
+ return FALSE;
+}
+#endif
+
/*****************************************************************************
* xf86WcmDevOpen --
* Open the physical device and init information structs.
@@ -501,14 +776,22 @@ static int xf86WcmDevOpen(DeviceIntPtr pWcm)
DBG(10, priv->debugLevel, ErrorF("xf86WcmDevOpen\n"));
- /* Device has been open */
+ /* Device has been open and not autoprobed */
if (priv->wcmDevOpenCount)
return TRUE;
/* open file, if not already open */
if (common->fd_refs == 0)
{
- if ((xf86WcmOpen (local) != Success) || (local->fd < 0))
+#ifdef LINUX_INPUT
+ /* Autoprobe if necessary */
+ if ((common->wcmFlags & AUTODEV_FLAG) &&
+ !(common->wcmDevice = xf86WcmEventAutoDevProbe (local)))
+ ErrorF("Cannot probe device\n");
+#endif
+
+ if ((xf86WcmOpen (local) != Success) || (local->fd < 0) ||
+ !common->wcmDevice)
{
DBG(1, priv->debugLevel, ErrorF("Failed to open "
"device (fd=%d)\n", local->fd));
diff --git a/src/xdrv/xf86Wacom.h b/src/xdrv/xf86Wacom.h
index ee54898..eb67188 100755
--- a/src/xdrv/xf86Wacom.h
+++ b/src/xdrv/xf86Wacom.h
@@ -119,7 +119,8 @@
#define XI_STYLUS "STYLUS" /* X device name for the stylus */
#define XI_CURSOR "CURSOR" /* X device name for the cursor */
#define XI_ERASER "ERASER" /* X device name for the eraser */
-#define XI_PAD "PAD" /* X device name for the I3 Pad */
+#define XI_PAD "PAD" /* X device name for the Pad */
+#define XI_TOUCH "TOUCH" /* X device name for the touch */
/******************************************************************************
* WacomModule - all globals are packed in a single structure to keep the
@@ -156,7 +157,6 @@ struct _WacomModule
****************************************************************************/
#define xf86WcmFlushTablet(fd) xf86FlushInput(fd)
-#define xf86WcmWaitForTablet(fd) xf86WaitForInput((fd), 1000000)
#define xf86WcmSetSerialSpeed(fd,rate) xf86SetSerialSpeed((fd),(rate))
#define xf86WcmRead(a,b,c) xf86ReadSerial((a),(b),(c))
@@ -196,6 +196,15 @@ LocalDevicePtr xf86WcmAllocatePad(void);
Bool xf86WcmOpen(LocalDevicePtr local);
+/* device autoprobing */
+char *xf86WcmEventAutoDevProbe (LocalDevicePtr local);
+
+/* serial write and wait command */
+int xf86WcmWriteWait(int fd, const char* request);
+
+/*wait for tablet data */
+int xf86WcmWaitForTablet(int fd, char * data, int size);
+
/* common tablet initialization regime */
int xf86WcmInitTablet(LocalDevicePtr local, const char* id, float version);
diff --git a/src/xdrv/xf86WacomDefs.h b/src/xdrv/xf86WacomDefs.h
index f531185..07835c9 100755
--- a/src/xdrv/xf86WacomDefs.h
+++ b/src/xdrv/xf86WacomDefs.h
@@ -97,26 +97,30 @@ struct _WacomModel
* WacomDeviceRec
*****************************************************************************/
-#define DEVICE_ID(flags) ((flags) & 0x0f)
+#define DEVICE_ID(flags) ((flags) & 0xff)
#define STYLUS_DEVICE_ID 0x02
+#define TOUCH_DEVICE_ID 0x03
#define CURSOR_DEVICE_ID 0x06
#define ERASER_DEVICE_ID 0x0A
#define PAD_DEVICE_ID 0x0F
#define STYLUS_ID 0x00000001
-#define CURSOR_ID 0x00000002
-#define ERASER_ID 0x00000004
-#define PAD_ID 0x00000008
-#define ABSOLUTE_FLAG 0x00000010
-#define KEEP_SHAPE_FLAG 0x00000020
-#define BAUD_19200_FLAG 0x00000040
-#define BUTTONS_ONLY_FLAG 0x00000080
-#define TPCBUTTONS_FLAG 0x00000100
-#define TPCBUTTONONE_FLAG 0x00000200
-#define COREEVENT_FLAG 0x00000400
+#define TOUCH_ID 0x00000002
+#define CURSOR_ID 0x00000004
+#define ERASER_ID 0x00000008
+#define PAD_ID 0x00000010
+
+#define ABSOLUTE_FLAG 0x00000100
+#define KEEP_SHAPE_FLAG 0x00000200
+#define BAUD_19200_FLAG 0x00000400
+#define BUTTONS_ONLY_FLAG 0x00000800
+#define TPCBUTTONS_FLAG 0x00001000
+#define TPCBUTTONONE_FLAG 0x00002000
+#define COREEVENT_FLAG 0x00004000
#define IsCursor(priv) (DEVICE_ID((priv)->flags) == CURSOR_ID)
#define IsStylus(priv) (DEVICE_ID((priv)->flags) == STYLUS_ID)
+#define IsTouch(priv) (DEVICE_ID((priv)->flags) == TOUCH_ID)
#define IsEraser(priv) (DEVICE_ID((priv)->flags) == ERASER_ID)
#define IsPad(priv) (DEVICE_ID((priv)->flags) == PAD_ID)
@@ -136,17 +140,21 @@ struct _WacomDeviceRec
LocalDevicePtr local;
int debugLevel;
- unsigned int flags; /* various flags (type, abs, touch...) */
- int topX; /* X top */
- int topY; /* Y top */
- int bottomX; /* X bottom */
- int bottomY; /* Y bottom */
+ unsigned int flags; /* various flags (type, abs, touch...) */
+ int topX; /* X top */
+ int topY; /* Y top */
+ int bottomX; /* X bottom */
+ int bottomY; /* Y bottom */
int sizeX; /* active X size */
int sizeY; /* active Y size */
- double factorX; /* X factor */
- double factorY; /* Y factor */
- unsigned int serial; /* device serial number */
- int screen_no; /* associated screen */
+ int wcmMaxX; /* max tool logical X value */
+ int wcmMaxY; /* max tool logical Y value */
+ int wcmResolX; /* tool X resolution in points/inch */
+ int wcmResolY; /* tool Y resolution in points/inch */
+ double factorX; /* X factor */
+ double factorY; /* Y factor */
+ unsigned int serial; /* device serial number */
+ int screen_no; /* associated screen */
int screenTopX[32]; /* left cordinate of the associated screen */
int screenTopY[32]; /* top cordinate of the associated screen */
int screenBottomX[32]; /* right cordinate of the associated screen */
@@ -332,6 +340,7 @@ struct _WacomDeviceClass
/* set if the /dev/input driver should wait for SYN_REPORT events as the
end of record indicator */
#define USE_SYN_REPORTS_FLAG 8
+#define AUTODEV_FLAG 16
#endif
#define DEVICE_ISDV4 0x000C
@@ -341,22 +350,28 @@ struct _WacomDeviceClass
struct _WacomCommonRec
{
char* wcmDevice; /* device file name */
- unsigned char wcmFlags; /* various flags (handle tilt) */
+ unsigned char wcmFlags; /* various flags (handle tilt) */
int debugLevel;
int tablet_id; /* USB tablet ID */
int fd; /* file descriptor to tablet */
int fd_refs; /* number of references to fd; if =0, fd is invalid */
/* These values are in tablet coordinates */
- int wcmMaxX; /* tablet max X value */
- int wcmMaxY; /* tablet max Y value */
+ int wcmMaxX; /* tablet max X value */
+ int wcmMaxY; /* tablet max Y value */
int wcmMaxZ; /* tablet max Z value */
+ int wcmMaxTouchX; /* max touch X value */
+ int wcmMaxTouchY; /* max touch Y value */
int wcmMaxDist; /* tablet max distance value */
+ int wcmTouchResolX; /* touch X resolution in points/inch */
+ int wcmTouchResolY; /* touch Y resolution in points/inch */
int wcmResolX; /* tablet X resolution in points/inch */
int wcmResolY; /* tablet Y resolution in points/inch */
/* tablet Z resolution is equivalent
* to wcmMaxZ which is equal to 100%
* pressure */
+ int wcmMaxtiltX; /* styli max tilt in X directory */
+ int wcmMaxtiltY; /* styli max tilt in Y directory */
/* These values are in user coordinates */
int wcmUserResolX; /* user-defined X resolution */