|
|
54d94e |
From d958ab79d21b57141415650daac88f9369a1c861 Mon Sep 17 00:00:00 2001
|
|
|
54d94e |
From: Jason Gerecke <killertofu@gmail.com>
|
|
|
54d94e |
Date: Wed, 31 May 2017 10:57:12 +1000
|
|
|
54d94e |
Subject: [PATCH] Introduce "Pressure2K" config option for incompatible
|
|
|
54d94e |
software
|
|
|
54d94e |
|
|
|
54d94e |
It appears that some software may not be entirely compatible with the
|
|
|
54d94e |
expanded 65K pressure level range that was introduced in version 0.34.0.
|
|
|
54d94e |
Although our driver advertises the larger range in XI2 (and toolkits
|
|
|
54d94e |
like GTK+2/3 and Qt3/4/5 make use of it), there have been reports of
|
|
|
54d94e |
other software (e.g. The Foundry's "NUKE") misbehaving.
|
|
|
54d94e |
|
|
|
54d94e |
As a workaround, this patch introduces a new boolean config option named
|
|
|
54d94e |
"Pressure2K". If enabled, it causes the driver to revert to its prior
|
|
|
54d94e |
behavior of using a pressure range of 0-2047. This option is disabled by
|
|
|
54d94e |
default, but can be turned on by adding the following configuration
|
|
|
54d94e |
snippet to a new file in the /etc/X11/xorg.conf.d directory:
|
|
|
54d94e |
|
|
|
54d94e |
Section "InputClass"
|
|
|
54d94e |
Identifier "Wacom pressure compatibility"
|
|
|
54d94e |
MatchDriver "wacom"
|
|
|
54d94e |
Option "Pressure2K" "true"
|
|
|
54d94e |
EndSection
|
|
|
54d94e |
|
|
|
54d94e |
Ref: https://sourceforge.net/p/linuxwacom/mailman/message/35857403/
|
|
|
54d94e |
Ref: 3e56ce4429 (Increase full-scale pressure range from 0..2047 to 0..65535)
|
|
|
54d94e |
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
|
|
|
54d94e |
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
54d94e |
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
54d94e |
---
|
|
|
54d94e |
man/wacom.man | 21 +++++++++++++++++++++
|
|
|
54d94e |
src/wcmCommon.c | 16 ++++++++--------
|
|
|
54d94e |
src/wcmConfig.c | 1 +
|
|
|
54d94e |
src/wcmFilter.c | 2 +-
|
|
|
54d94e |
src/wcmValidateDevice.c | 5 +++++
|
|
|
54d94e |
src/wcmXCommand.c | 22 ++++++++++++----------
|
|
|
54d94e |
src/xf86Wacom.c | 2 +-
|
|
|
54d94e |
src/xf86WacomDefs.h | 5 +++--
|
|
|
54d94e |
8 files changed, 52 insertions(+), 22 deletions(-)
|
|
|
54d94e |
|
|
|
54d94e |
diff --git a/man/wacom.man b/man/wacom.man
|
|
|
54d94e |
index cd33438..3693c94 100644
|
|
|
54d94e |
--- a/man/wacom.man
|
|
|
54d94e |
+++ b/man/wacom.man
|
|
|
54d94e |
@@ -185,6 +185,14 @@ slightly raised curve (softer) might be "0,5,95,100".
|
|
|
54d94e |
The pressure curve is only applicable to devices of type stylus or eraser,
|
|
|
54d94e |
other devices do not honor this setting.
|
|
|
54d94e |
.TP 4
|
|
|
54d94e |
+.B Option \fI"Pressure2K"\fP \fI"bool"\fP
|
|
|
54d94e |
+reduces the pressure range to the range of 0 to 2048 for backwards
|
|
|
54d94e |
+compatibility with applications that have this range hardcoded.
|
|
|
54d94e |
+See section
|
|
|
54d94e |
+.B BUGS.
|
|
|
54d94e |
+This option should not be used unless the user runs one or more
|
|
|
54d94e |
+applications that rely on a hardcoded pressure range.
|
|
|
54d94e |
+.TP 4
|
|
|
54d94e |
.B Option \fI"DebugLevel"\fP \fI"number"\fP
|
|
|
54d94e |
sets the level of debugging info for tool-specific messages. There are 12
|
|
|
54d94e |
levels, specified by the integers between 1 and 12. All debug messages with
|
|
|
54d94e |
@@ -303,6 +311,19 @@ two separated fingers side by side, bring together i.e. pinch.
|
|
|
54d94e |
\fBZoom out:\fR
|
|
|
54d94e |
two fingers side by side, spread. Not all applications support zoom.
|
|
|
54d94e |
.PP
|
|
|
54d94e |
+.SH "BUGS"
|
|
|
54d94e |
+.SS "Pressure range increase leads to unexpected behavior"
|
|
|
54d94e |
+In version 0.34, the driver's pressure range increased from
|
|
|
54d94e |
+2048 steps to 65536 steps. The pressure axis range is advertised through the
|
|
|
54d94e |
+X Input Protocol but some applications have the previous pressure range
|
|
|
54d94e |
+hardcoded and cannot handle pressure values above 2048. This is an
|
|
|
54d94e |
+application bug but for backwards-compatibility with such applications, this
|
|
|
54d94e |
+driver provides the
|
|
|
54d94e |
+.B Pressure2K
|
|
|
54d94e |
+option to reduce the range to 2048 steps. Note that this setting applies to
|
|
|
54d94e |
+the device. Once applied, all applications will see the reduced pressure
|
|
|
54d94e |
+range. It is not possible to provide this setting on a per-application
|
|
|
54d94e |
+basis.
|
|
|
54d94e |
.SH "SEE ALSO"
|
|
|
54d94e |
__xservername__(__appmansuffix__), xorg.conf(__filemansuffix__),
|
|
|
54d94e |
xorg.conf.d(__filemansuffix__), X(__miscmansuffix__)
|
|
|
54d94e |
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
|
|
|
54d94e |
index f6cfd3d..dc6ecbd 100644
|
|
|
54d94e |
--- a/src/wcmCommon.c
|
|
|
54d94e |
+++ b/src/wcmCommon.c
|
|
|
54d94e |
@@ -1056,7 +1056,7 @@ rebasePressure(const WacomDevicePtr priv, const WacomDeviceState *ds)
|
|
|
54d94e |
|
|
|
54d94e |
/**
|
|
|
54d94e |
* Instead of reporting the raw pressure, we normalize
|
|
|
54d94e |
- * the pressure from 0 to FILTER_PRESSURE_RES. This is
|
|
|
54d94e |
+ * the pressure from 0 to maxCurve. This is
|
|
|
54d94e |
* mainly to deal with the case where heavily used
|
|
|
54d94e |
* stylus may have a "pre-loaded" initial pressure. To
|
|
|
54d94e |
* do so, we keep the in-prox pressure and subtract it
|
|
|
54d94e |
@@ -1081,14 +1081,14 @@ normalizePressure(const WacomDevicePtr priv, const int raw_pressure)
|
|
|
54d94e |
p -= priv->minPressure;
|
|
|
54d94e |
range_left -= priv->minPressure;
|
|
|
54d94e |
}
|
|
|
54d94e |
- /* normalize pressure to 0..FILTER_PRESSURE_RES */
|
|
|
54d94e |
+ /* normalize pressure to 0..maxCurve */
|
|
|
54d94e |
if (range_left >= 1)
|
|
|
54d94e |
pressure = xf86ScaleAxis(p,
|
|
|
54d94e |
- FILTER_PRESSURE_RES, 0,
|
|
|
54d94e |
+ priv->maxCurve, 0,
|
|
|
54d94e |
range_left,
|
|
|
54d94e |
0);
|
|
|
54d94e |
else
|
|
|
54d94e |
- pressure = FILTER_PRESSURE_RES;
|
|
|
54d94e |
+ pressure = priv->maxCurve;
|
|
|
54d94e |
|
|
|
54d94e |
return (int)pressure;
|
|
|
54d94e |
}
|
|
|
54d94e |
@@ -1117,8 +1117,8 @@ setPressureButton(const WacomDevicePtr priv, int buttons, const int pressure)
|
|
|
54d94e |
{
|
|
|
54d94e |
/* don't set it off if it is within the tolerance
|
|
|
54d94e |
and threshold is larger than the tolerance */
|
|
|
54d94e |
- if ((common->wcmThreshold > THRESHOLD_TOLERANCE) &&
|
|
|
54d94e |
- (pressure > common->wcmThreshold - THRESHOLD_TOLERANCE))
|
|
|
54d94e |
+ if ((common->wcmThreshold > (priv->maxCurve * THRESHOLD_TOLERANCE)) &&
|
|
|
54d94e |
+ (pressure > common->wcmThreshold - (priv->maxCurve * THRESHOLD_TOLERANCE)))
|
|
|
54d94e |
buttons |= button;
|
|
|
54d94e |
}
|
|
|
54d94e |
}
|
|
|
54d94e |
@@ -1350,7 +1350,7 @@ int wcmInitTablet(InputInfoPtr pInfo, const char* id, float version)
|
|
|
54d94e |
if (common->wcmThreshold <= 0 && IsPen(priv))
|
|
|
54d94e |
{
|
|
|
54d94e |
/* Threshold for counting pressure as a button */
|
|
|
54d94e |
- common->wcmThreshold = DEFAULT_THRESHOLD;
|
|
|
54d94e |
+ common->wcmThreshold = priv->maxCurve * DEFAULT_THRESHOLD;
|
|
|
54d94e |
|
|
|
54d94e |
xf86Msg(X_PROBED, "%s: using pressure threshold of %d for button 1\n",
|
|
|
54d94e |
pInfo->name, common->wcmThreshold);
|
|
|
54d94e |
@@ -1401,7 +1401,7 @@ static int applyPressureCurve(WacomDevicePtr pDev, const WacomDeviceStatePtr pSt
|
|
|
54d94e |
/* clip the pressure */
|
|
|
54d94e |
int p = max(0, pState->pressure);
|
|
|
54d94e |
|
|
|
54d94e |
- p = min(FILTER_PRESSURE_RES, p);
|
|
|
54d94e |
+ p = min(pDev->maxCurve, p);
|
|
|
54d94e |
|
|
|
54d94e |
/* apply pressure curve function */
|
|
|
54d94e |
if (pDev->pPressCurve == NULL)
|
|
|
54d94e |
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
|
|
|
54d94e |
index 0924c43..6b269bb 100644
|
|
|
54d94e |
--- a/src/wcmConfig.c
|
|
|
54d94e |
+++ b/src/wcmConfig.c
|
|
|
54d94e |
@@ -63,6 +63,7 @@ static int wcmAllocate(InputInfoPtr pInfo)
|
|
|
54d94e |
priv->pInfo = pInfo;
|
|
|
54d94e |
priv->common = common; /* common info pointer */
|
|
|
54d94e |
priv->oldCursorHwProx = 0; /* previous cursor hardware proximity */
|
|
|
54d94e |
+ priv->maxCurve = FILTER_PRESSURE_RES;
|
|
|
54d94e |
priv->nPressCtrl [0] = 0; /* pressure curve x0 */
|
|
|
54d94e |
priv->nPressCtrl [1] = 0; /* pressure curve y0 */
|
|
|
54d94e |
priv->nPressCtrl [2] = 100; /* pressure curve x1 */
|
|
|
54d94e |
diff --git a/src/wcmFilter.c b/src/wcmFilter.c
|
|
|
54d94e |
index aca5cd9..e7ddb37 100644
|
|
|
54d94e |
--- a/src/wcmFilter.c
|
|
|
54d94e |
+++ b/src/wcmFilter.c
|
|
|
54d94e |
@@ -78,7 +78,7 @@ void wcmSetPressureCurve(WacomDevicePtr pDev, int x0, int y0,
|
|
|
54d94e |
|
|
|
54d94e |
if (pDev->pPressCurve)
|
|
|
54d94e |
filterCurveToLine(pDev->pPressCurve,
|
|
|
54d94e |
- FILTER_PRESSURE_RES,
|
|
|
54d94e |
+ pDev->maxCurve,
|
|
|
54d94e |
0.0, 0.0, /* bottom left */
|
|
|
54d94e |
x0/100.0, y0/100.0, /* control point 1 */
|
|
|
54d94e |
x1/100.0, y1/100.0, /* control point 2 */
|
|
|
54d94e |
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
|
|
|
54d94e |
index d2a7723..0da5076 100644
|
|
|
54d94e |
--- a/src/wcmValidateDevice.c
|
|
|
54d94e |
+++ b/src/wcmValidateDevice.c
|
|
|
54d94e |
@@ -875,6 +875,11 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary,
|
|
|
54d94e |
}
|
|
|
54d94e |
free(s);
|
|
|
54d94e |
|
|
|
54d94e |
+ if (xf86SetBoolOption(pInfo->options, "Pressure2K", 0)) {
|
|
|
54d94e |
+ xf86Msg(X_CONFIG, "%s: Using 2K pressure levels\n", pInfo->name);
|
|
|
54d94e |
+ priv->maxCurve = 2048;
|
|
|
54d94e |
+ }
|
|
|
54d94e |
+
|
|
|
54d94e |
/*Serials of tools we want hotpluged*/
|
|
|
54d94e |
if (wcmParseSerials (pInfo) != 0)
|
|
|
54d94e |
goto error;
|
|
|
54d94e |
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
|
|
|
54d94e |
index 0e1d657..e18fb8f 100644
|
|
|
54d94e |
--- a/src/wcmXCommand.c
|
|
|
54d94e |
+++ b/src/wcmXCommand.c
|
|
|
54d94e |
@@ -106,21 +106,23 @@ static Atom prop_debuglevels;
|
|
|
54d94e |
/**
|
|
|
54d94e |
* Calculate a user-visible pressure level from a driver-internal pressure
|
|
|
54d94e |
* level. Pressure settings exposed to the user assume a range of 0-2047
|
|
|
54d94e |
- * while the driver scales everything to a range of 0-FILTER_PRESSURE_RES.
|
|
|
54d94e |
+ * while the driver scales everything to a range of 0-maxCurve.
|
|
|
54d94e |
*/
|
|
|
54d94e |
-static inline int wcmInternalToUserPressure(int pressure)
|
|
|
54d94e |
+static inline int wcmInternalToUserPressure(InputInfoPtr pInfo, int pressure)
|
|
|
54d94e |
{
|
|
|
54d94e |
- return pressure / (FILTER_PRESSURE_RES / 2048);
|
|
|
54d94e |
+ WacomDevicePtr priv = (WacomDevicePtr) pInfo->private;
|
|
|
54d94e |
+ return pressure / (priv->maxCurve / 2048);
|
|
|
54d94e |
}
|
|
|
54d94e |
|
|
|
54d94e |
/**
|
|
|
54d94e |
* Calculate a driver-internal pressure level from a user-visible pressure
|
|
|
54d94e |
* level. Pressure settings exposed to the user assume a range of 0-2047
|
|
|
54d94e |
- * while the driver scales everything to a range of 0-FILTER_PRESSURE_RES.
|
|
|
54d94e |
+ * while the driver scales everything to a range of 0-maxCurve.
|
|
|
54d94e |
*/
|
|
|
54d94e |
-static inline int wcmUserToInternalPressure(int pressure)
|
|
|
54d94e |
+static inline int wcmUserToInternalPressure(InputInfoPtr pInfo, int pressure)
|
|
|
54d94e |
{
|
|
|
54d94e |
- return pressure * (FILTER_PRESSURE_RES / 2048);
|
|
|
54d94e |
+ WacomDevicePtr priv = (WacomDevicePtr) pInfo->private;
|
|
|
54d94e |
+ return pressure * (priv->maxCurve / 2048);
|
|
|
54d94e |
}
|
|
|
54d94e |
|
|
|
54d94e |
/**
|
|
|
54d94e |
@@ -276,7 +278,7 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
|
|
|
54d94e |
}
|
|
|
54d94e |
|
|
|
54d94e |
values[0] = (!common->wcmMaxZ) ? 0 : common->wcmThreshold;
|
|
|
54d94e |
- values[0] = wcmInternalToUserPressure(values[0]);
|
|
|
54d94e |
+ values[0] = wcmInternalToUserPressure(pInfo, values[0]);
|
|
|
54d94e |
prop_threshold = InitWcmAtom(pInfo->dev, WACOM_PROP_PRESSURE_THRESHOLD, XA_INTEGER, 32, 1, values);
|
|
|
54d94e |
|
|
|
54d94e |
values[0] = common->wcmSuppress;
|
|
|
54d94e |
@@ -846,7 +848,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
|
|
54d94e |
common->wcmCursorProxoutDist = value;
|
|
|
54d94e |
} else if (property == prop_threshold)
|
|
|
54d94e |
{
|
|
|
54d94e |
- const INT32 MAXIMUM = wcmInternalToUserPressure(FILTER_PRESSURE_RES);
|
|
|
54d94e |
+ const INT32 MAXIMUM = wcmInternalToUserPressure(pInfo, priv->maxCurve);
|
|
|
54d94e |
INT32 value;
|
|
|
54d94e |
|
|
|
54d94e |
if (prop->size != 1 || prop->format != 32)
|
|
|
54d94e |
@@ -855,11 +857,11 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
|
|
54d94e |
value = *(INT32*)prop->data;
|
|
|
54d94e |
|
|
|
54d94e |
if (value == -1)
|
|
|
54d94e |
- value = DEFAULT_THRESHOLD;
|
|
|
54d94e |
+ value = priv->maxCurve * DEFAULT_THRESHOLD;
|
|
|
54d94e |
else if ((value < 1) || (value > MAXIMUM))
|
|
|
54d94e |
return BadValue;
|
|
|
54d94e |
else
|
|
|
54d94e |
- value = wcmUserToInternalPressure(value);
|
|
|
54d94e |
+ value = wcmUserToInternalPressure(pInfo, value);
|
|
|
54d94e |
|
|
|
54d94e |
if (!checkonly)
|
|
|
54d94e |
common->wcmThreshold = value;
|
|
|
54d94e |
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
|
|
|
54d94e |
index a511fd2..738690f 100644
|
|
|
54d94e |
--- a/src/xf86Wacom.c
|
|
|
54d94e |
+++ b/src/xf86Wacom.c
|
|
|
54d94e |
@@ -200,7 +200,7 @@ static int wcmInitAxes(DeviceIntPtr pWcm)
|
|
|
54d94e |
if (!IsPad(priv))
|
|
|
54d94e |
{
|
|
|
54d94e |
label = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
|
|
|
54d94e |
- max = FILTER_PRESSURE_RES;
|
|
|
54d94e |
+ max = priv->maxCurve;
|
|
|
54d94e |
}
|
|
|
54d94e |
|
|
|
54d94e |
wcmInitAxis(pInfo->dev, index, label, min, max, res, min_res, max_res, mode);
|
|
|
54d94e |
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
|
|
|
54d94e |
index b10a114..ec34211 100644
|
|
|
54d94e |
--- a/src/xf86WacomDefs.h
|
|
|
54d94e |
+++ b/src/xf86WacomDefs.h
|
|
|
54d94e |
@@ -182,8 +182,8 @@ struct _WacomModel
|
|
|
54d94e |
|
|
|
54d94e |
#define FILTER_PRESSURE_RES 65536 /* maximum points in pressure curve */
|
|
|
54d94e |
/* Tested result for setting the pressure threshold to a reasonable value */
|
|
|
54d94e |
-#define THRESHOLD_TOLERANCE (FILTER_PRESSURE_RES / 125)
|
|
|
54d94e |
-#define DEFAULT_THRESHOLD (FILTER_PRESSURE_RES / 75)
|
|
|
54d94e |
+#define THRESHOLD_TOLERANCE (0.008f)
|
|
|
54d94e |
+#define DEFAULT_THRESHOLD (0.013f)
|
|
|
54d94e |
|
|
|
54d94e |
#define WCM_MAX_BUTTONS 32 /* maximum number of tablet buttons */
|
|
|
54d94e |
#define WCM_MAX_X11BUTTON 127 /* maximum button number X11 can handle */
|
|
|
54d94e |
@@ -285,6 +285,7 @@ struct _WacomDeviceRec
|
|
|
54d94e |
struct _WacomDeviceState oldState; /* previous state information */
|
|
|
54d94e |
int oldCursorHwProx; /* previous cursor hardware proximity */
|
|
|
54d94e |
|
|
|
54d94e |
+ int maxCurve; /* maximum pressure curve value */
|
|
|
54d94e |
int *pPressCurve; /* pressure curve */
|
|
|
54d94e |
int nPressCtrl[4]; /* control points for curve */
|
|
|
54d94e |
int minPressure; /* the minimum pressure a pen may hold */
|
|
|
54d94e |
--
|
|
|
54d94e |
2.13.0
|
|
|
54d94e |
|