X Strike Force X.Org X11 SVN commit: r402 - in branches/6.9/debian: . patches/general
Author: dnusinow
Date: 2005-07-23 16:55:21 -0500 (Sat, 23 Jul 2005)
New Revision: 402
Modified:
branches/6.9/debian/changelog
branches/6.9/debian/patches/general/000_stolen_from_Mesa_6.2_branch_vb_cull.diff
branches/6.9/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff
Log:
- Update 000_stolen_from_linuxwacom_wacom_driver.diff to have version 0.6.8 of
xf86Wacom.c to get the patch to apply
- Unfuzzy some patches
Modified: branches/6.9/debian/changelog
===================================================================
--- branches/6.9/debian/changelog 2005-07-23 21:42:23 UTC (rev 401)
+++ branches/6.9/debian/changelog 2005-07-23 21:55:21 UTC (rev 402)
@@ -4,6 +4,8 @@
- Remove obsolete by upstream patches:
- general/0000_backport_from_upstream.diff
- general/000_stolen_from_HEAD_i810.diff
+ - Update 000_stolen_from_linuxwacom_wacom_driver.diff to have version
+ 0.6.8 of xf86Wacom.c to get the patch to apply
-- David Nusinow <dnusinow@debian.org> Sat, 23 Jul 2005 17:40:13 -0400
Modified: branches/6.9/debian/patches/general/000_stolen_from_Mesa_6.2_branch_vb_cull.diff
===================================================================
--- branches/6.9/debian/patches/general/000_stolen_from_Mesa_6.2_branch_vb_cull.diff 2005-07-23 21:42:23 UTC (rev 401)
+++ branches/6.9/debian/patches/general/000_stolen_from_Mesa_6.2_branch_vb_cull.diff 2005-07-23 21:55:21 UTC (rev 402)
@@ -1,52 +1,54 @@
$Id$
---- xc/lib/GL/mesa/tnl/Imakefile.inc.orig 2005-01-28 14:30:22.290960296 +1100
-+++ xc/lib/GL/mesa/tnl/Imakefile.inc 2005-01-28 14:31:05.284424296 +1100
+Index: xc/lib/GL/mesa/tnl/Imakefile.inc
+===================================================================
+--- xc/lib/GL/mesa/tnl/Imakefile.inc.orig 2005-01-07 13:53:41.000000000 -0500
++++ xc/lib/GL/mesa/tnl/Imakefile.inc 2005-07-23 17:50:04.000000000 -0400
@@ -13,6 +13,7 @@
$(MESATNLBUILDDIR)t_save_api.c \
$(MESATNLBUILDDIR)t_save_loopback.c \
$(MESATNLBUILDDIR)t_save_playback.c \
+ $(MESATNLBUILDDIR)t_vb_cull.c \
$(MESATNLBUILDDIR)t_vb_fog.c \
+ $(MESATNLBUILDDIR)t_vb_cull.c \
$(MESATNLBUILDDIR)t_vb_light.c \
- $(MESATNLBUILDDIR)t_vb_normals.c \
-@@ -50,6 +51,7 @@
+@@ -51,6 +52,7 @@
LinkSourceFile(t_save_loopback.c, $(MESASRCDIR)/src/mesa/tnl)
LinkSourceFile(t_save_playback.c, $(MESASRCDIR)/src/mesa/tnl)
LinkSourceFile(t_vb_cliptmp.h, $(MESASRCDIR)/src/mesa/tnl)
+LinkSourceFile(t_vb_cull.c, $(MESASRCDIR)/src/mesa/tnl)
LinkSourceFile(t_vb_fog.c, $(MESASRCDIR)/src/mesa/tnl)
+ LinkSourceFile(t_vb_cull.c, $(MESASRCDIR)/src/mesa/tnl)
LinkSourceFile(t_vb_light.c, $(MESASRCDIR)/src/mesa/tnl)
- LinkSourceFile(t_vb_lighttmp.h, $(MESASRCDIR)/src/mesa/tnl)
-@@ -83,6 +85,7 @@
+@@ -85,6 +87,7 @@
$(MESATNLBUILDDIR)t_save_api.o \
$(MESATNLBUILDDIR)t_save_loopback.o \
$(MESATNLBUILDDIR)t_save_playback.o \
+ $(MESATNLBUILDDIR)t_vb_cull.o \
$(MESATNLBUILDDIR)t_vb_fog.o \
+ $(MESATNLBUILDDIR)t_vb_cull.o \
$(MESATNLBUILDDIR)t_vb_light.o \
- $(MESATNLBUILDDIR)t_vb_normals.o \
-@@ -113,6 +116,7 @@
+@@ -116,6 +119,7 @@
$(MESATNLBUILDDIR)unshared/t_save_api.o \
$(MESATNLBUILDDIR)unshared/t_save_loopback.o \
$(MESATNLBUILDDIR)unshared/t_save_playback.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_cull.o \
$(MESATNLBUILDDIR)unshared/t_vb_fog.o \
+ $(MESATNLBUILDDIR)unshared/t_vb_cull.o \
$(MESATNLBUILDDIR)unshared/t_vb_light.o \
- $(MESATNLBUILDDIR)unshared/t_vb_normals.o \
-@@ -146,6 +150,7 @@
+@@ -150,6 +154,7 @@
$(MESATNLBUILDDIR)debugger/t_save_api.o \
$(MESATNLBUILDDIR)debugger/t_save_loopback.o \
$(MESATNLBUILDDIR)debugger/t_save_playback.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_cull.o \
$(MESATNLBUILDDIR)debugger/t_vb_fog.o \
+ $(MESATNLBUILDDIR)debugger/t_vb_cull.o \
$(MESATNLBUILDDIR)debugger/t_vb_light.o \
- $(MESATNLBUILDDIR)debugger/t_vb_normals.o \
-@@ -175,6 +180,7 @@
+@@ -180,6 +185,7 @@
$(MESATNLBUILDDIR)profiled/t_save_api.o \
$(MESATNLBUILDDIR)profiled/t_save_loopback.o \
$(MESATNLBUILDDIR)profiled/t_save_playback.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_cull.o \
$(MESATNLBUILDDIR)profiled/t_vb_fog.o \
+ $(MESATNLBUILDDIR)profiled/t_vb_cull.o \
$(MESATNLBUILDDIR)profiled/t_vb_light.o \
- $(MESATNLBUILDDIR)profiled/t_vb_normals.o \
Modified: branches/6.9/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff
===================================================================
--- branches/6.9/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff 2005-07-23 21:42:23 UTC (rev 401)
+++ branches/6.9/debian/patches/general/000_stolen_from_linuxwacom_wacom_driver.diff 2005-07-23 21:55:21 UTC (rev 402)
@@ -3,20 +3,25 @@
This patch updates the wacom input driver from
http://linuxwacom.sourceforge.net/ up to version 0.6.4.
+xf86Wacom.c tentatively brought up to 0.6.8 by David Nusinow
+
This patch and changes to the Imakefile by Fabio M. Di Nitto.
---- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c.orig 2004-11-04 10:40:44.067137232 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c 2004-11-04 10:45:00.967082504 +0100
-@@ -1,7 +1,6 @@
--/* $XdotOrg: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.2 2004/04/23 19:54:06 eich Exp $ */
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c
+===================================================================
+--- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c.orig 2005-07-03 04:53:46.000000000 -0400
++++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c 2005-07-23 17:49:16.000000000 -0400
+@@ -1,7 +1,7 @@
+-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.4 2005/06/27 18:32:55 ajax Exp $ */
/* $XConsortium: xf86Wacom.c /main/20 1996/10/27 11:05:20 kaleb $ */
/*
- * Copyright 1995-2001 by Frederic Lepied, France. <Lepied@XFree86.org>
-+ * Copyright 1995-2004 by Frederic Lepied, France. <Lepied@XFree86.org>
++ * Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
++ * Copyright 2002-2005 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
-@@ -23,10 +22,10 @@
+@@ -23,10 +23,10 @@
*
*/
@@ -29,7 +34,7 @@
*
* Wacom V protocol work done by Raph Levien <raph@gtk.org> and
* Frédéric Lepied <lepied@xfree86.org>.
-@@ -39,5253 +38,1253 @@
+@@ -39,5252 +39,1313 @@
* Frederic Lepied <lepied@xfree86.org>,
* Brion Vibber <brion@pobox.com>,
* Aaron Optimizer Digulla <digulla@hepe.com>,
@@ -161,11 +166,15 @@
+ * 2004-03-02 26-j0.6.1 - new release
+ * 2004-04-04 26-j0.6.2 - new release
+ * 2004-05-25 26-j0.6.3 - new release
++ * 2004-10-05 26-j0.6.5 - new release
++ * 2004-11-22 42-j0.6.6 - new release
++ * 2005-02-17 42-j0.6.7 - added 64-bit support
++ * 2005-03-10 42-j0.6.8 - added Cintiq 21UX support
+*/
-#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-#define RESET_RELATIVE(ds) do { (ds).relwheel = 0; } while (0)
-+static const char identification[] = "$Identification: 26-j0.6.4 $";
++static const char identification[] = "$Identification: 42-j0.6.8 $";
-static int xf86WcmWait(int t);
-static int xf86WcmReady(int fd);
@@ -751,7 +760,7 @@
- /* map minKeyCode maxKC width */
- wacom_map, 8, 0x27, 1
-};
-
+-
-#define XWACOM_PARAM_TOPX 1
-#define XWACOM_PARAM_TOPY 2
-#define XWACOM_PARAM_BOTTOMX 3
@@ -772,15 +781,9 @@
-#define XWACOM_PARAM_FILEMODEL 100
-#define XWACOM_PARAM_FILEOPTION 101
-#define XWACOM_PARAM_GIMP 102
+
+-WacomModule gWacomModule =
+static KeySymsRec wacom_keysyms =
-+{
-+ wacom_map, /* map */
-+ 8, /* min key code */
-+ 0x27, /* max key code */
-+ 1 /* width */
-+};
-
- WacomModule gWacomModule =
{
- 0, /* debug level */
- wacom_map, /* key map */
@@ -796,6 +799,22 @@
- xf86WcmDevSwitchMode,
- xf86WcmDevConvert,
- xf86WcmDevReverseConvert,
++ wacom_map, /* map */
++ 8, /* min key code */
++ 0x27, /* max key code */
++ 1 /* width */
+ };
+
+-/******************************************************************************
+- * WacomDeviceClass
+- *****************************************************************************/
+-
+-struct _WacomDeviceClass
++WacomModule gWacomModule =
+ {
+- Bool (*Detect)(LocalDevicePtr local); /* detect device */
+- Bool (*Init)(LocalDevicePtr local); /* initialize device */
+- void (*Read)(LocalDevicePtr local); /* reads device */
+ 0, /* debug level */
+ wacom_map, /* key map */
+ identification, /* version */
@@ -813,33 +832,31 @@
+ xf86WcmDevReverseConvert,
};
--/******************************************************************************
-- * WacomDeviceClass
-- *****************************************************************************/
+-static WacomDeviceClass gWacomSerialDevice =
+-{
+- serialDetect,
+- serialInit,
+- xf86WcmReadPacket,
+-};
+/*****************************************************************************
+ * xf86WcmDevOpen --
+ * Open the physical device and init information structs.
+ ****************************************************************************/
--struct _WacomDeviceClass
+-static WacomDeviceClass gWacomISDV4Device =
+static int xf86WcmDevOpen(DeviceIntPtr pWcm)
{
-- Bool (*Detect)(LocalDevicePtr local); /* detect device */
-- Bool (*Init)(LocalDevicePtr local); /* initialize device */
-- void (*Read)(LocalDevicePtr local); /* reads device */
+- isdv4Detect,
+- isdv4Init,
+- xf86WcmReadPacket,
-};
+ LocalDevicePtr local = (LocalDevicePtr)pWcm->public.devicePrivate;
+ WacomDevicePtr priv = (WacomDevicePtr)PRIVATE(pWcm);
+ WacomCommonPtr common = priv->common;
+ int totalWidth = 0, maxHeight = 0, tabletSize = 0;
+ double screenRatio, tabletRatio;
-
--static WacomDeviceClass gWacomSerialDevice =
--{
-- serialDetect,
-- serialInit,
-- xf86WcmReadPacket,
--};
++ char m1[32], m2[32];
++
+ /* open file, if not already open */
+ if (local->fd < 0)
+ {
@@ -850,10 +867,11 @@
+ }
+ }
--static WacomDeviceClass gWacomISDV4Device =
+-#ifdef LINUX_INPUT
+-static WacomDeviceClass gWacomUSBDevice =
-{
-- isdv4Detect,
-- isdv4Init,
+- usbDetect,
+- usbInit,
- xf86WcmReadPacket,
-};
+ /* if factorX is not set, initialize bounding rect */
@@ -861,24 +879,31 @@
+ {
+ if (priv->twinview != TV_NONE && priv->screen_no == -1)
+ {
-+ priv->tvoffsetX = 60;
-+ priv->tvoffsetY = 60;
-+ }
++ priv->tvoffsetX = 60;
++ priv->tvoffsetY = 60;
++ }
--#ifdef LINUX_INPUT
--static WacomDeviceClass gWacomUSBDevice =
+-static WacomModel usbUnknown =
-{
-- usbDetect,
-- usbInit,
-- xf86WcmReadPacket,
+- "Unknown USB",
+- usbInitProtocol5, /* assume the best */
+- NULL, /* resolution not queried */
+- usbGetRanges,
+- NULL, /* reset not supported */
+- NULL, /* tilt automatically enabled */
+- NULL, /* suppress implemented in software */
+- NULL, /* link speed unsupported */
+- NULL, /* start not supported */
+- usbParse,
+- NULL, /* input filtering not needed */
-};
+ if (priv->bottomX == 0) priv->bottomX = common->wcmMaxX;
+ if (priv->bottomY == 0) priv->bottomY = common->wcmMaxY;
--static WacomModel usbUnknown =
+-static WacomModel usbPenPartner =
-{
-- "Unknown USB",
-- usbInitProtocol5, /* assume the best */
+- "USB PenPartner",
+- usbInitProtocol4,
- NULL, /* resolution not queried */
- usbGetRanges,
- NULL, /* reset not supported */
@@ -887,7 +912,7 @@
- NULL, /* link speed unsupported */
- NULL, /* start not supported */
- usbParse,
-- NULL, /* input filtering not needed */
+- xf86WcmFilterCoord, /* input filtering */
-};
+ /* Verify Box validity */
+ if (priv->topX > common->wcmMaxX)
@@ -897,9 +922,9 @@
+ priv->topX = 0;
+ }
--static WacomModel usbPenPartner =
+-static WacomModel usbGraphire =
-{
-- "USB PenPartner",
+- "USB Graphire",
- usbInitProtocol4,
- NULL, /* resolution not queried */
- usbGetRanges,
@@ -918,9 +943,9 @@
+ priv->topY = 0;
+ }
--static WacomModel usbGraphire =
+-static WacomModel usbGraphire2 =
-{
-- "USB Graphire",
+- "USB Graphire2",
- usbInitProtocol4,
- NULL, /* resolution not queried */
- usbGetRanges,
@@ -939,9 +964,9 @@
+ priv->bottomX = common->wcmMaxX;
+ }
--static WacomModel usbGraphire2 =
+-static WacomModel usbGraphire3 =
-{
-- "USB Graphire2",
+- "USB Graphire3",
- usbInitProtocol4,
- NULL, /* resolution not queried */
- usbGetRanges,
@@ -960,9 +985,9 @@
+ priv->bottomY = common->wcmMaxY;
+ }
--static WacomModel usbGraphire3 =
+-static WacomModel usbCintiq =
-{
-- "USB Graphire3",
+- "USB Cintiq",
- usbInitProtocol4,
- NULL, /* resolution not queried */
- usbGetRanges,
@@ -986,9 +1011,9 @@
+ }
+ }
--static WacomModel usbCintiq =
+-static WacomModel usbCintiqPartner =
-{
-- "USB Cintiq",
+- "USB CintiqPartner",
- usbInitProtocol4,
- NULL, /* resolution not queried */
- usbGetRanges,
@@ -1026,10 +1051,10 @@
+ }
+ }
--static WacomModel usbCintiqPartner =
+-static WacomModel usbIntuos =
-{
-- "USB CintiqPartner",
-- usbInitProtocol4,
+- "USB Intuos",
+- usbInitProtocol5,
- NULL, /* resolution not queried */
- usbGetRanges,
- NULL, /* reset not supported */
@@ -1038,16 +1063,16 @@
- NULL, /* link speed unsupported */
- NULL, /* start not supported */
- usbParse,
-- xf86WcmFilterCoord, /* input filtering */
+- xf86WcmFilterIntuos, /* input filtering recommended */
-};
+ /* Maintain aspect ratio */
+ if (priv->flags & KEEP_SHAPE_FLAG)
+ {
+ screenRatio = totalWidth / (double)maxHeight;
--static WacomModel usbIntuos =
+-static WacomModel usbIntuos2 =
-{
-- "USB Intuos",
+- "USB Intuos2",
- usbInitProtocol5,
- NULL, /* resolution not queried */
- usbGetRanges,
@@ -1062,23 +1087,6 @@
+ tabletRatio = ((double)(common->wcmMaxX - priv->topX)) /
+ (common->wcmMaxY - priv->topY);
--static WacomModel usbIntuos2 =
--{
-- "USB Intuos2",
-- usbInitProtocol5,
-- NULL, /* resolution not queried */
-- usbGetRanges,
-- NULL, /* reset not supported */
-- NULL, /* tilt automatically enabled */
-- NULL, /* suppress implemented in software */
-- NULL, /* link speed unsupported */
-- NULL, /* start not supported */
-- usbParse,
-- xf86WcmFilterIntuos, /* input filtering recommended */
--};
-+ DBG(2, ErrorF("screenRatio = %.3g, tabletRatio = %.3g\n"
-+ , screenRatio, tabletRatio));
-
-static WacomModel usbVolito =
-{
- "USB Volito",
@@ -1094,6 +1102,15 @@
- xf86WcmFilterCoord, /* input filtering */
-};
-#endif /* LINUX_INPUT */
++ DBG(2, ErrorF("screenRatio = %.3g, tabletRatio = %.3g\n"
++ , screenRatio, tabletRatio));
+
+-static WacomDeviceClass* wcmDeviceClasses[] =
+-{
+- /* Current USB implementation requires LINUX_INPUT */
+-#ifdef LINUX_INPUT
+- &gWacomUSBDevice,
+-#endif
+ if (screenRatio > tabletRatio)
+ {
+ priv->bottomX = common->wcmMaxX;
@@ -1114,12 +1131,10 @@
+ XCONFIG_PROBED, local->name, priv->topX,
+ priv->topY, priv->bottomX, priv->bottomY);
--static WacomDeviceClass* wcmDeviceClasses[] =
--{
-- /* Current USB implementation requires LINUX_INPUT */
--#ifdef LINUX_INPUT
-- &gWacomUSBDevice,
--#endif
+- &gWacomISDV4Device,
+- &gWacomSerialDevice,
+- NULL
+-};
+ if (priv->numScreen == 1)
+ {
+ priv->factorX = totalWidth
@@ -1131,29 +1146,25 @@
+ }
+ } /* end bounding rect */
-- &gWacomISDV4Device,
-- &gWacomSerialDevice,
-- NULL
--};
+-#ifdef LINUX_INPUT
+-/*****************************************************************************
+- * usbDetect --
+- * Test if the attached device is USB.
+- ****************************************************************************/
+ /* x and y axes */
+ if (priv->twinview == TV_LEFT_RIGHT)
+ tabletSize = 2*(priv->bottomX - priv->topX - 2*priv->tvoffsetX);
+ else
+ tabletSize = priv->bottomX - priv->topX;
--#ifdef LINUX_INPUT
--/*****************************************************************************
-- * usbDetect --
-- * Test if the attached device is USB.
-- ****************************************************************************/
-+ InitValuatorAxisStruct(pWcm, 0, 0, tabletSize, /* max val */
-+ mils(common->wcmResolX), /* tablet resolution */
-+ 0, mils(common->wcmResolX)); /* max_res */
-
-static Bool usbDetect(LocalDevicePtr local)
-{
- int version;
- int err;
++ InitValuatorAxisStruct(pWcm, 0, 0, tabletSize, /* max val */
++ mils(common->wcmResolX), /* tablet resolution */
++ 0, mils(common->wcmResolX)); /* max_res */
++
+ if (priv->twinview == TV_ABOVE_BELOW)
+ tabletSize = 2*(priv->bottomY - priv->topY - 2*priv->tvoffsetY);
+ else
@@ -1182,6 +1193,12 @@
+ InitValuatorAxisStruct(pWcm, 3, -900, 899, 1, 1, 1);
+ InitValuatorAxisStruct(pWcm, 4, -1023, 1023, 1, 1, 1);
+ }
++ else if (IsPad(priv))
++ {
++ /* strip-x and strip-y */
++ InitValuatorAxisStruct(pWcm, 3, 0, 4097, 1, 1, 1);
++ InitValuatorAxisStruct(pWcm, 4, 0, 4097, 1, 1, 1);
++ }
+ else
+ {
+ /* tilt-x and tilt-y */
@@ -1190,8 +1207,13 @@
+ }
- return 0;
-+ /* wheel */
-+ InitValuatorAxisStruct(pWcm, 5, 0, 1023, 1, 1, 1);
++ sscanf((char*)(common->wcmModel)->name, "%s %s", m1, m2);
++ if (strstr(m2, "Intuos3") && IsStylus(priv))
++ /* Intuos3 Marker Pen rotation */
++ InitValuatorAxisStruct(pWcm, 5, -900, 899, 1, 1, 1);
++ else
++ /* absolute wheel */
++ InitValuatorAxisStruct(pWcm, 5, 0, 1023, 1, 1, 1);
+ return TRUE;
}
@@ -1343,7 +1365,7 @@
- }
- common->wcmMaxX = nValues[2];
- }
-+ DBG(7, ErrorF("xf86WcmDevReadPacket: device=%s fd=%d "
++ DBG(12, ErrorF("xf86WcmDevReadPacket: device=%s fd=%d "
+ "pos=%d remaining=%d\n",
+ common->wcmDevice, local->fd,
+ common->bufpos, remaining));
@@ -1387,7 +1409,7 @@
- int i, serial, channel;
+ /* account for new data */
+ common->bufpos += len;
-+ DBG(10, ErrorF("xf86WcmReadPacket buffer has %d bytes\n",
++ DBG(12, ErrorF("xf86WcmReadPacket buffer has %d bytes\n",
+ common->bufpos));
- /* store events until we receive the MSC_SERIAL containing
@@ -1585,7 +1607,7 @@
- serialParseProtocol5,
- xf86WcmFilterIntuos,
-};
-
+-
-static WacomModel serialIntuos2 =
-{
- "Serial Intuos2",
@@ -1615,7 +1637,7 @@
- serialParseCintiq,
- xf86WcmFilterCoord,
-};
--
+
-static WacomModel serialPenPartner =
-{
- "Serial PenPartner",
@@ -1838,74 +1860,6 @@
- WacomCommonPtr common = ((WacomDevicePtr)(local->private))->common;
-
- DBG(1, ErrorF("initializing serial tablet\n"));
--
-- /* Set the speed of the serial link to 38400 */
-- if (xf86WcmSetSerialSpeed(local->fd, 38400) < 0)
-- return !Success;
--
-- /* Send reset to the tablet */
-- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
--
-- if (err == -1) {
-- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
-- return !Success;
-- }
--
-- /* Wait 250 mSecs */
-- if (xf86WcmWait(250)) return !Success;
--
-- /* Send reset to the tablet */
-- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET, strlen(WC_RESET)));
-- if (err == -1) {
-- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
-- return !Success;
-- }
--
-- /* Wait 75 mSecs */
-- if (xf86WcmWait(75)) return !Success;
--
-- /* Set the speed of the serial link to 19200 */
-- if (xf86WcmSetSerialSpeed(local->fd, 19200) < 0) return !Success;
--
-- /* Send reset to the tablet */
-- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
--
-- if (err == -1) {
-- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
-- return !Success;
-- }
--
-- /* Wait 250 mSecs */
-- if (xf86WcmWait(250)) return !Success;
--
-- /* Send reset to the tablet */
-- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET, strlen(WC_RESET)));
-- if (err == -1) {
-- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
-- return !Success;
-- }
--
-- /* Wait 75 mSecs */
-- if (xf86WcmWait(75)) return !Success;
--
-- /* Set the speed of the serial link to 9600 */
-- if (xf86WcmSetSerialSpeed(local->fd, 9600) < 0) return !Success;
--
-- /* Send reset to the tablet */
-- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
-- if (err == -1) {
-- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
-- return !Success;
-- }
--
-- /* Wait 250 mSecs */
-- if (xf86WcmWait(250)) return !Success;
--
-- SYSCALL(err = xf86WcmWrite(local->fd, WC_STOP, strlen(WC_STOP)));
-- if (err == -1) {
-- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
-- return !Success;
-- }
+ CARD8 map[(32 << 4) + 1];
+ int nbaxes;
+ int nbbuttons;
@@ -1918,6 +1872,7 @@
+ (void *)pWcm, (void *)priv,
+ IsStylus(priv) ? "stylus" :
+ IsCursor(priv) ? "cursor" :
++ IsPad(priv) ? "pad" :
+ "eraser", priv->flags, what));
+
+ switch (what)
@@ -2038,11 +1993,77 @@
+ return !Success;
+ } /* end switch */
+- /* Set the speed of the serial link to 38400 */
+- if (xf86WcmSetSerialSpeed(local->fd, 38400) < 0)
+- return !Success;
+-
+- /* Send reset to the tablet */
+- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
+-
+- if (err == -1) {
+- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
+- return !Success;
+- }
+-
+- /* Wait 250 mSecs */
+- if (xf86WcmWait(250)) return !Success;
+-
+- /* Send reset to the tablet */
+- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET, strlen(WC_RESET)));
+- if (err == -1) {
+- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
+- return !Success;
+- }
+-
+- /* Wait 75 mSecs */
+- if (xf86WcmWait(75)) return !Success;
+-
+- /* Set the speed of the serial link to 19200 */
+- if (xf86WcmSetSerialSpeed(local->fd, 19200) < 0) return !Success;
+-
+- /* Send reset to the tablet */
+- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
+-
+- if (err == -1) {
+- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
+- return !Success;
+- }
+-
+- /* Wait 250 mSecs */
+- if (xf86WcmWait(250)) return !Success;
+-
+- /* Send reset to the tablet */
+- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET, strlen(WC_RESET)));
+- if (err == -1) {
+- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
+- return !Success;
+- }
+-
+- /* Wait 75 mSecs */
+- if (xf86WcmWait(75)) return !Success;
+-
+- /* Set the speed of the serial link to 9600 */
+- if (xf86WcmSetSerialSpeed(local->fd, 9600) < 0) return !Success;
+-
+- /* Send reset to the tablet */
+- SYSCALL(err = xf86WcmWrite(local->fd, WC_RESET_BAUD, strlen(WC_RESET_BAUD)));
+- if (err == -1) {
+- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
+- return !Success;
+- }
+-
+- /* Wait 250 mSecs */
+- if (xf86WcmWait(250)) return !Success;
+-
+- SYSCALL(err = xf86WcmWrite(local->fd, WC_STOP, strlen(WC_STOP)));
+- if (err == -1) {
+- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
+- return !Success;
+- }
+-
- /* Wait 30 mSecs */
- if (xf86WcmWait(30)) return !Success;
-+ DBG(2, ErrorF("END xf86WcmProc Success what=%d dev=%p priv=%p\n",
-+ what, (void *)pWcm, (void *)priv));
-
+-
- xf86WcmFlushTablet(local->fd);
-
- if (serialInitTablet(common,local->fd) == !Success) {
@@ -2050,7 +2071,9 @@
- local->fd = -1;
- return !Success;
- }
--
++ DBG(2, ErrorF("END xf86WcmProc Success what=%d dev=%p priv=%p\n",
++ what, (void *)pWcm, (void *)priv));
+
- return Success;
+ return Success;
}
@@ -2227,7 +2250,8 @@
-
-static int serialParseProtocol5(WacomCommonPtr common,
- const unsigned char* data)
--{
++static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
+ {
- int n;
- int have_data=0;
- int channel;
@@ -2268,7 +2292,9 @@
- ds->device_type = CURSOR_ID;
- else
- ds->device_type = ERASER_ID;
--
++ WacomDevicePtr priv = (WacomDevicePtr)local->private;
++ char st[32];
+
- DBG(6, ErrorF("device_id=0x%x serial_num=%u type=%s\n",
- ds->device_id, ds->serial_num,
- (ds->device_type == STYLUS_ID) ? "stylus" :
@@ -2324,7 +2350,170 @@
- ds->buttons = (data[8] & 0x1C) >> 2;
- ds->relwheel = -(data[8] & 1) + ((data[8] & 2) >> 1);
- have_data = 1; /* must send since relwheel is reset */
-- }
++ switch (param)
++ {
++ case XWACOM_PARAM_TOPX:
++ xf86ReplaceIntOption(local->options, "TopX", value);
++ priv->topX = xf86SetIntOption(local->options, "TopX", 0);
++ break;
++ case XWACOM_PARAM_TOPY:
++ xf86ReplaceIntOption(local->options, "TopY", value);
++ priv->topY = xf86SetIntOption(local->options, "TopY", 0);
++ break;
++ case XWACOM_PARAM_BOTTOMX:
++ xf86ReplaceIntOption(local->options, "BottomX", value);
++ priv->bottomX = xf86SetIntOption(local->options, "BottomX", 0);
++ break;
++ case XWACOM_PARAM_BOTTOMY:
++ xf86ReplaceIntOption(local->options, "BottomY", value);
++ priv->bottomY = xf86SetIntOption(local->options, "BottomY", 0);
++ break;
++ case XWACOM_PARAM_BUTTON1:
++ if ((value < 0) || (value > 19)) return BadValue;
++ xf86ReplaceIntOption(local->options,"Button1",value);
++ priv->button[0] = xf86SetIntOption(local->options,"Button1",1);
++ break;
++ case XWACOM_PARAM_BUTTON2:
++ if ((value < 0) || (value > 19)) return BadValue;
++ xf86ReplaceIntOption(local->options, "Button2", value);
++ priv->button[1] = xf86SetIntOption(local->options,"Button2",2);
++ break;
++ case XWACOM_PARAM_BUTTON3:
++ if ((value < 0) || (value > 19)) return BadValue;
++ xf86ReplaceIntOption(local->options, "Button3", value);
++ priv->button[2] = xf86SetIntOption(local->options,"Button3",3);
++ break;
++ case XWACOM_PARAM_BUTTON4:
++ if ((value < 0) || (value > 19)) return BadValue;
++ xf86ReplaceIntOption(local->options, "Button4", value);
++ priv->button[3] = xf86SetIntOption(local->options,"Button4",4);
++ break;
++ case XWACOM_PARAM_BUTTON5:
++ if ((value < 0) || (value > 19)) return BadValue;
++ xf86ReplaceIntOption(local->options, "Button5", value);
++ priv->button[4] = xf86SetIntOption(local->options,"Button5",5);
++ break;
++ case XWACOM_PARAM_DEBUGLEVEL:
++ if ((value < 1) || (value > 100)) return BadValue;
++ xf86ReplaceIntOption(local->options, "DebugLevel", value);
++ gWacomModule.debugLevel = value;
++ break;
++ case XWACOM_PARAM_RAWFILTER:
++ if ((value < 0) || (value > 1)) return BadValue;
++ if (value)
++ {
++ priv->common->wcmFlags |= RAW_FILTERING_FLAG;
++ xf86ReplaceStrOption(local->options, "RawFilter", "On");
++ }
++ else
++ {
++ priv->common->wcmFlags &= ~(RAW_FILTERING_FLAG);
++ xf86ReplaceStrOption(local->options, "RawFilter", "Off");
++ }
++ break;
++ case XWACOM_PARAM_PRESSCURVE:
++ {
++ if ( !IsCursor(priv) )
++ {
++ char chBuf[64];
++ int x0 = (value >> 24) & 0xFF;
++ int y0 = (value >> 16) & 0xFF;
++ int x1 = (value >> 8) & 0xFF;
++ int y1 = value & 0xFF;
++ if ((x0 > 100) || (y0 > 100) || (x1 > 100) || (y1 > 100))
++ return BadValue;
++ snprintf(chBuf,sizeof(chBuf),"%d,%d,%d,%d",x0,y0,x1,y1);
++ xf86ReplaceStrOption(local->options, "PressCurve",chBuf);
++ xf86WcmSetPressureCurve(priv,x0,y0,x1,y1);
++ }
++ break;
++ }
++ case XWACOM_PARAM_MODE:
++ if ((value < 0) || (value > 1)) return BadValue;
++ if (value)
++ {
++ priv->flags |= ABSOLUTE_FLAG;
++ xf86ReplaceStrOption(local->options, "Mode", "Absolute");
++ }
++ else
++ {
++ priv->flags &= ~ABSOLUTE_FLAG;
++ xf86ReplaceStrOption(local->options, "Mode", "Relative");
++ }
++ break;
++ case XWACOM_PARAM_SPEEDLEVEL:
++ if ((value < 1) || (value > 11)) return BadValue;
++ if (value > 6) priv->speed = 2.00*((double)value - 6.00);
++ else priv->speed = ((double)value) / 6.00;
++ sprintf(st, "%.3f", priv->speed);
++ xf86AddNewOption(local->options, "Speed", st);
++ break;
++ case XWACOM_PARAM_ACCEL:
++ if ((value < 1) || (value > MAX_ACCEL)) return BadValue;
++ priv->accel = value-1;
++ xf86ReplaceIntOption(local->options, "Accel", priv->accel);
++ break;
++ case XWACOM_PARAM_CLICKFORCE:
++ if ((value < 1) || (value > 21)) return BadValue;
++ priv->common->wcmThreshold = (int)((double)
++ (value*priv->common->wcmMaxZ)/100.00+0.5);
++ xf86ReplaceIntOption(local->options, "Threshold",
++ priv->common->wcmThreshold);
++ break;
++ case XWACOM_PARAM_XYDEFAULT:
++ xf86ReplaceIntOption(local->options, "TopX", 0);
++ priv->topX = xf86SetIntOption(local->options, "TopX", 0);
++ xf86ReplaceIntOption(local->options, "TopY", 0);
++ priv->topY = xf86SetIntOption(local->options, "TopY", 0);
++ xf86ReplaceIntOption(local->options,
++ "BottomX", priv->common->wcmMaxX);
++ priv->bottomX = xf86SetIntOption(local->options,
++ "BottomX", priv->common->wcmMaxX);
++ xf86ReplaceIntOption(local->options,
++ "BottomY", priv->common->wcmMaxY);
++ priv->bottomY = xf86SetIntOption(local->options,
++ "BottomY", priv->common->wcmMaxY);
++ break;
++ case XWACOM_PARAM_GIMP:
++ if ((value != 0) && (value != 1)) return BadValue;
++ priv->common->wcmGimp = value;
++ if (value)
++ {
++ xf86ReplaceStrOption(local->options, "Gimp", "on");
++ }
++ else
++ {
++ xf86ReplaceStrOption(local->options, "Gimp", "off");
++ }
++ break;
++ case XWACOM_PARAM_MMT:
++ if ((value != 0) && (value != 1)) return BadValue;
++ priv->common->wcmMMonitor = value;
++ if (value)
++ {
++ xf86ReplaceStrOption(local->options, "MMonitor", "on");
++ }
++ else
++ {
++ xf86ReplaceStrOption(local->options, "MMonitor", "off");
++ }
++ break;
++ case XWACOM_PARAM_TPCBUTTON:
++ if ((value != 0) && (value != 1)) return BadValue;
++ priv->common->wcmTPCButton = value;
++ if (value)
++ {
++ xf86ReplaceStrOption(local->options, "TPCButton", "on");
++ }
++ else
++ {
++ xf86ReplaceStrOption(local->options, "TPCButton", "off");
++ }
++ break;
++ default:
++ DBG(10, ErrorF("xf86WcmSetParam invalid param %d\n",param));
++ return BadMatch;
+ }
-
- ds->proximity = (data[0] & PROXIMITY_BIT);
- } /* end 4D mouse 1st packet */
@@ -2350,47 +2539,150 @@
- common->wcmChannel[channel].pDev = NULL;
- }
- return common->wcmPktLength;
--}
--
--/*****************************************************************************
++ return Success;
+ }
+
+ /*****************************************************************************
- * Model-specific functions
-- ****************************************************************************/
--
++ * xf86WcmOptionCommandToFile
+ ****************************************************************************/
+
-static void serialInitIntuos(WacomCommonPtr common, int fd,
- const char* id, float version)
--{
++static int xf86WcmOptionCommandToFile(LocalDevicePtr local)
+ {
- DBG(2, ErrorF("detected an Intuos model\n"));
--
++ WacomDevicePtr priv = (WacomDevicePtr)local->private;
++ char fileName[80] = "/etc/X11/wcm.";
++ char command[256];
++ FILE *fp = 0;
++ int value, p1,p2,p3,p4;
++ double speed;
++ char *s;
++
++ DBG(10, ErrorF("xf86WcmOptionCommandToFile for %s\n", local->name));
++ strcat(fileName, local->name);
++ fp = fopen(fileName, "w+");
++ if ( fp )
++ {
++ /* write user defined options as xsetwacom commands into fp */
++ s = xf86FindOptionValue(local->options, "TopX");
++ if ( s && priv->topX )
++ fprintf(fp, "xsetwacom set %s TopX %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "TopY");
++ if ( s && priv->topY )
++ fprintf(fp, "xsetwacom set %s TopY %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "BottomX");
++ if ( s && priv->bottomX != priv->common->wcmMaxX )
++ fprintf(fp, "xsetwacom set %s BottomX %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "BottomY");
++ if ( s && priv->bottomY != priv->common->wcmMaxY )
++ fprintf(fp, "xsetwacom set %s BottomY %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "Button1");
++ if ( s && priv->button[0] != 1 )
++ fprintf(fp, "xsetwacom set %s Button1 %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "Button2");
++ if ( s && priv->button[1] != 2 )
++ fprintf(fp, "xsetwacom set %s Button2 %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "Button3");
++ if ( s && priv->button[2] != 3 )
++ fprintf(fp, "xsetwacom set %s Button3 %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "Button4");
++ if ( s && priv->button[3] != 4 )
++ fprintf(fp, "xsetwacom set %s Button4 %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "Button5");
++ if ( s && priv->button[4] != 5 )
++ fprintf(fp, "xsetwacom set %s Button5 %s\n", local->name, s);
+
- common->wcmProtocolLevel = 5;
- common->wcmVersion = version;
--
++ s = xf86FindOptionValue(local->options, "PressCurve");
++ if ( s && !IsCursor(priv) )
++ {
++ sscanf(s, "%d,%d,%d,%d", &p1, &p2, &p3, &p4);
++ if ( p1 || p2 || p3 != 100 || p4 != 100 )
++ fprintf(fp, "xsetwacom set %s PressCurve %d %d %d %d\n",
++ local->name, p1, p2, p3, p4);
++ }
+
- common->wcmMaxZ = 1023; /* max Z value */
- common->wcmResolX = 2540; /* tablet X resolution in points/inch */
- common->wcmResolY = 2540; /* tablet Y resolution in points/inch */
- common->wcmPktLength = 9; /* length of a packet */
- common->wcmFlags |= TILT_ENABLED_FLAG;
-}
--
++ s = xf86FindOptionValue(local->options, "Mode");
++ if ( s && (((priv->flags & ABSOLUTE_FLAG) && IsCursor(priv))
++ || (!(priv->flags & ABSOLUTE_FLAG) && !IsCursor(priv))))
++ fprintf(fp, "xsetwacom set %s Mode %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "RawFilter");
++ if ( s )
++ fprintf(fp, "xsetwacom set %s RawFilter %s\n", local->name, s);
++
++ s = xf86FindOptionValue(local->options, "Accel");
++ if ( s && priv->accel )
++ fprintf(fp, "xsetwacom set %s Accel %d\n", local->name, priv->accel+1);
+
-static void serialInitIntuos2(WacomCommonPtr common, int fd,
- const char* id, float version)
-{
- DBG(2, ErrorF("detected an Intuos2 model\n"));
--
++ s = xf86FindOptionValue(local->options, "Speed");
++ if ( s && priv->speed != DEFAULT_SPEED )
++ {
++ speed = strtod(s, NULL);
++ if(speed >= 10.00) value = 11;
++ else if(speed >= 1.00) value = (int)(speed/2.00 + 6.00);
++ else if(speed < (double)(1.00/6.00)) value = 1;
++ else value = (int)(speed*6.00 + 0.50);
++ if ( value != 6 )
++ fprintf(fp, "xsetwacom set %s SpeedLevel %d\n", local->name, value);
++ }
+
- common->wcmProtocolLevel = 5;
- common->wcmVersion = version;
--
++ s = xf86FindOptionValue(local->options, "Threshold");
++ if ( s )
++ {
++ value = atoi(s);
++ value = (int)((double)value*100.00/(double)priv->common->wcmMaxZ+0.5);
++ if ( value != 6 )
++ fprintf(fp, "xsetwacom set %s ClickForce %d\n", local->name, value);
++ }
+
- common->wcmMaxZ = 1023; /* max Z value */
- common->wcmResolX = 2540; /* tablet X resolution in points/inch */
- common->wcmResolY = 2540; /* tablet Y resolution in points/inch */
- common->wcmPktLength = 9; /* length of a packet */
- common->wcmFlags |= TILT_ENABLED_FLAG;
-}
--
++ s = xf86FindOptionValue(local->options, "Gimp");
++ if ( s )
++ {
++ if ( !priv->common->wcmGimp )
++ fprintf(fp, "xsetwacom set %s Gimp off\n", local->name);
++ }
+
-static void serialInitCintiq(WacomCommonPtr common, int fd,
- const char* id, float version)
-{
- DBG(2, ErrorF("detected a Cintiq model\n"));
--
++ s = xf86FindOptionValue(local->options, "MMonitor");
++ if ( s )
++ {
++ if ( !priv->common->wcmMMonitor )
++ fprintf(fp, "xsetwacom set %s MMonitor off\n", local->name);
++ }
+
- common->wcmProtocolLevel = 4;
- common->wcmPktLength = 7;
- common->wcmVersion = version;
@@ -2425,7 +2717,35 @@
- } else {
- /* PL-600 */
- common->wcmMaxZ = 255;
-- }
++ s = xf86FindOptionValue(local->options, "ForceDevice");
++ if ( s )
++ {
++ if ( !priv->common->wcmTPCButton )
++ fprintf(fp, "xsetwacom set %s TPCButton off\n", local->name);
++ fprintf(fp, "default TPCButton on\n");
++ }
++ else
++ {
++ if ( priv->common->wcmTPCButton )
++ fprintf(fp, "xsetwacom set %s TPCButton on\n", local->name);
++ fprintf(fp, "default TPCButton off\n");
++ }
++ fprintf(fp, "default TopX 0\n");
++ fprintf(fp, "default TopY 0\n");
++ fprintf(fp, "default BottomX %d\n", priv->common->wcmMaxX);
++ fprintf(fp, "default BottomY %d\n", priv->common->wcmMaxY);
++ if (IsCursor(priv) || IsPad(priv))
++ sprintf(command, "default Mode Relative\n");
++ else
++ sprintf(command, "default Mode Absolute\n");
++ fprintf(fp, "%s", command);
++ fprintf(fp, "default SpeedLevel 6\n");
++ fprintf(fp, "default ClickForce 6\n");
++ fprintf(fp, "default Accel 0\n");
++ fprintf(fp, "default Gimp on\n");
++ fprintf(fp, "default Mmonitor on\n");
++ fclose(fp);
+ }
- } else if (id[5] == '8') {
- /* PL-800 */
- common->wcmMaxZ = 511;
@@ -2447,8 +2767,9 @@
- common->wcmMaxZ = 256;
- common->wcmResolX = 1000; /* tablet X resolution in points/inch */
- common->wcmResolY = 1000; /* tablet Y resolution in points/inch */
--}
--
++ return(Success);
+ }
+
-static void serialInitGraphire(WacomCommonPtr common, int fd,
- const char* id, float version)
-{
@@ -2470,7 +2791,7 @@
- const char* id, float version)
-{
- DBG(2, ErrorF("detected a Protocol4 model\n"));
--
+
- common->wcmProtocolLevel = 4;
- common->wcmPktLength = 7;
- common->wcmVersion = version;
@@ -2482,16 +2803,29 @@
- else common->wcmMaxZ = 120;
- }
-}
--
++/*****************************************************************************
++ * xf86WcmModelToFile
++ ****************************************************************************/
+
-static void serialGetResolution(WacomCommonPtr common, int fd)
--{
++static int xf86WcmModelToFile(LocalDevicePtr local)
+ {
- int a, b;
- char buffer[BUFFER_SIZE], header[BUFFER_SIZE];
-
- if (!(common->wcmResolX && common->wcmResolY)) {
- DBG(2, ErrorF("Requesting resolution from device\n"));
- if (xf86WcmSendRequest(fd, WC_CONFIG, buffer, sizeof(buffer)))
-- {
++ FILE *fp = 0;
++ LocalDevicePtr localDevices = xf86FirstLocalDevice();
++ WacomDevicePtr priv = NULL, lprv;
++ char m1[32], m2[32], *m3;
++ int i = 0, x = 0, y = 0;
++
++ DBG(10, ErrorF("xf86WcmModelToFile \n"));
++ fp = fopen("/etc/wacom.dat", "w+");
++ if ( fp )
+ {
- DBG(2, ErrorF("%s\n", buffer));
- /* The header string is simply a place to put the
- * unwanted config header don't use buffer+xx because
@@ -2587,28 +2921,97 @@
- SYSCALL(err = xf86WcmWrite(fd, penpartner_setup_string,
- strlen(penpartner_setup_string)));
- return (err == -1) ? !Success : Success;
--}
--
++ while(localDevices)
++ {
++ m3 = xf86FindOptionValue(localDevices->options, "Type");
++ if (m3 && (strstr(m3, "eraser") || strstr(m3, "stylus")
++ || strstr(m3, "cursor")))
++ lprv = (WacomDevicePtr)localDevices->private;
++ else
++ lprv = NULL;
++ if ( lprv && lprv->common && lprv->common->wcmModel )
++ {
++ sscanf((char*)(lprv->common->wcmModel)->name, "%s %s", m1, m2);
++ if ( lprv->common->wcmEraserID )
++ fprintf(fp, "%s %s %s %s\n", localDevices->name, m2, m3, lprv->common->wcmEraserID);
++ else
++ fprintf(fp, "%s %s %s %s\n", localDevices->name, m2, m3, localDevices->name);
++ if (lprv->twinview != TV_NONE)
++ {
++ priv = lprv;
++ }
++ if( !priv ) priv = lprv;
++ }
++ localDevices = localDevices->next;
++ }
++ /* write TwinView ScreenInfo */
++ if (priv->twinview == TV_ABOVE_BELOW)
++ {
++ fprintf(fp, "Screen0 %d %d %d %d\n", priv->tvResolution[0],
++ priv->tvResolution[1], 0, 0);
++ fprintf(fp, "Screen1 %d %d %d %d\n", priv->tvResolution[2],
++ priv->tvResolution[3], 0, priv->tvResolution[1]);
++ }
++ else if (priv->twinview == TV_LEFT_RIGHT)
++ {
++ fprintf(fp, "Screen0 %d %d %d %d\n", priv->tvResolution[0],
++ priv->tvResolution[1], 0, 0);
++ fprintf(fp, "Screen1 %d %d %d %d\n", priv->tvResolution[2],
++ priv->tvResolution[3], priv->tvResolution[0], 0);
++ }
++ /* write other screen setup info */
++ else
++ {
++ for (i = 0; i<screenInfo.numScreens; i++)
++ {
++ fprintf(fp, "Screen%d %d %d %d %d\n",
++ i, screenInfo.screens[i]->width,
++ screenInfo.screens[i]->height, x, y);
++ x += screenInfo.screens[i]->width;
++ }
++ }
++ fclose(fp);
++ }
++ return(Success);
+ }
+
-static int serialEnableTiltProtocol4(WacomCommonPtr common, int fd)
-{
- return Success;
-}
--
++/*****************************************************************************
++* xf86WcmDevSwitchMode --
++*****************************************************************************/
+
-static int serialEnableSuppressProtocol4(WacomCommonPtr common, int fd)
--{
++static int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
+ {
- char buf[20];
- int err;
--
++ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
++ WacomDevicePtr priv = (WacomDevicePtr)local->private;
+
- sprintf(buf, "%s%d\r", WC_SUPPRESS, common->wcmSuppress);
- SYSCALL(err = xf86WcmWrite(fd, buf, strlen(buf)));
--
++ DBG(3, ErrorF("xf86WcmSwitchMode dev=%p mode=%d\n", (void *)dev, mode));
+
- if (err == -1) {
- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
- return !Success;
- }
- return Success;
-}
--
++ if (mode == Absolute)
++ priv->flags |= ABSOLUTE_FLAG;
++ else if (mode == Relative)
++ priv->flags &= ~ABSOLUTE_FLAG;
++ else
++ {
++ DBG(10, ErrorF("xf86WcmSwitchMode dev=%p invalid mode=%d\n",
++ (void *)dev, mode));
++ return BadMatch;
++ }
+
-static int serialSetLinkSpeedIntuos(WacomCommonPtr common, int fd)
-{
- if ((common->wcmLinkSpeed == 38400) && (common->wcmVersion < 2.0F)) {
@@ -2618,8 +3021,9 @@
- common->wcmLinkSpeed = 19200;
- }
- return serialSetLinkSpeedProtocol5(common,fd);
--}
--
++ return Success;
+ }
+
-static int serialSetLinkSpeedProtocol5(WacomCommonPtr common, int fd)
-{
- int err;
@@ -2647,9 +3051,13 @@
-
- return Success;
-}
--
++/*****************************************************************************
++ * xf86WcmDevChangeControl --
++ ****************************************************************************/
+
-static int serialStartTablet(WacomCommonPtr common, int fd)
--{
++static int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl* control)
+ {
- int err;
-
- /* Tell the tablet to start sending coordinates */
@@ -2659,10 +3067,18 @@
- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
- return !Success;
- }
--
++ xDeviceResolutionCtl* res = (xDeviceResolutionCtl *)control;
++ int* r = (int*)(res+1);
++ int param = r[0], value = r[1];
+
- return Success;
-}
--
++ DBG(10, ErrorF("xf86WcmChangeControl firstValuator=%d\n",
++ res->first_valuator));
++
++ if (control->control != DEVICE_RESOLUTION || !res->num_valuators)
++ return BadMatch;
+
-static void serialParseP4Common(WacomCommonPtr common,
- const unsigned char* data, WacomDeviceState* last,
- WacomDeviceState* ds)
@@ -2693,7 +3109,28 @@
- WacomDeviceState out = { 0 };
- xf86WcmEvent(common,0,&out);
- ds->device_type = cur_type;
-- }
++ r[0] = 1, r[1] = 1;
++ switch (res->first_valuator)
++ {
++ case 0: /* a new write to wcm.$name */
++ {
++ return xf86WcmOptionCommandToFile(local);
++ }
++ case 1: /* a new write to wacom.dat */
++ {
++ return xf86WcmModelToFile(local);
++ }
++ case 4: /* JEJ - test */
++ {
++ DBG(10,ErrorF("xf86WcmChangeControl: %x,%x\n",
++ param,value));
++ return xf86WcmSetParam(local,param,value);
++ }
++ default:
++ DBG(10,ErrorF("xf86WcmChangeControl invalid "
++ "firstValuator=%d\n",res->first_valuator));
++ return BadMatch;
+ }
- }
-
- DBG(8, ErrorF("serialParseP4Common %s\n",
@@ -2708,17 +3145,24 @@
- if (data[7] & TILT_SIGN_BIT) ds->tiltx -= 64;
- if (data[8] & TILT_SIGN_BIT) ds->tilty -= 64;
- }
--}
--
--/*****************************************************************************
+ }
+
+ /*****************************************************************************
- * xf86WcmSerialValidate -- validates serial packet; returns 0 on success,
- * positive number of bytes to skip on error.
-- ****************************************************************************/
--
++ * xf86WcmDevConvert --
++ * Convert valuators to X and Y. Only used by core events.
+ ****************************************************************************/
+
-int xf86WcmSerialValidate(WacomCommonPtr common, const unsigned char* data)
--{
++static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num,
++ int v0, int v1, int v2, int v3, int v4, int v5, int* x, int* y)
+ {
- int i, bad = 0;
--
++ WacomDevicePtr priv = (WacomDevicePtr) local->private;
++
++ DBG(6, ErrorF("xf86WcmDevConvert v0=%d v1=%d \n", v0, v1));
+
- /* check magic */
- for (i=0; i<common->wcmPktLength; ++i) {
- if ( ((i==0) && !(data[i] & HEADER_BIT)) || ((i!=0) && (data[i] & HEADER_BIT))) {
@@ -2731,7 +3175,9 @@
- if (bad) return common->wcmPktLength;
- else return 0;
-}
--
++ if (first != 0 || num == 1)
++ return FALSE;
+
-static WacomModel isdv4General =
-{
- "General ISDV4",
@@ -2746,24 +3192,120 @@
- isdv4Parse,
- xf86WcmFilterCoord, /* input filtering */
-};
--
++ if (priv->twinview == TV_NONE && (priv->flags & ABSOLUTE_FLAG))
++ {
++ v0 = v0 > priv->bottomX ? priv->bottomX - priv->topX :
++ v0 < priv->topX ? 0 : v0 - priv->topX;
++ v1 = v1 > priv->bottomY ? priv->bottomY - priv->topY :
++ v1 < priv->topY ? 0 : v1 - priv->topY;
++ }
+
-/*****************************************************************************
- * isdv4Detect -- Test if the attached device is ISDV4.
- ****************************************************************************/
--
++#ifdef PANORAMIX
++ if (!noPanoramiXExtension && (priv->flags & ABSOLUTE_FLAG) &&
++ priv->common->wcmGimp && priv->common->wcmMMonitor)
++ {
++ int i, totalWidth, leftPadding = 0;
++ for (i = 0; i < priv->currentScreen; i++)
++ leftPadding += screenInfo.screens[i]->width;
++ for (totalWidth = leftPadding; i < priv->numScreen; i++)
++ totalWidth += screenInfo.screens[i]->width;
++ v0 -= (priv->bottomX - priv->topX) * leftPadding
++ / (double)totalWidth + 0.5;
++ }
++#endif
++ if (priv->twinview != TV_NONE && (priv->flags & ABSOLUTE_FLAG))
++ {
++ v0 -= priv->topX - priv->tvoffsetX;
++ v1 -= priv->topY - priv->tvoffsetY;
++ if (priv->twinview == TV_LEFT_RIGHT)
++ {
++ if (v0 > priv->bottomX - priv->tvoffsetX && priv->screen_no == -1)
++ {
++ if (priv->currentScreen == 0)
++ v0 = priv->bottomX - priv->tvoffsetX;
++ else
++ {
++ v0 -= priv->bottomX - priv->topX - 2*priv->tvoffsetX;
++ if (v0 > priv->bottomX - priv->tvoffsetX)
++ v0 = 2*(priv->bottomX - priv->tvoffsetX) - v0;
++ }
++ }
++ if (priv->currentScreen == 1)
++ {
++ *x = priv->tvResolution[0] + priv->tvResolution[2]
++ * v0 / (priv->bottomX - priv->topX - 2*priv->tvoffsetX);
++ *y = v1 * priv->tvResolution[3] /
++ (priv->bottomY - priv->topY - 2*priv->tvoffsetY) + 0.5;
++ }
++ else
++ {
++ *x = priv->tvResolution[0] * v0
++ / (priv->bottomX - priv->topX - 2*priv->tvoffsetX);
++ *y = v1 * priv->tvResolution[1] /
++ (priv->bottomY - priv->topY - 2*priv->tvoffsetY) + 0.5;
++ }
++ }
++ if (priv->twinview == TV_ABOVE_BELOW)
++ {
++ if (v1 > priv->bottomY - priv->tvoffsetY && priv->screen_no == -1)
++ {
++ if (priv->currentScreen == 0)
++ v1 = priv->bottomY - priv->tvoffsetY;
++ else
++ {
++ v1 -= priv->bottomY - priv->topY - 2*priv->tvoffsetY;
++ if (v1 > priv->bottomY - priv->tvoffsetY)
++ v1 = 2*(priv->bottomY - priv->tvoffsetY) - v1;
++ }
++ }
++ if (priv->currentScreen == 1)
++ {
++ *x = v0 * priv->tvResolution[2] /
++ (priv->bottomX - priv->topX - 2*priv->tvoffsetX) + 0.5;
++ *y = priv->tvResolution[1] +
++ priv->tvResolution[3] * v1 /
++ (priv->bottomY - priv->topY - 2*priv->tvoffsetY);
++ }
++ else
++ {
++ *x = v0 * priv->tvResolution[0] /
++ (priv->bottomX - priv->topX - 2*priv->tvoffsetX) + 0.5;
++ *y = priv->tvResolution[1] * v1 /
++ (priv->bottomY - priv->topY - 2*priv->tvoffsetY);
++ }
++ }
++ }
++ else
++ {
++ *x = v0 * priv->factorX + 0.5;
++ *y = v1 * priv->factorY + 0.5;
++ }
+
-static Bool isdv4Detect(LocalDevicePtr local)
-{
- WacomDevicePtr priv = (WacomDevicePtr) local->private;
- WacomCommonPtr common = priv->common;
- return (common->wcmForceDevice == DEVICE_ISDV4) ? 1 : 0;
--}
--
--/*****************************************************************************
++ DBG(6, ErrorF("Wacom converted v0=%d v1=%d to x=%d y=%d\n",
++ v0, v1, *x, *y));
++ return TRUE;
+ }
+
+ /*****************************************************************************
- * isdv4Init --
-- ****************************************************************************/
--
++ * xf86WcmDevReverseConvert --
++ * Convert X and Y to valuators. Only used by core events.
++ * Handdle relatve screen to tablet convert
++ * We don't support screen mapping yet (Ping April 22, 2005)
+ ****************************************************************************/
+
-static Bool isdv4Init(LocalDevicePtr local)
--{
++static Bool xf86WcmDevReverseConvert(LocalDevicePtr local, int x, int y,
++ int* valuators)
+ {
- int err;
- WacomDevicePtr priv = (WacomDevicePtr)local->private;
- WacomCommonPtr common = priv->common;
@@ -2814,23 +3356,94 @@
- ErrorF("Wacom xf86WcmWrite error : %s\n", strerror(errno));
- return !Success;
- }
--
++ DBG(6, ErrorF("xf86WcmDevReverseConvert x=%d y=%d \n", x, y));
+
- /* Wait 75 mSecs */
- if (xf86WcmWait(75)) return !Success;
--
++#ifdef NEVER
++ WacomDevicePtr priv = (WacomDevicePtr) local->private;
++ valuators[0] = x / priv->factorX + 0.5;
++ valuators[1] = y / priv->factorY + 0.5;
+
- xf86WcmFlushTablet(local->fd);
--
++#ifdef PANORAMIX
++ if (!noPanoramiXExtension && (priv->flags & ABSOLUTE_FLAG) &&
++ priv->common->wcmGimp && priv->common->wcmMMonitor)
++ {
++ int i, totalWidth, leftPadding = 0;
++ for (i = 0; i < priv->currentScreen; i++)
++ leftPadding += screenInfo.screens[i]->width;
++ for (totalWidth = leftPadding; i < priv->numScreen; i++)
++ totalWidth += screenInfo.screens[i]->width;
++ valuators[0] += (priv->bottomX - priv->topX)
++ * leftPadding / (double)totalWidth + 0.5;
++ }
++#endif
++ if (priv->twinview != TV_NONE && (priv->flags & ABSOLUTE_FLAG))
++ {
++ if (priv->twinview == TV_LEFT_RIGHT)
++ {
++ if (x > priv->tvResolution[0])
++ x -= priv->tvResolution[0];
++ if (priv->currentScreen == 1)
++ {
++ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX)
++ / priv->tvResolution[2] + 0.5;
++ valuators[1] = y * (priv->bottomY - priv->topY - 2*priv->tvoffsetY) /
++ priv->tvResolution[3] + 0.5;
++ }
++ else
++ {
++ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX)
++ / priv->tvResolution[0] + 0.5;
++ valuators[1] = y * (priv->bottomY - priv->topY - 2*priv->tvoffsetY) /
++ priv->tvResolution[1] + 0.5;
++ }
++ }
++ if (priv->twinview == TV_ABOVE_BELOW)
++ {
++ if (y > priv->tvResolution[1])
++ y -= priv->tvResolution[1];
++ if (priv->currentScreen == 1)
++ {
++ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX) /
++ priv->tvResolution[2] + 0.5;
++ valuators[1] = y *(priv->bottomY - priv->topY - 2*priv->tvoffsetY)
++ / priv->tvResolution[3] + 0.5;
++ }
++ else
++ {
++ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX) /
++ priv->tvResolution[0] + 0.5;
++ valuators[1] = y *(priv->bottomY - priv->topY - 2*priv->tvoffsetY)
++ / priv->tvResolution[1] + 0.5;
++ }
++ }
++ }
++ if (priv->flags & ABSOLUTE_FLAG)
++ {
++ valuators[0] += priv->topX + priv->tvoffsetX;
++ valuators[1] += priv->topY + priv->tvoffsetY;
++ }
++#endif
++ DBG(6, ErrorF("Wacom converted x=%d y=%d to v0=%d v1=%d v2=%d v3=%d v4=%d v5=%d\n", x, y,
++ valuators[0], valuators[1], valuators[2], valuators[3], valuators[4], valuators[5]));
+
- DBG(2, ErrorF("not reading model -- Wacom TabletPC ISD V4\n"));
- return xf86WcmInitTablet(common,&isdv4General,local->fd,"unknown",0.0);
--}
--
--/*****************************************************************************
++ return TRUE;
+ }
+
+ /*****************************************************************************
- * isdv4InitISDV4 -- Setup the device
-- ****************************************************************************/
--
++ * xf86WcmInitDevice --
++ * Open and initialize the tablet
+ ****************************************************************************/
+
-static void isdv4InitISDV4(WacomCommonPtr common, int fd,
- const char* id, float version)
--{
++static Bool xf86WcmInitDevice(LocalDevicePtr local)
+ {
- DBG(2, ErrorF("initializing as ISDV4 model\n"));
-
- /* set parameters */
@@ -2848,7 +3461,9 @@
- common->wcmMaxY = 21136;
- }
-}
--
++ WacomCommonPtr common = ((WacomDevicePtr)local->private)->common;
++ int loop;
+
-static int isdv4Parse(WacomCommonPtr common, const unsigned char* data)
-{
- WacomDeviceState* last = &common->wcmChannel[0].valid.state;
@@ -2924,12 +3539,17 @@
- WacomDeviceState out = { 0 };
- xf86WcmEvent(common,0,&out);
- ds->device_type = cur_type;
-- }
++ DBG(1,ErrorF("xf86WcmInitDevice: "));
++ if (common->wcmInitialized)
++ {
++ DBG(1,ErrorF("already initialized\n"));
++ return TRUE;
+ }
- }
-
- DBG(8, ErrorF("isdv4Parse %s\n", ds->device_type == ERASER_ID ? "ERASER " :
- ds->device_type == STYLUS_ID ? "STYLUS" : "NONE"));
--
+
- xf86WcmEvent(common,0,ds);
-
- return common->wcmPktLength;
@@ -2956,10 +3576,21 @@
- c = d1 / d2;
- *x = x0 + c * vx;
- *y = y0 + c * vy;
-- }
++ /* attempt to open the device */
++ if ((xf86WcmOpen(local) != Success) || (local->fd < 0))
++ {
++ DBG(1,ErrorF("Failed to open device (fd=%d)\n",local->fd));
++ if (local->fd >= 0)
++ {
++ DBG(1,ErrorF("Closing device\n"));
++ SYSCALL(xf86WcmClose(local->fd));
++ }
++ local->fd = -1;
++ return FALSE;
+ }
- }
-}
--
+
-static int filterOnLine(double x0, double y0, double x1, double y1,
- double a, double b)
-{
@@ -2968,11 +3599,17 @@
- d = (x-a)*(x-a) + (y-b)*(y-b);
- return d < 0.00001; /* within 100th of a point (1E-2 squared) */
-}
--
++ /* on success, mark all other local devices as open and initialized */
++ common->wcmInitialized = TRUE;
+
-static void filterLine(int* pCurve, int nMax, int x0, int y0, int x1, int y1)
-{
- int dx, dy, ax, ay, sx, sy, x, y, d;
--
++ DBG(1,ErrorF("Marking all devices open\n"));
++ /* report the file descriptor to all devices */
++ for (loop=0; loop<common->wcmNumDevices; loop++)
++ common->wcmDevices[loop]->fd = local->fd;
+
- /* sanity check */
- if ((x0 < 0) || (y0 < 0) || (x1 < 0) || (y1 < 0) ||
- (x0 > nMax) || (y0 > nMax) || (x1 > nMax) || (y1 > nMax))
@@ -3995,7 +4632,7 @@
- if (common->wcmInitialized)
- {
- DBG(1,ErrorF("already initialized\n"));
-- return TRUE;
+ return TRUE;
- }
-
- DBG(1,ErrorF("initializing\n"));
@@ -4066,7 +4703,7 @@
- if (n >= 0) return n ? 1 : 0;
- ErrorF("Wacom select error : %s\n", strerror(errno));
- return 0;
--}
+ }
-
-/*
- ***************************************************************************
@@ -4615,8 +5252,7 @@
-static int
-xf86WcmDevProc(DeviceIntPtr pWcm,
- int what)
-+static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
- {
+-{
- CARD8 map[(32 << 4) + 1];
- int nbaxes;
- int nbbuttons;
@@ -4629,12 +5265,9 @@
- (DEVICE_ID(priv->flags) == STYLUS_ID) ? "stylus" :
- (DEVICE_ID(priv->flags) == CURSOR_ID) ? "cursor" : "eraser",
- priv->flags, what));
-+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
-+ char st[32];
-
+-
- switch (what)
-+ switch (param)
- {
+- {
- case DEVICE_INIT:
- DBG(1, ErrorF("xf86WcmProc pWcm=%p what=INIT\n", (void *)pWcm));
-
@@ -4643,22 +5276,13 @@
- switch(DEVICE_ID(priv->flags)) {
- case ERASER_ID:
- nbbuttons = 1;
-+ case XWACOM_PARAM_TOPX:
-+ xf86ReplaceIntOption(local->options, "TopX", value);
-+ priv->topX = xf86SetIntOption(local->options, "TopX", 0);
- break;
+- break;
- case STYLUS_ID:
- nbbuttons = 4;
-+ case XWACOM_PARAM_TOPY:
-+ xf86ReplaceIntOption(local->options, "TopY", value);
-+ priv->topY = xf86SetIntOption(local->options, "TopY", 0);
- break;
+- break;
- default:
- nbbuttons = 16;
-+ case XWACOM_PARAM_BOTTOMX:
-+ xf86ReplaceIntOption(local->options, "BottomX", value);
-+ priv->bottomX = xf86SetIntOption(local->options, "BottomX", 0);
- break;
+- break;
- }
-
- for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop;
@@ -4709,75 +5333,14 @@
-
- /* open the device to gather informations */
- if (!xf86WcmDevOpen(pWcm))
-+ case XWACOM_PARAM_BOTTOMY:
-+ xf86ReplaceIntOption(local->options, "BottomY", value);
-+ priv->bottomY = xf86SetIntOption(local->options, "BottomY", 0);
-+ break;
-+ case XWACOM_PARAM_BUTTON1:
-+ if ((value < 0) || (value > 19)) return BadValue;
-+ xf86ReplaceIntOption(local->options,"Button1",value);
-+ priv->button[0] = xf86SetIntOption(local->options,"Button1",1);
-+ break;
-+ case XWACOM_PARAM_BUTTON2:
-+ if ((value < 0) || (value > 19)) return BadValue;
-+ xf86ReplaceIntOption(local->options, "Button2", value);
-+ priv->button[1] = xf86SetIntOption(local->options,"Button2",2);
-+ break;
-+ case XWACOM_PARAM_BUTTON3:
-+ if ((value < 0) || (value > 19)) return BadValue;
-+ xf86ReplaceIntOption(local->options, "Button3", value);
-+ priv->button[2] = xf86SetIntOption(local->options,"Button3",3);
-+ break;
-+ case XWACOM_PARAM_BUTTON4:
-+ if ((value < 0) || (value > 19)) return BadValue;
-+ xf86ReplaceIntOption(local->options, "Button4", value);
-+ priv->button[3] = xf86SetIntOption(local->options,"Button4",4);
-+ break;
-+ case XWACOM_PARAM_BUTTON5:
-+ if ((value < 0) || (value > 19)) return BadValue;
-+ xf86ReplaceIntOption(local->options, "Button5", value);
-+ priv->button[4] = xf86SetIntOption(local->options,"Button5",5);
-+ break;
-+ case XWACOM_PARAM_DEBUGLEVEL:
-+ if ((value < 1) || (value > 100)) return BadValue;
-+ xf86ReplaceIntOption(local->options, "DebugLevel", value);
-+ gWacomModule.debugLevel = value;
-+ break;
-+ case XWACOM_PARAM_RAWFILTER:
-+ if ((value < 0) || (value > 1)) return BadValue;
-+ if (value)
-+ {
-+ priv->common->wcmFlags |= RAW_FILTERING_FLAG;
-+ xf86ReplaceStrOption(local->options, "RawFilter", "On");
-+ }
-+ else
-+ {
-+ priv->common->wcmFlags &= ~(RAW_FILTERING_FLAG);
-+ xf86ReplaceStrOption(local->options, "RawFilter", "Off");
-+ }
-+ break;
-+ case XWACOM_PARAM_PRESSCURVE:
- {
+- {
- /* Sometime PL does not open the first time */
- DBG(1, ErrorF("xf86WcmProc try to open pWcm=%p again\n", (void *)pWcm));
- if (!xf86WcmDevOpen(pWcm)) {
- DBG(1, ErrorF("xf86WcmProc pWcm=%p what=INIT FALSE\n", (void *)pWcm));
- return !Success;
-+ if ( !IsCursor(priv) )
-+ {
-+ char chBuf[64];
-+ int x0 = (value >> 24) & 0xFF;
-+ int y0 = (value >> 16) & 0xFF;
-+ int x1 = (value >> 8) & 0xFF;
-+ int y1 = value & 0xFF;
-+ if ((x0 > 100) || (y0 > 100) || (x1 > 100) || (y1 > 100))
-+ return BadValue;
-+ snprintf(chBuf,sizeof(chBuf),"%d,%d,%d,%d",x0,y0,x1,y1);
-+ xf86ReplaceStrOption(local->options, "PressCurve",chBuf);
-+ xf86WcmSetPressureCurve(priv,x0,y0,x1,y1);
- }
-+ break;
- }
+- }
+- }
- break;
-
- case DEVICE_ON:
@@ -4806,144 +5369,21 @@
- ErrorF("wacom unsupported mode=%d\n", what);
- return !Success;
- break;
-+ case XWACOM_PARAM_MODE:
-+ if ((value < 0) || (value > 1)) return BadValue;
-+ if (value)
-+ {
-+ priv->flags |= ABSOLUTE_FLAG;
-+ xf86ReplaceStrOption(local->options, "Mode", "Absolute");
-+ }
-+ else
-+ {
-+ priv->flags &= ~ABSOLUTE_FLAG;
-+ xf86ReplaceStrOption(local->options, "Mode", "Relative");
-+ }
-+ break;
-+ case XWACOM_PARAM_SPEEDLEVEL:
-+ if ((value < 1) || (value > 11)) return BadValue;
-+ if (value > 6) priv->speed = 2.00*((double)value - 6.00);
-+ else priv->speed = ((double)value) / 6.00;
-+ sprintf(st, "%.3f", priv->speed);
-+ xf86AddNewOption(local->options, "Speed", st);
-+ break;
-+ case XWACOM_PARAM_ACCEL:
-+ if ((value < 1) || (value > MAX_ACCEL)) return BadValue;
-+ priv->accel = value-1;
-+ xf86ReplaceIntOption(local->options, "Accel", priv->accel);
-+ break;
-+ case XWACOM_PARAM_CLICKFORCE:
-+ if ((value < 1) || (value > 21)) return BadValue;
-+ priv->common->wcmThreshold = (int)((double)
-+ (value*priv->common->wcmMaxZ)/100.00+0.5);
-+ xf86ReplaceIntOption(local->options, "Threshold",
-+ priv->common->wcmThreshold);
-+ break;
-+ case XWACOM_PARAM_XYDEFAULT:
-+ xf86ReplaceIntOption(local->options, "TopX", 0);
-+ priv->topX = xf86SetIntOption(local->options, "TopX", 0);
-+ xf86ReplaceIntOption(local->options, "TopY", 0);
-+ priv->topY = xf86SetIntOption(local->options, "TopY", 0);
-+ xf86ReplaceIntOption(local->options,
-+ "BottomX", priv->common->wcmMaxX);
-+ priv->bottomX = xf86SetIntOption(local->options,
-+ "BottomX", priv->common->wcmMaxX);
-+ xf86ReplaceIntOption(local->options,
-+ "BottomY", priv->common->wcmMaxY);
-+ priv->bottomY = xf86SetIntOption(local->options,
-+ "BottomY", priv->common->wcmMaxY);
-+ break;
-+ case XWACOM_PARAM_GIMP:
-+ if ((value != 0) && (value != 1)) return BadValue;
-+ priv->common->wcmGimp = 0;
-+ if (value) priv->common->wcmGimp = value;
-+ break;
-+ case XWACOM_PARAM_MMT:
-+ if ((value != 0) && (value != 1)) return BadValue;
-+ priv->common->wcmMMonitor = 0;
-+ if (value) priv->common->wcmMMonitor = value;
-+ break;
-+ case XWACOM_PARAM_TPCBUTTON:
-+ if ((value != 0) && (value != 1)) return BadValue;
-+ priv->common->wcmTPCButton = value;
-+ if (value)
-+ {
-+ xf86ReplaceStrOption(local->options, "TPCButton", "on");
-+ }
-+ else
-+ {
-+ xf86ReplaceStrOption(local->options, "TPCButton", "off");
-+ }
-+ break;
-+ default:
-+ DBG(10, ErrorF("xf86WcmSetParam invalid param %d\n",param));
-+ return BadMatch;
- }
+- }
- DBG(2, ErrorF("END xf86WcmProc Success what=%d dev=%p priv=%p\n",
- what, (void *)pWcm, (void *)priv));
- return Success;
-+ return Success;
- }
-
- /*****************************************************************************
+-}
+-
+-/*****************************************************************************
- * xf86WcmSetParam
-+ * xf86WcmOptionCommandToFile
- ****************************************************************************/
-
+- ****************************************************************************/
+-
-static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
-+static int xf86WcmOptionCommandToFile(LocalDevicePtr local)
- {
+-{
- WacomDevicePtr priv = (WacomDevicePtr)local->private;
- char st[32];
-+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
-+ char fileName[80] = "/etc/X11/wcm.";
-+ char command[256];
-+ FILE *fp = 0;
-+ int value, p1,p2,p3,p4;
-+ double speed;
-+ char *s;
-+
-+ DBG(10, ErrorF("xf86WcmOptionCommandToFile for %s\n", local->name));
-+ strcat(fileName, local->name);
-+ fp = fopen(fileName, "w+");
-+ if ( fp )
-+ {
-+ /* write user defined options as xsetwacom commands into fp */
-+ s = xf86FindOptionValue(local->options, "TopX");
-+ if ( s && priv->topX )
-+ fprintf(fp, "xsetwacom set %s TopX %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "TopY");
-+ if ( s && priv->topY )
-+ fprintf(fp, "xsetwacom set %s TopY %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "BottomX");
-+ if ( s && priv->bottomX != priv->common->wcmMaxX )
-+ fprintf(fp, "xsetwacom set %s BottomX %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "BottomY");
-+ if ( s && priv->bottomY != priv->common->wcmMaxY )
-+ fprintf(fp, "xsetwacom set %s BottomY %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "Button1");
-+ if ( s && priv->button[0] != 1 )
-+ fprintf(fp, "xsetwacom set %s Button1 %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "Button2");
-+ if ( s && priv->button[1] != 2 )
-+ fprintf(fp, "xsetwacom set %s Button2 %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "Button3");
-+ if ( s && priv->button[2] != 3 )
-+ fprintf(fp, "xsetwacom set %s Button3 %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "Button4");
-+ if ( s && priv->button[3] != 4 )
-+ fprintf(fp, "xsetwacom set %s Button4 %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "Button5");
-+ if ( s && priv->button[4] != 5 )
-+ fprintf(fp, "xsetwacom set %s Button5 %s\n", local->name, s);
-
+-
- switch (param) {
- case XWACOM_PARAM_TOPX:
- xf86ReplaceIntOption(local->options, "TopX", value);
@@ -5063,31 +5503,11 @@
- }
- return Success;
-}
-+ s = xf86FindOptionValue(local->options, "PressCurve");
-+ if ( s && !IsCursor(priv) )
-+ {
-+ sscanf(s, "%d,%d,%d,%d", &p1, &p2, &p3, &p4);
-+ if ( p1 || p2 || p3 != 100 || p4 != 100 )
-+ fprintf(fp, "xsetwacom set %s PressCurve %d %d %d %d\n",
-+ local->name, p1, p2, p3, p4);
-+ }
-
+-
-/*****************************************************************************
- * xf86WcmOptionCommandToFile
- ****************************************************************************/
-+ s = xf86FindOptionValue(local->options, "Mode");
-+ if ( s && (((priv->flags & ABSOLUTE_FLAG) && IsCursor(priv))
-+ || (!(priv->flags & ABSOLUTE_FLAG) && !IsCursor(priv))))
-+ fprintf(fp, "xsetwacom set %s Mode %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "RawFilter");
-+ if ( s )
-+ fprintf(fp, "xsetwacom set %s RawFilter %s\n", local->name, s);
-+
-+ s = xf86FindOptionValue(local->options, "Accel");
-+ if ( s && priv->accel )
-+ fprintf(fp, "xsetwacom set %s Accel %d\n", local->name, priv->accel+1);
-
+-
-static int xf86WcmOptionCommandToFile(LocalDevicePtr local)
-{
- WacomDevicePtr priv = (WacomDevicePtr)local->private;
@@ -5158,18 +5578,7 @@
- s = xf86FindOptionValue(local->options, "Suppress");
- if ( s )
- fprintf(fp, "xsetwacom set %s Suppress %s\n", local->name, s);
-+ s = xf86FindOptionValue(local->options, "Speed");
-+ if ( s && priv->speed != DEFAULT_SPEED )
-+ {
-+ speed = strtod(s, NULL);
-+ if(speed >= 10.00) value = 11;
-+ else if(speed >= 1.00) value = (int)(speed/2.00 + 6.00);
-+ else if(speed < (double)(1.00/6.00)) value = 1;
-+ else value = (int)(speed*6.00 + 0.50);
-+ if ( value != 6 )
-+ fprintf(fp, "xsetwacom set %s SpeedLevel %d\n", local->name, value);
-+ }
-
+-
- s = xf86FindOptionValue(local->options, "Speed");
- if ( s && priv->speed != DEFAULT_SPEED )
- {
@@ -5180,48 +5589,14 @@
- else value = (int)(speed*6.00 - 0.50);
- fprintf(fp, "xsetwacom set %s SpeedLevel %d\n", local->name, value);
- }
-+ s = xf86FindOptionValue(local->options, "Threshold");
-+ if ( s )
-+ {
-+ value = atoi(s);
-+ value = (int)((double)value*100.00/(double)priv->common->wcmMaxZ+0.5);
-+ if ( value != 6 )
-+ fprintf(fp, "xsetwacom set %s ClickForce %d\n", local->name, value);
-+ }
-
+-
- s = xf86FindOptionValue(local->options, "Threshold");
- if ( s )
- {
- value = atoi(s);
- value = (int)((double)value*100.00/(double)priv->common->wcmMaxZ+0.5);
- fprintf(fp, "xsetwacom set %s ClickForce %d\n", local->name, value);
-+ s = xf86FindOptionValue(local->options, "ForceDevice");
-+ if ( s )
-+ {
-+ if ( !priv->common->wcmTPCButton )
-+ fprintf(fp, "xsetwacom set %s TPCButton off\n", local->name);
-+ fprintf(fp, "default TPCButton on\n");
-+ }
-+ else
-+ {
-+ if ( priv->common->wcmTPCButton )
-+ fprintf(fp, "xsetwacom set %s TPCButton on\n", local->name);
-+ fprintf(fp, "default TPCButton off\n");
-+ }
-+ fprintf(fp, "default TopX 0\n");
-+ fprintf(fp, "default TopY 0\n");
-+ fprintf(fp, "default BottomX %d\n", priv->common->wcmMaxX);
-+ fprintf(fp, "default BottomY %d\n", priv->common->wcmMaxY);
-+ if (IsCursor(priv))
-+ sprintf(command, "default Mode Relative\n");
-+ else
-+ sprintf(command, "default Mode Absolute\n");
-+ fprintf(fp, "%s", command);
-+ fprintf(fp, "default SpeedLevel 6\n");
-+ fprintf(fp, "default ClickForce 6\n");
-+ fprintf(fp, "default Accel 0\n");
-+ fclose(fp);
- }
+- }
-
- fprintf(fp, "%s", "default TopX 0\n");
- fprintf(fp, "%s", "default TopY 0\n");
@@ -5238,16 +5613,14 @@
- fclose(fp);
- }
- return(Success);
-+ return(Success);
- }
-
-+
- /*****************************************************************************
- * xf86WcmModelToFile
- ****************************************************************************/
-
- static int xf86WcmModelToFile(LocalDevicePtr local)
- {
+-}
+-
+-/*****************************************************************************
+- * xf86WcmModelToFile
+- ****************************************************************************/
+-
+-static int xf86WcmModelToFile(LocalDevicePtr local)
+-{
- FILE *fp = 0;
- LocalDevicePtr localDevices = xf86FirstLocalDevice();
- WacomDevicePtr priv = NULL, lprv;
@@ -5329,16 +5702,7 @@
- return xf86WcmModelToFile(local);
- }
- case 4:
-+ FILE *fp = 0;
-+ LocalDevicePtr localDevices = xf86FirstLocalDevice();
-+ WacomDevicePtr priv = NULL, lprv;
-+ char m1[32], m2[32], *m3;
-+ int i = 0, x = 0, y = 0;
-+
-+ DBG(10, ErrorF("xf86WcmModelToFile \n"));
-+ fp = fopen("/etc/wacom.dat", "w+");
-+ if ( fp )
- {
+- {
- DBG(10,ErrorF("xf86WcmDevChangeControl: 0x%x, 0x%x\n", param, value));
- return xf86WcmSetParam(local,param,value);
- }
@@ -5380,60 +5744,8 @@
- }
- }
- return Success;
-+ while(localDevices)
-+ {
-+ m3 = xf86FindOptionValue(localDevices->options, "Type");
-+ if (m3 && (strstr(m3, "eraser") || strstr(m3, "stylus")
-+ || strstr(m3, "cursor")))
-+ lprv = (WacomDevicePtr)localDevices->private;
-+ else
-+ lprv = NULL;
-+ if ( lprv && lprv->common && lprv->common->wcmModel )
-+ {
-+ sscanf((char*)(lprv->common->wcmModel)->name, "%s %s", m1, m2);
-+ if ( lprv->common->wcmEraserID )
-+ fprintf(fp, "%s %s %s %s\n", localDevices->name, m2, m3, lprv->common->wcmEraserID);
-+ else
-+ fprintf(fp, "%s %s %s %s\n", localDevices->name, m2, m3, localDevices->name);
-+ if (lprv->twinview != TV_NONE)
-+ {
-+ priv = lprv;
-+ }
-+ if( !priv ) priv = lprv;
-+ }
-+ localDevices = localDevices->next;
-+ }
-+ /* write TwinView ScreenInfo */
-+ if (priv->twinview == TV_ABOVE_BELOW)
-+ {
-+ fprintf(fp, "Screen0 %d %d %d %d\n", priv->tvResolution[0],
-+ priv->tvResolution[1], 0, 0);
-+ fprintf(fp, "Screen1 %d %d %d %d\n", priv->tvResolution[2],
-+ priv->tvResolution[3], 0, priv->tvResolution[1]);
-+ }
-+ else if (priv->twinview == TV_LEFT_RIGHT)
-+ {
-+ fprintf(fp, "Screen0 %d %d %d %d\n", priv->tvResolution[0],
-+ priv->tvResolution[1], 0, 0);
-+ fprintf(fp, "Screen1 %d %d %d %d\n", priv->tvResolution[2],
-+ priv->tvResolution[3], priv->tvResolution[0], 0);
-+ }
-+ /* write other screen setup info */
-+ else
-+ {
-+ for (i = 0; i<screenInfo.numScreens; i++)
-+ {
-+ fprintf(fp, "Screen%d %d %d %d %d\n",
-+ i, screenInfo.screens[i]->width,
-+ screenInfo.screens[i]->height, x, y);
-+ x += screenInfo.screens[i]->width;
-+ }
-+ }
-+ fclose(fp);
-+ }
-+ return(Success);
- }
-
+-}
+-
-/*
- ***************************************************************************
- *
@@ -5543,10 +5855,7 @@
- common->wcmGimp = 1; /* enabled (=1) to support Gimp when Xinerama Enabled in multi-monitor desktop. Needs to be disabled (=0) for Cintiq calibration */
- return local;
-}
-+/*****************************************************************************
-+* xf86WcmDevSwitchMode --
-+*****************************************************************************/
-
+-
-/*
- ***************************************************************************
- *
@@ -5556,18 +5865,14 @@
- */
-static LocalDevicePtr
-xf86WcmAllocateStylus()
-+static int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
- {
+-{
- LocalDevicePtr local = xf86WcmAllocate(XI_STYLUS, STYLUS_ID);
-+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
-+ WacomDevicePtr priv = (WacomDevicePtr)local->private;
-
+-
- if (local)
- local->type_name = "Wacom Stylus";
- return local;
-}
-+ DBG(3, ErrorF("xf86WcmSwitchMode dev=%p mode=%d\n", (void *)dev, mode));
-
+-
-/*
- ***************************************************************************
- *
@@ -5579,23 +5884,12 @@
-xf86WcmAllocateCursor()
-{
- LocalDevicePtr local = xf86WcmAllocate(XI_CURSOR, CURSOR_ID);
-+ if (mode == Absolute)
-+ priv->flags |= ABSOLUTE_FLAG;
-+ else if (mode == Relative)
-+ priv->flags &= ~ABSOLUTE_FLAG;
-+ else
-+ {
-+ DBG(10, ErrorF("xf86WcmSwitchMode dev=%p invalid mode=%d\n",
-+ (void *)dev, mode));
-+ return BadMatch;
-+ }
-
+-
- if (local)
- local->type_name = "Wacom Cursor";
- return local;
-+ return Success;
- }
-
+-}
+-
-/*
- ***************************************************************************
- *
@@ -5612,10 +5906,7 @@
- local->type_name = "Wacom Eraser";
- return local;
-}
-+/*****************************************************************************
-+ * xf86WcmDevChangeControl --
-+ ****************************************************************************/
-
+-
-/*
- * xf86WcmUninit --
- *
@@ -5625,13 +5916,9 @@
-xf86WcmUninit(InputDriverPtr drv,
- LocalDevicePtr local,
- int flags)
-+static int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl* control)
- {
+-{
- WacomDevicePtr priv;
-+ xDeviceResolutionCtl* res = (xDeviceResolutionCtl *)control;
-+ int* r = (int*)(res+1);
-+ int param = r[0], value = r[1];
-
+-
- priv = (WacomDevicePtr) local->private;
-
- DBG(1, ErrorF("xf86WcmUninit\n"));
@@ -5641,38 +5928,11 @@
- /* free pressure curve */
- if (priv->pPressCurve)
- xfree(priv->pPressCurve);
-+ DBG(10, ErrorF("xf86WcmChangeControl firstValuator=%d\n",
-+ res->first_valuator));
-+
-+ if (control->control != DEVICE_RESOLUTION || !res->num_valuators)
-+ return BadMatch;
-
+-
- xfree (priv);
- xf86DeleteInput(local, 0);
-+ r[0] = 1, r[1] = 1;
-+ switch (res->first_valuator)
-+ {
-+ case 0: /* a new write to wcm.$name */
-+ {
-+ return xf86WcmOptionCommandToFile(local);
-+ }
-+ case 1: /* a new write to wacom.dat */
-+ {
-+ return xf86WcmModelToFile(local);
-+ }
-+ case 4: /* JEJ - test */
-+ {
-+ DBG(10,ErrorF("xf86WcmChangeControl: %x,%x\n",
-+ param,value));
-+ return xf86WcmSetParam(local,param,value);
-+ }
-+ default:
-+ DBG(10,ErrorF("xf86WcmChangeControl invalid "
-+ "firstValuator=%d\n",res->first_valuator));
-+ return BadMatch;
-+ }
- }
-
+-}
+-
-/* xf86WcmMatchDevice - locate matching device and merge common structure */
-
-static Bool xf86WcmMatchDevice(LocalDevicePtr pMatch, LocalDevicePtr pLocal)
@@ -5697,11 +5957,7 @@
- }
- return 0;
-}
-+/*****************************************************************************
-+ * xf86WcmDevConvert --
-+ * Convert valuators to X and Y. Only used by core events.
-+ ****************************************************************************/
-
+-
-/*
- * xf86WcmInit --
- *
@@ -5711,9 +5967,7 @@
-xf86WcmInit(InputDriverPtr drv,
- IDevPtr dev,
- int flags)
-+static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num,
-+ int v0, int v1, int v2, int v3, int v4, int v5, int* x, int* y)
- {
+-{
- LocalDevicePtr local = NULL;
- LocalDevicePtr fakeLocal = NULL;
- WacomDevicePtr priv = NULL;
@@ -5753,8 +6007,7 @@
- dev->identifier);
- goto SetupProc_fail;
- }
-+ WacomDevicePtr priv = (WacomDevicePtr) local->private;
-
+-
- if (!local) {
- xfree(fakeLocal);
- return NULL;
@@ -5770,8 +6023,7 @@
-
- /* Serial Device is mandatory */
- common->wcmDevice = xf86FindOptionValue(local->options, "Device");
-+ DBG(6, ErrorF("xf86WcmDevConvert\n"));
-
+-
- if (!common->wcmDevice) {
- xf86Msg (X_ERROR, "%s: No Device specified.\n", dev->identifier);
- goto SetupProc_fail;
@@ -5785,85 +6037,10 @@
- for (; localDevices != NULL; localDevices = localDevices->next)
- {
- if (xf86WcmMatchDevice(localDevices,local))
-+ if (first != 0 || num == 1)
-+ return FALSE;
-+#ifdef PANORAMIX
-+ if (!noPanoramiXExtension && (priv->flags & ABSOLUTE_FLAG) &&
-+ priv->common->wcmGimp && priv->common->wcmMMonitor)
- {
+- {
- common = priv->common;
- break;
-+ int i, totalWidth, leftPadding = 0;
-+ for (i = 0; i < priv->currentScreen; i++)
-+ leftPadding += screenInfo.screens[i]->width;
-+ for (totalWidth = leftPadding; i < priv->numScreen; i++)
-+ totalWidth += screenInfo.screens[i]->width;
-+ v0 -= (priv->bottomX - priv->topX) * leftPadding
-+ / (double)totalWidth + 0.5;
-+ }
-+#endif
-+ if (priv->twinview != TV_NONE && (priv->flags & ABSOLUTE_FLAG))
-+ {
-+ v0 -= priv->topX - priv->tvoffsetX;
-+ v1 -= priv->topY - priv->tvoffsetY;
-+ if (priv->twinview == TV_LEFT_RIGHT)
-+ {
-+ if (v0 > priv->bottomX - priv->tvoffsetX)
-+ {
-+ if (priv->currentScreen == 0)
-+ v0 = priv->bottomX - priv->tvoffsetX;
-+ else
-+ {
-+ v0 -= priv->bottomX - priv->topX - 2*priv->tvoffsetX;
-+ if (v0 > priv->bottomX - priv->tvoffsetX)
-+ v0 = 2*(priv->bottomX - priv->tvoffsetX) - v0;
-+ }
-+ }
-+ if (priv->currentScreen == 1)
-+ {
-+ *x = priv->tvResolution[0] + priv->tvResolution[2]
-+ * v0 / (priv->bottomX - priv->topX - 2*priv->tvoffsetX);
-+ *y = v1 * priv->tvResolution[3] /
-+ (priv->bottomY - priv->topY - 2*priv->tvoffsetY) + 0.5;
-+ }
-+ else
-+ {
-+ *x = priv->tvResolution[0] * v0
-+ / (priv->bottomX - priv->topX - 2*priv->tvoffsetX);
-+ *y = v1 * priv->tvResolution[1] /
-+ (priv->bottomY - priv->topY - 2*priv->tvoffsetY) + 0.5;
-+ }
-+ }
-+ if (priv->twinview == TV_ABOVE_BELOW)
-+ {
-+ if (v1 > priv->bottomY - priv->tvoffsetY)
-+ {
-+ if (priv->currentScreen == 0)
-+ v1 = priv->bottomY - priv->tvoffsetY;
-+ else
-+ {
-+ v1 -= priv->bottomY - priv->topY - 2*priv->tvoffsetY;
-+ if (v1 > priv->bottomY - priv->tvoffsetY)
-+ v1 = 2*(priv->bottomY - priv->tvoffsetY) - v1;
-+ }
-+ }
-+ if (priv->currentScreen == 1)
-+ {
-+ *x = v0 * priv->tvResolution[2] /
-+ (priv->bottomX - priv->topX - 2*priv->tvoffsetX) + 0.5;
-+ *y = priv->tvResolution[1] +
-+ priv->tvResolution[3] * v1 /
-+ (priv->bottomY - priv->topY - 2*priv->tvoffsetY);
-+ }
-+ else
-+ {
-+ *x = v0 * priv->tvResolution[0] /
-+ (priv->bottomX - priv->topX - 2*priv->tvoffsetX) + 0.5;
-+ *y = priv->tvResolution[1] * v1 /
-+ (priv->bottomY - priv->topY - 2*priv->tvoffsetY);
-+ }
-+ }
- }
+- }
- }
-
- /* Process the common options. */
@@ -5896,7 +6073,7 @@
- */
- if (priv->flags & CURSOR_ID)
- priv->flags &= ~ABSOLUTE_FLAG;
- else
+- else
- priv->flags |= ABSOLUTE_FLAG;
- }
- xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name,
@@ -5920,10 +6097,7 @@
- common->wcmRotate=ROTATE_CW;
- } else if (xf86NameCmp(s, "CCW") ==0) {
- common->wcmRotate=ROTATE_CCW;
-+ {
-+ *x = v0 * priv->factorX + 0.5;
-+ *y = v1 * priv->factorY + 0.5;
- }
+- }
- }
-
- common->wcmSuppress = xf86SetIntOption(local->options, "Suppress", common->wcmSuppress);
@@ -5956,7 +6130,7 @@
- ErrorF("The USB version of the driver isn't available for your platform\n");
-#endif
- }
-
+-
- /* pressure curve takes control points x1,y1,x2,y2
- * values in range from 0..100.
- * Linear curve is 0,0,100,100
@@ -5975,11 +6149,7 @@
- xf86Msg(X_CONFIG, "WACOM: PressCurve %d,%d %d,%d\n", a,b,c,d);
- }
- }
-+ DBG(6, ErrorF("Wacom converted v0=%d v1=%d to x=%d y=%d\n",
-+ v0, v1, *x, *y));
-+ return TRUE;
-+}
-
+-
- /* Config Monitors' resoluiton in TwinView setup.
- * The value is in the form of "1024x768,1280x1024"
- * for a desktop of monitor 1 at 1024x768 and
@@ -5999,11 +6169,7 @@
- xf86Msg(X_CONFIG, "WACOM: TVResolution %d,%d %d,%d\n", a,b,c,d);
- }
- }
-+/*****************************************************************************
-+ * xf86WcmDevReverseConvert --
-+ * Convert X and Y to valuators. Only used by core events.
-+ ****************************************************************************/
-
+-
- priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", -1);
- if (priv->screen_no != -1) {
- xf86Msg(X_CONFIG, "%s: attached screen number %d\n", dev->identifier,
@@ -6084,18 +6250,7 @@
- oldButton = priv->button[i];
- priv->button[i] = xf86SetIntOption(local->options, b, priv->button[i]);
- if (oldButton != priv->button[i])
-+static Bool xf86WcmDevReverseConvert(LocalDevicePtr local, int x, int y,
-+ int* valuators)
-+{
-+ WacomDevicePtr priv = (WacomDevicePtr) local->private;
-+
-+ DBG(6, ErrorF("xf86WcmDevReverseConvert\n"));
-+ valuators[0] = x / priv->factorX + 0.5;
-+ valuators[1] = y / priv->factorY + 0.5;
-+#ifdef PANORAMIX
-+ if (!noPanoramiXExtension && (priv->flags & ABSOLUTE_FLAG) &&
-+ priv->common->wcmGimp && priv->common->wcmMMonitor)
- {
+- {
- xf86Msg(X_CONFIG, "%s: button%d assigned to %d\n",
- dev->identifier, i+1, priv->button[i]);
- }
@@ -6165,14 +6320,7 @@
- priv->tvResolution[1] = screenInfo.screens[0]->height/2;
- priv->tvResolution[2] = priv->tvResolution[0];
- priv->tvResolution[3] = priv->tvResolution[1];
-+ int i, totalWidth, leftPadding = 0;
-+ for (i = 0; i < priv->currentScreen; i++)
-+ leftPadding += screenInfo.screens[i]->width;
-+ for (totalWidth = leftPadding; i < priv->numScreen; i++)
-+ totalWidth += screenInfo.screens[i]->width;
-+ valuators[0] += (priv->bottomX - priv->topX)
-+ * leftPadding / (double)totalWidth + 0.5;
- }
+- }
- } else if (s) {
- xf86Msg(X_ERROR, "%s: invalid Twinview (should be none, vertical or horizontal). Using none.\n",
- dev->identifier);
@@ -6199,10 +6347,7 @@
- return NULL;
-}
-
--#ifdef XFree86LOADER
--static
- #endif
--InputDriverRec WACOM = {
+-_X_EXPORT InputDriverRec WACOM = {
- 1, /* driver version */
- "wacom", /* driver name */
- NULL, /* identify */
@@ -6211,54 +6356,7 @@
- NULL, /* module */
- 0 /* ref count */
-};
-+ if (priv->twinview != TV_NONE && (priv->flags & ABSOLUTE_FLAG))
-+ {
-+ if (priv->twinview == TV_LEFT_RIGHT)
-+ {
-+ if (x > priv->tvResolution[0])
-+ x -= priv->tvResolution[0];
-+ if (priv->currentScreen == 1)
-+ {
-+ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX)
-+ / priv->tvResolution[2] + (priv->bottomX - priv->topX -
-+ 2*priv->tvoffsetX) +0.5;
-+ valuators[1] = y * (priv->bottomY - priv->topY - 2*priv->tvoffsetY) /
-+ priv->tvResolution[3] + 0.5;
-+ }
-+ else
-+ {
-+ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX)
-+ / priv->tvResolution[0] + 0.5;
-+ valuators[1] = y * (priv->bottomY - priv->topY - 2*priv->tvoffsetY) /
-+ priv->tvResolution[1] + 0.5;
-+ }
-+ }
-+ if (priv->twinview == TV_ABOVE_BELOW)
-+ {
-+ if (y > priv->tvResolution[1])
-+ y -= priv->tvResolution[1];
-+ if (priv->currentScreen == 1)
-+ {
-+ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX) /
-+ priv->tvResolution[2] + 0.5;
-+ valuators[1] = y *(priv->bottomY - priv->topY - 2*priv->tvoffsetY)
-+ / priv->tvResolution[3] +
-+ priv->bottomY - priv->topY - 2*priv->tvoffsetY + 0.5;
-+ }
-+ else
-+ {
-+ valuators[0] = x * (priv->bottomX - priv->topX - 2*priv->tvoffsetX) /
-+ priv->tvResolution[0] + 0.5;
-+ valuators[1] = y *(priv->bottomY - priv->topY - 2*priv->tvoffsetY)
-+ / priv->tvResolution[1] + 0.5;
-+ }
-+ }
-+ valuators[0] += priv->topX + priv->tvoffsetX;
-+ valuators[1] += priv->topY + priv->tvoffsetY;
-+ }
-+ DBG(6, ErrorF("Wacom converted x=%d y=%d to v0=%d v1=%d\n", x, y,
-+ valuators[0], valuators[1]));
-
+-
-/*
- ***************************************************************************
- *
@@ -6276,9 +6374,8 @@
-xf86WcmUnplug(pointer p)
-{
- DBG(1, ErrorF("xf86WcmUnplug\n"));
-+ return TRUE;
- }
-
+-}
+-
-/*
- * xf86WcmPlug --
- *
@@ -6299,14 +6396,9 @@
-
- return module;
-}
-+/*****************************************************************************
-+ * xf86WcmInitDevice --
-+ * Open and initialize the tablet
-+ ****************************************************************************/
-
+-
-static XF86ModuleVersionInfo xf86WcmVersionRec =
-+static Bool xf86WcmInitDevice(LocalDevicePtr local)
- {
+-{
- "wacom",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
@@ -6319,22 +6411,15 @@
- {0, 0, 0, 0} /* signature, to be patched into the file by */
- /* a tool */
-};
-+ WacomCommonPtr common = ((WacomDevicePtr)local->private)->common;
-+ int loop;
-
--XF86ModuleData wacomModuleData = {&xf86WcmVersionRec,
-- xf86WcmPlug,
-- xf86WcmUnplug};
-+ DBG(1,ErrorF("xf86WcmInitDevice: "));
-+ if (common->wcmInitialized)
-+ {
-+ DBG(1,ErrorF("already initialized\n"));
-+ return TRUE;
-+ }
-
+-
+-_X_EXPORT XF86ModuleData wacomModuleData = {
+- &xf86WcmVersionRec,
+- xf86WcmPlug,
+- xf86WcmUnplug
+-};
+-
-#endif /* XFree86LOADER */
-+ DBG(1,ErrorF("initializing\n"));
-
+-
-/*
- * Local variables:
- * change-log-default-name: "~/xinput.log"
@@ -6342,31 +6427,13 @@
- * End:
- */
-/* end of xf86Wacom.c */
-+ /* attempt to open the device */
-+ if ((xf86WcmOpen(local) != Success) || (local->fd < 0))
-+ {
-+ DBG(1,ErrorF("Failed to open device (fd=%d)\n",local->fd));
-+ if (local->fd >= 0)
-+ {
-+ DBG(1,ErrorF("Closing device\n"));
-+ SYSCALL(xf86WcmClose(local->fd));
-+ }
-+ local->fd = -1;
-+ return FALSE;
-+ }
-
-+ /* on success, mark all other local devices as open and initialized */
-+ common->wcmInitialized = TRUE;
-
-+ DBG(1,ErrorF("Marking all devices open\n"));
-+ /* report the file descriptor to all devices */
-+ for (loop=0; loop<common->wcmNumDevices; loop++)
-+ common->wcmDevices[loop]->fd = local->fd;
-
-+ return TRUE;
-+}
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h 2004-11-04 10:45:00.967082504 +0100
+-
+-
+-
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.h 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,517 @@
+/*
+ * Copyright 1995-2004 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -6885,8 +6952,10 @@
+
+/****************************************************************************/
+#endif /* __XF86WACOM_H */
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/Xwacom.h 2004-11-04 10:45:00.966082656 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/Xwacom.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/Xwacom.h 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ *
@@ -6936,8 +7005,10 @@
+#define XWACOM_PARAM_TPCBUTTON 104
+
+#endif /* __XF86_XWACOM_H */
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c 2004-11-04 10:59:06.566531848 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCommon.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,1084 @@
+/*
+ * Copyright 1995-2004 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -8023,8 +8094,10 @@
+ FILTER_PRESSURE_RES;
+ }
+}
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCompat.c 2004-11-04 10:59:06.566531848 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmCompat.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmCompat.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright 1995-2004 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -8072,8 +8145,10 @@
+ ErrorF("Wacom select error : %s\n", strerror(errno));
+ return 0;
+}
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmConfig.c 2004-11-04 10:59:06.567531696 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmConfig.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmConfig.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,742 @@
+/*
+ * Copyright 1995-2004 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -8817,8 +8892,10 @@
+};
+
+#endif /* XFree86LOADER */
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.c 2004-11-04 10:59:06.567531696 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,414 @@
+/*
+ * Copyright 1995-2003 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -9234,8 +9311,10 @@
+}
+
+
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.h 2004-11-04 10:59:06.567531696 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmFilter.h 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1995-2003 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -9278,8 +9357,10 @@
+
+/****************************************************************************/
+#endif /* __XF86_WCMFILTER_H */
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmISDV4.c 2004-11-04 10:59:06.567531696 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmISDV4.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmISDV4.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,288 @@
+/*
+ * Copyright 1995-2003 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -9569,8 +9650,10 @@
+ return common->wcmPktLength;
+}
+
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.c 2004-11-04 10:59:06.567531696 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,1321 @@
+/*
+ * Copyright 1995-2004 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -10893,8 +10976,10 @@
+ else return 0;
+}
+
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.h 2004-11-04 10:59:06.567531696 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmSerial.h 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,70 @@
+/*
+ * Copyright 1995-2003 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -10966,8 +11051,10 @@
+
+#endif /* __XF86_WCMSERIAL_H */
+
---- /dev/null 2004-11-04 07:11:39.180181192 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmUSB.c 2004-11-04 10:59:06.568531544 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/wcmUSB.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ xc/programs/Xserver/hw/xfree86/input/wacom/wcmUSB.c 2005-07-23 17:47:21.000000000 -0400
@@ -0,0 +1,603 @@
+/*
+ * Copyright 1995-2003 by Frederic Lepied, France. <Lepied@XFree86.org>
@@ -11572,8 +11659,10 @@
+}
+
+#endif /* LINUX_INPUT */
---- xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile.orig 2004-11-04 11:00:20.027364104 +0100
-+++ xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile 2004-11-04 11:02:01.818889440 +0100
+Index: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile
+===================================================================
+--- xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile.orig 2005-03-07 14:27:29.000000000 -0500
++++ xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile 2005-07-23 17:47:21.000000000 -0400
@@ -7,8 +7,8 @@
DEFINES = -DLINUX_INPUT
#endif
Reply to: