Hello community, here is the log from the commit of package xf86-input-wacom for openSUSE:Factory checked in at 2014-02-15 17:26:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xf86-input-wacom (Old) and /work/SRC/openSUSE:Factory/.xf86-input-wacom.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xf86-input-wacom" Changes: -------- --- /work/SRC/openSUSE:Factory/xf86-input-wacom/xf86-input-wacom.changes 2014-01-08 20:36:16.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.xf86-input-wacom.new/xf86-input-wacom.changes 2014-02-15 17:26:16.000000000 +0100 @@ -1,0 +2,23 @@ +Tue Feb 11 19:08:13 UTC 2014 - [email protected] + +- u_07-Add-option-to-enable-logging.patch: + updated patch. + +------------------------------------------------------------------- +Tue Feb 11 17:40:12 UTC 2014 - [email protected] + +- Add patches to improve logging: + * u_01-Fix-message-if-the-detected-pressure-falls-below-the-initially-detected-pressure.patch + * u_02-Log-when-the-pen-device-appears-to-be-too-worn-out.patch + * u_03-Add-more-detailed-messaging-in-code-that-handles-abnormal-situations.patch + * u_05-Improve-usbInitToolType-tool-type-detection.patch + * u_07-Add-option-to-enable-logging.patch + * u_08-Log-PROXIMITY-events.patch + * u_09-Log-PRESSURE-events.patch + * u_10-Log-BUTTON-events.patch +- Fix division-by-zero error message: + u_04-Avoid-division-by-zero-in-xf86ScaleAxis.patch +- Allow user to disable pressure recalibration + u_06-Add-an-option-to-disable-pressure-recalibration.patch + +------------------------------------------------------------------- New: ---- u_01-Fix-message-if-the-detected-pressure-falls-below-the-initially-detected-pressure.patch u_02-Log-when-the-pen-device-appears-to-be-too-worn-out.patch u_03-Add-more-detailed-messaging-in-code-that-handles-abnormal-situations.patch u_04-Avoid-division-by-zero-in-xf86ScaleAxis.patch u_05-Improve-usbInitToolType-tool-type-detection.patch u_06-Add-an-option-to-disable-pressure-recalibration.patch u_07-Add-option-to-enable-logging.patch u_08-Log-PROXIMITY-events.patch u_09-Log-PRESSURE-events.patch u_10-Log-BUTTON-events.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xf86-input-wacom.spec ++++++ --- /var/tmp/diff_new_pack.bevAoc/_old 2014-02-15 17:26:17.000000000 +0100 +++ /var/tmp/diff_new_pack.bevAoc/_new 2014-02-15 17:26:17.000000000 +0100 @@ -32,6 +32,16 @@ Source0: http://downloads.sourceforge.net/project/linuxwacom/xf86-input-wacom/%{name}-%{version}.tar.bz2 Source1: 65-xorg-wacom.rules Source2: [email protected] +Patch1: u_01-Fix-message-if-the-detected-pressure-falls-below-the-initially-detected-pressure.patch +Patch2: u_02-Log-when-the-pen-device-appears-to-be-too-worn-out.patch +Patch3: u_03-Add-more-detailed-messaging-in-code-that-handles-abnormal-situations.patch +Patch4: u_04-Avoid-division-by-zero-in-xf86ScaleAxis.patch +Patch5: u_05-Improve-usbInitToolType-tool-type-detection.patch +Patch6: u_06-Add-an-option-to-disable-pressure-recalibration.patch +Patch7: u_07-Add-option-to-enable-logging.patch +Patch8: u_08-Log-PROXIMITY-events.patch +Patch9: u_09-Log-PRESSURE-events.patch +Patch10: u_10-Log-BUTTON-events.patch BuildRequires: pkg-config %if %{suse_version} > 1230 BuildRequires: systemd-rpm-macros @@ -39,6 +49,8 @@ BuildRequires: systemd %endif # For directory ownership +BuildRequires: libtool +BuildRequires: pkgconfig BuildRequires: udev BuildRequires: pkgconfig(inputproto) BuildRequires: pkgconfig(kbproto) @@ -80,8 +92,19 @@ %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 %build +autoreconf -fi %configure --with-xorg-conf-dir=/etc/X11/xorg.conf.d make %{?_smp_mflags} ++++++ u_01-Fix-message-if-the-detected-pressure-falls-below-the-initially-detected-pressure.patch ++++++ From: Egbert Eich <[email protected]> Date: Fri Feb 7 19:36:28 2014 +0100 Subject: [PATCH 1/10]Fix message if the detected pressure falls below the initially detected pressure Patch-Mainline: to be upstreamed Git-commit: 8aa869e7c65761afc5fe7ef90c83f4d0f2728180 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Worn pens have a non-zero initial pressure and are identifed by this. If any consecutive pressure reading is below the inital pressure reading it was considered as a bug and logged accordingly. This condition however can also be triggered by the user: if the user hits the tablet hard with a fast motion the initial pressure reading might be != 0 while the pen returns back to zero when lifted off gently. Thus don't flag this situation as a bug. Signed-off-by: Egbert Eich <[email protected]> --- src/wcmCommon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index c81310f..c92b16a 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1074,8 +1074,8 @@ normalizePressure(const WacomDevicePtr priv, const WacomDeviceState *ds) if (p < priv->minPressure) { - LogMessageVerbSigSafe(X_ERROR, 0, - "%s: Pressure %d lower than expected minimum %d. This is a bug.\n", + LogMessageVerbSigSafe(X_INFO, 0, + "%s: Pressure %d lower than expected minimum %d.\n", priv->pInfo->name, ds->pressure, priv->minPressure); p = priv->minPressure; } ++++++ u_02-Log-when-the-pen-device-appears-to-be-too-worn-out.patch ++++++ From: Egbert Eich <[email protected]> Date: Fri Feb 7 20:24:39 2014 +0100 Subject: [PATCH 2/10]Log when the pen device appears to be too worn out Patch-Mainline: to be upstreamed Git-commit: 6ca093e15db660c8369087b44d241a66fe21be66 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Worn out pens have an initial pressure != 0. If this condition happens 3 consecutive times warn about it. If the condition doesn't persist, also notify. This condition may also occur intermittently on abusive operation. Signed-off-by: Egbert Eich <[email protected]> --- src/wcmCommon.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index c92b16a..bb41f9a 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1124,6 +1124,60 @@ setPressureButton(const WacomDevicePtr priv, const WacomDeviceState *ds) return buttons; } +/* + * Broken pen with a broken tip might give high pressure values + * all the time. The following counter count the number of time a high prox-in + * pressure is detected. As soon as a low pressure event is received, the + * value is reset to 0. + */ +static int highProxInPressureCounter = 0; +#define LIMIT_HIGH_PRESSURE_COUNTER 3 +#define LIMIT_LOW_PRESSURE 40 /* percentage of max value */ + + +static void detectPressureIssue(WacomDevicePtr priv, + WacomCommonPtr common, + WacomDeviceStatePtr ds) +{ + int serial = ds->serial_num; + int pressureThreshold = common->wcmMaxZ * LIMIT_LOW_PRESSURE / 100; + + /* detect broken pens which always have high tip pressure */ + if (!priv->oldProximity) + { + if (ds->pressure > pressureThreshold) + { + highProxInPressureCounter++; + + /* seen enough high prox-in pressure events? */ + if (highProxInPressureCounter == LIMIT_HIGH_PRESSURE_COUNTER) + { + LogMessageVerbSigSafe( + X_WARNING, 0, + "%s(%u) has seen an initial pressure (%d) %d times " + "which is too close to the maximum value (%d). " + "Time to change your tool. \n", + priv->pInfo->name, serial, ds->pressure, + highProxInPressureCounter, + common->wcmMaxZ); + } + } + } + /* got a low pressure event? Then the pen is maybe not broken, in fact. */ + if (ds->pressure < pressureThreshold && ds->pressure != 0) { + /* printed a "broken pen" warning before? */ + if (highProxInPressureCounter >= LIMIT_HIGH_PRESSURE_COUNTER) + LogMessageVerbSigSafe( + X_WARNING, 0, + "Tool %s(%u) maybe not broken, " + "even after %d times high prox-in pressure.\n", + priv->pInfo->name, serial, highProxInPressureCounter); + + /* restart counter game */ + highProxInPressureCounter = 0; + } +} + static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, const WacomChannelPtr pChannel, enum WacomSuppressMode suppress) @@ -1206,6 +1260,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, if ((IsPen(priv) || IsTouch(priv)) && common->wcmMaxZ) { + detectPressureIssue(priv, common, &filtered); priv->minPressure = rebasePressure(priv, &filtered); filtered.pressure = normalizePressure(priv, &filtered); if (IsPen(priv)) ++++++ u_03-Add-more-detailed-messaging-in-code-that-handles-abnormal-situations.patch ++++++ From: Egbert Eich <[email protected]> Date: Fri Feb 7 20:42:22 2014 +0100 Subject: [PATCH 3/10]Add more detailed messaging in code that handles abnormal situations Patch-Mainline: to be upstreamed Git-commit: 5ab48d5e572024f4ef63525a8050abc2c2100893 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Log which serial numbers have been fore-proxied out. Signed-off-by: Egbert Eich <[email protected]> --- src/wcmUSB.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index eaaf854..39df47f 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -881,6 +881,8 @@ static int usbChooseChannel(WacomCommonPtr common, int device_type, unsigned int common->wcmChannel[i].work.proximity = 0; /* dispatch event */ wcmEvent(common, i, &common->wcmChannel[i].work); + DBG(2, common, "free channels: dropping %u\n", + common->wcmChannel[i].work.serial_num); } } DBG(1, common, "device with serial number: %u" ++++++ u_04-Avoid-division-by-zero-in-xf86ScaleAxis.patch ++++++ From: Egbert Eich <[email protected]> Date: Tue Feb 11 12:54:04 2014 +0100 Subject: [PATCH 4/10]Avoid 'division by zero' in xf86ScaleAxis() Patch-Mainline: to be upstreamed Git-commit: 90cf9a5d4a0bdd7e270d92d28157bce685b1d6ee Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> If minPressure == wcmMaxZ then the range left to scale is 0. Catch this condition and act appropriately. Signed-off-by: Egbert Eich <[email protected]> --- src/wcmCommon.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index bb41f9a..b7f2a7d 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1071,6 +1071,7 @@ normalizePressure(const WacomDevicePtr priv, const WacomDeviceState *ds) WacomCommonPtr common = priv->common; double pressure; int p = ds->pressure; + int range_left; if (p < priv->minPressure) { @@ -1081,10 +1082,14 @@ normalizePressure(const WacomDevicePtr priv, const WacomDeviceState *ds) } /* normalize pressure to 0..FILTER_PRESSURE_RES */ - pressure = xf86ScaleAxis(p - priv->minPressure, - FILTER_PRESSURE_RES, 0, - common->wcmMaxZ - priv->minPressure, - 0); + range_left = common->wcmMaxZ - priv->minPressure; + if (range_left > 1) + pressure = xf86ScaleAxis(p - priv->minPressure, + FILTER_PRESSURE_RES, 0, + common->wcmMaxZ - priv->minPressure, + 0); + else + pressure = common->wcmMaxZ; return (int)pressure; } ++++++ u_05-Improve-usbInitToolType-tool-type-detection.patch ++++++ From: Egbert Eich <[email protected]> Date: Tue Feb 11 12:59:38 2014 +0100 Subject: [PATCH 5/10]Improve usbInitToolType() tool type detection Patch-Mainline: to be upstreamed Git-commit: 03d1785905b2730c2017c7901e129f22eb812ae1 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Let it check the event queue for a serial number (ie. event type EV_MSC, event code MSC_SERIAL) and check of the serial number == -1 to determine if the tool is of type PAD. Signed-off-by: Egbert Eich <[email protected]> --- src/wcmUSB.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 39df47f..46417a5 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1482,7 +1482,7 @@ static void usbParseBTNEvent(WacomCommonPtr common, * @param[in] code Linux input tool code (e.g. BTN_STYLUS_PEN) * @return Wacom device ID (e.g. STYLUS_ID) or 0 if no match. */ -static int toolTypeToDeviceType(WacomCommonPtr common, int type, int code) +static int toolTypeToDeviceType(WacomCommonPtr common, int type, int code, int value) { wcmUSBData* private = common->private; @@ -1516,6 +1516,8 @@ static int toolTypeToDeviceType(WacomCommonPtr common, int type, int code) return TOUCH_ID; } } + else if (type == EV_MSC && code == MSC_SERIAL && value == -1) + return PAD_ID; return 0; } @@ -1543,7 +1545,7 @@ static int refreshDeviceType(WacomCommonPtr common) for (i = 0; i < KEY_MAX; i++) { if (ISBITSET(keys, i)) - device_type = toolTypeToDeviceType(common, EV_KEY, i); + device_type = toolTypeToDeviceType(common, EV_KEY, i, 0); if (device_type) return device_type; } @@ -1573,7 +1575,8 @@ static int usbInitToolType(WacomCommonPtr common, const struct input_event *even for (i = 0; (i < nevents) && !device_type; ++i, event_ptr++) { - device_type = toolTypeToDeviceType(common, event_ptr->type, event_ptr->code); + device_type = toolTypeToDeviceType(common, event_ptr->type, event_ptr->code, + event_ptr->value); } if (!device_type) ++++++ u_06-Add-an-option-to-disable-pressure-recalibration.patch ++++++ From: Egbert Eich <[email protected]> Date: Fri Feb 7 21:37:49 2014 +0100 Subject: [PATCH 6/10]Add an option to disable pressure recalibration Patch-Mainline: to be upstreamed Git-commit: ba120588bc8f61d2d6d691b18362610107b59c40 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> If the initial pressure of a device is != 0 the driver recalibrates the pressure range. This is to account for worn out devices. The downside is that when the user hits the tablet very hard the initial pressure reading may be unequal to zero even for a perfectly good pen. If the consecutive pressure readings are not higher than the initial pressure by a threshold no button event will be generated. This option allows to disable the recalibration. Signed-off-by: Egbert Eich <[email protected]> --- include/wacom-properties.h | 4 ++++ man/wacom.man | 10 ++++++++++ man/xsetwacom.man | 9 +++++++++ src/wcmCommon.c | 8 +++++--- src/wcmValidateDevice.c | 6 ++++++ src/wcmXCommand.c | 23 +++++++++++++++++++++++ src/xf86WacomDefs.h | 2 ++ tools/xsetwacom.c | 9 +++++++++ 8 files changed, 68 insertions(+), 3 deletions(-) diff --git a/include/wacom-properties.h b/include/wacom-properties.h index dd7e7f3..cb94ffc 100644 --- a/include/wacom-properties.h +++ b/include/wacom-properties.h @@ -103,6 +103,10 @@ */ #define WACOM_PROP_DEBUGLEVELS "Wacom Debug Levels" +/* BOOL, 1 value, + TRUE == pressure renormalization enabled, FALSE == pressure renormalization disabled +*/ +#define WACOM_PROP_PRESSURE_RECAL "Wacom Pressure Recalibration" /* The following are tool types used by the driver in WACOM_PROP_TOOL_TYPE * or in the 'type' field for XI1 clients. Clients may check for one of diff --git a/man/wacom.man b/man/wacom.man index 98dec37..ae042f6 100644 --- a/man/wacom.man +++ b/man/wacom.man @@ -257,6 +257,16 @@ recognized as tap. A press and release event shorter than generates button press and release events. Presses longer than .B TapTime do not generate button events, only motion events. +.TP 4 +.B Option \fI"PressureRecalibration"\fP \fI"bool"\fP +Allows to disable pressure recalibration. Default: true. +If the initial pressure of a device is != 0 the driver recalibrates +the pressure range. This is to account for worn out devices. +The downside is that when the user hits the tablet very hard the +initial pressure reading may be unequal to zero even for a perfectly +good pen. If the consecutive pressure readings are not higher than +the initial pressure by a threshold no button event will be generated. +This option allows to disable the recalibration. .RE .SH "TOUCH GESTURES" .SS Single finger (1FG) diff --git a/man/xsetwacom.man b/man/xsetwacom.man index 978b104..6255352 100644 --- a/man/xsetwacom.man +++ b/man/xsetwacom.man @@ -227,6 +227,15 @@ code paths that are specific to a given tool. A higher level means more fine-grained debug messages, a level of 0 turns debugging off for this tool. Requires the driver to be built with debugging enabled. See also TabletDebugLevel. Default: 0, range of 0 to 12. +.TP +\fBPressureRecalibration\fR on|off +If the initial pressure of a device is != 0 the driver recalibrates +the pressure range. This is to account for worn out devices. +The downside is that when the user hits the tablet very hard the +initial pressure reading may be unequal to zero even for a perfectly +good pen. If the consecutive pressure readings are not higher than +the initial pressure by a threshold no button event will be generated. +This option allows to disable the recalibration. Default: on .SH "AUTHORS" diff --git a/src/wcmCommon.c b/src/wcmCommon.c index b7f2a7d..942e2c9 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1266,8 +1266,10 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, if ((IsPen(priv) || IsTouch(priv)) && common->wcmMaxZ) { detectPressureIssue(priv, common, &filtered); - priv->minPressure = rebasePressure(priv, &filtered); - filtered.pressure = normalizePressure(priv, &filtered); + if (common->wcmPressureRecalibration) { + priv->minPressure = rebasePressure(priv, &filtered); + filtered.pressure = normalizePressure(priv, &filtered); + } if (IsPen(priv)) filtered.buttons = setPressureButton(priv, &filtered); filtered.pressure = applyPressureCurve(priv,&filtered); @@ -1503,7 +1505,7 @@ WacomCommonPtr wcmNewCommon(void) /* transmit position if increment is superior */ common->wcmRawSample = DEFAULT_SAMPLES; /* number of raw data to be used to for filtering */ - + common->wcmPressureRecalibration = 1; return common; } diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index 1a5e722..93a3c7a 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -955,6 +955,12 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary, common->wcmGestureParameters.wcmTapTime); } + if (IsStylus(priv) || IsEraser(priv)) { + common->wcmPressureRecalibration + = xf86SetBoolOption(pInfo->options, + "PressureRecalibration", 1); + } + /* Swap stylus buttons 2 and 3 for Tablet PCs */ if (TabletHasFeature(common, WCM_TPC) && IsStylus(priv)) { diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index b2ba5a5..3596a8e 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -98,6 +98,7 @@ Atom prop_hover; Atom prop_tooltype; Atom prop_btnactions; Atom prop_product_id; +Atom prop_pressure_recal; #ifdef DEBUG Atom prop_debuglevels; #endif @@ -300,6 +301,13 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) wcmResetWheelAction(pInfo, i); } + if (IsStylus(priv) || IsEraser(priv)) { + values[0] = !common->wcmPressureRecalibration; + prop_pressure_recal = InitWcmAtom(pInfo->dev, + WACOM_PROP_PRESSURE_RECAL, + XA_INTEGER, 8, 1, values); + } + values[0] = common->vendor_id; values[1] = common->tablet_id; prop_product_id = InitWcmAtom(pInfo->dev, XI_PROP_PRODUCT_ID, XA_INTEGER, 32, 2, values); @@ -848,6 +856,21 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, { int nbuttons = priv->nbuttons < 4 ? priv->nbuttons : priv->nbuttons + 4; return wcmSetActionsProperty(dev, property, prop, checkonly, nbuttons, priv->btn_actions, priv->keys); + } else if (property == prop_pressure_recal) + { + CARD8 *values = (CARD8*)prop->data; + + if (prop->size != 1 || prop->format != 8) + return BadValue; + + if ((values[0] != 0) && (values[0] != 1)) + return BadValue; + + if (!IsStylus(priv) && !IsEraser(priv)) + return BadMatch; + + if (!checkonly) + common->wcmPressureRecalibration = !values[0]; } else { Atom *handler = NULL; diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index 3a64fd6..65a3d68 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -486,6 +486,8 @@ struct _WacomCommonRec int wcmCursorProxoutDistDefault; /* Default max mouse distance for proxy-out */ int wcmSuppress; /* transmit position on delta > supress */ int wcmRawSample; /* Number of raw data used to filter an event */ + int wcmPressureRecalibration; /* Determine if pressure recalibration of + worn pens should be performed */ int bufpos; /* position with buffer */ unsigned char buffer[BUFFER_SIZE]; /* data read from device */ diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index bbe25ea..b192f41 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -433,6 +433,15 @@ static param_t parameters[] = .prop_flags = PROP_FLAG_READONLY }, { + .name = "PressureRecalibration", + .desc = "Turns on/off Tablet pressure recalibration", + .prop_name = WACOM_PROP_PRESSURE_RECAL, + .prop_format = 8, + .prop_offset = 0, + .arg_count = 1, + .prop_flags = PROP_FLAG_BOOLEAN | PROP_FLAG_INVERTED + }, + { .name = "MapToOutput", .desc = "Map the device to the given output. ", .set_func = set_output, ++++++ u_07-Add-option-to-enable-logging.patch ++++++ From: Egbert Eich <[email protected]> Date: Fri Feb 7 23:06:26 2014 +0100 Subject: [PATCH 7/10]Add option to enable logging Patch-Mainline: to be upstreamed Git-commit: a5367e7d756451f627c864d6722fbcac88b6c07f Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> This patch adds an option to set a bitmask marking events to be logged to the Xserver log file. Currently the list contains the following bits: PROXIMITY event 1 BUTTON event 2 MOTION event 3 PRESSURE event 4 Signed-off-by: Egbert Eich <[email protected]> --- configure.ac | 11 +++++++++++ include/wacom-properties.h | 10 ++++++++++ man/wacom.man | 22 ++++++++++++++++++++++ man/xsetwacom.man | 22 +++++++++++++++++++++- src/wcmCommon.c | 35 +++++++++++++++++++++++++++++++++++ src/wcmConfig.c | 4 ++++ src/wcmUSB.c | 25 +++++++++++++++++++++++++ src/wcmXCommand.c | 22 +++++++++++++++++++++- src/xf86Wacom.h | 23 +++++++++++++++++++++++ src/xf86WacomDefs.h | 4 +++- tools/xsetwacom.c | 12 ++++++++++++ 11 files changed, 187 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 4ba103c..5ca6c6f 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,17 @@ if test "x$DEBUGGING" = xyes; then AC_DEFINE(DEBUG, 1, [Enable debugging code]) fi +# Define a configure option for event logging +AC_ARG_ENABLE(logging, + AS_HELP_STRING([--enable-logging], + [Enable logging (default: disabled)]), + [LOGGING=$enableval], [LOGGING=yes]) + +# Define the C preprocessor macro LOGGING in config.h +if test "x$LOGGING" = xyes; then + AC_DEFINE(LOGGING, 1, [Enable logging code]) +fi + # Define a configure option for an alternate input module directory AC_ARG_WITH(xorg-module-dir, AS_HELP_STRING([--with-xorg-module-dir=DIR], diff --git a/include/wacom-properties.h b/include/wacom-properties.h index cb94ffc..e6bf50c 100644 --- a/include/wacom-properties.h +++ b/include/wacom-properties.h @@ -108,6 +108,16 @@ */ #define WACOM_PROP_PRESSURE_RECAL "Wacom Pressure Recalibration" +/* 8 bit, values: + Type bit + PROXIMITY event 1 + BUTTON event 2 + MOTION event 3 + PRESSURE event 4 + Log event of the types specified in the type mask. +*/ +#define WACOM_PROP_LOGMASK "Wacom Log Mask" + /* The following are tool types used by the driver in WACOM_PROP_TOOL_TYPE * or in the 'type' field for XI1 clients. Clients may check for one of * these types to identify tool types. diff --git a/man/wacom.man b/man/wacom.man index ae042f6..6f63b90 100644 --- a/man/wacom.man +++ b/man/wacom.man @@ -267,6 +267,28 @@ initial pressure reading may be unequal to zero even for a perfectly good pen. If the consecutive pressure readings are not higher than the initial pressure by a threshold no button event will be generated. This option allows to disable the recalibration. +.TP 4 +.B Option \fI"LogMask" \fI"number"\fP +bitmask that enables logging of a group of events. +.RS +.PD 0 +.TP +Bit +Event +.TP +0 +proximity +.TP +1 +button +.TP +2 +motion +.TP +3 +pressure +.PD + .RE .SH "TOUCH GESTURES" .SS Single finger (1FG) diff --git a/man/xsetwacom.man b/man/xsetwacom.man index 6255352..3afed8e 100644 --- a/man/xsetwacom.man +++ b/man/xsetwacom.man @@ -236,7 +236,27 @@ initial pressure reading may be unequal to zero even for a perfectly good pen. If the consecutive pressure readings are not higher than the initial pressure by a threshold no button event will be generated. This option allows to disable the recalibration. Default: on - +.TP +\fBLogMask\fR mask +bitmask that enables logging of a group of events. +.RS +.PD 0 +.TP +Bit +Event +.TP +0 +proximity +.TP +1 +button +.TP +2 +motion +.TP +3 +pressure +.PD .SH "AUTHORS" Peter Hutterer <[email protected]> diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 942e2c9..54a7fb3 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -27,6 +27,9 @@ #include "wcmTouchFilter.h" #include <xkbsrv.h> #include <xf86_OSproc.h> +#ifdef LOGGING +#include <time.h> +#endif /* X servers pre 1.9 didn't copy data passed into xf86Post*Event. * Data passed in would be modified, requiring the driver to copy the @@ -85,6 +88,35 @@ void set_absolute(InputInfoPtr pInfo, Bool absolute) priv->flags &= ~ABSOLUTE_FLAG; } +#ifdef LOGGING +void wcm_timestr(char *str, int str_n) +{ + struct timespec tp; + struct tm tm; + static char wday_name[7][3] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static char mon_name[12][3] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + + str[0] = '\0'; + if (clock_gettime(CLOCK_REALTIME, &tp) < 0) + return; + localtime_r(&tp.tv_sec, &tm); + + snprintf(str, str_n, " %.3s %.3s%3d %.2d:%.2d:%.2d.%.6d - ", + wday_name[tm.tm_wday], + mon_name[tm.tm_mon], + tm.tm_mday, tm.tm_hour, + tm.tm_min, tm.tm_sec, (int)tp.tv_nsec); + + return; + +} +#endif + /***************************************************************************** * wcmMappingFactor -- * calculate the proper tablet to screen mapping factor according to the @@ -1506,6 +1538,9 @@ WacomCommonPtr wcmNewCommon(void) common->wcmRawSample = DEFAULT_SAMPLES; /* number of raw data to be used to for filtering */ common->wcmPressureRecalibration = 1; +#ifdef LOGGING + common->LogMask = 0; +#endif return common; } diff --git a/src/wcmConfig.c b/src/wcmConfig.c index 2d19944..fcac472 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -563,6 +563,10 @@ static int wcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) common->debugLevel = xf86SetIntOption(pInfo->options, "CommonDBG", common->debugLevel); +#ifdef LOGGING + common->LogMask = xf86SetIntOption(pInfo->options, + "LogMask", common->LogMask); +#endif oldname = strdup(pInfo->name); if (wcmIsHotpluggedDevice(pInfo)) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 46417a5..01c13ea 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1078,6 +1078,31 @@ static int usbIdToType(int id) return type; } +#ifdef LOGGING +/** + * Return type name string. + * @param type + * @return string + */ +static const char *usbTypeName(unsigned long type) +{ + switch (type) { + case STYLUS_ID: + return "PEN"; + case ERASER_ID: + return "RUBBER"; + case CURSOR_ID: + return "MOUSE"; + case TOUCH_ID: + return "TOUCH"; + case PAD_ID: + return "PAD"; + default: + return "UNKNOWN"; + } +} +#endif + /** * Find the tool type (STYLUS_ID, etc.) based on the device_id or the * current tool serial number if the device_id is unknown (0). diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 3596a8e..d874755 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -99,6 +99,9 @@ Atom prop_tooltype; Atom prop_btnactions; Atom prop_product_id; Atom prop_pressure_recal; +#ifdef LOGGING +Atom prop_logmask; +#endif #ifdef DEBUG Atom prop_debuglevels; #endif @@ -311,7 +314,10 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) values[0] = common->vendor_id; values[1] = common->tablet_id; prop_product_id = InitWcmAtom(pInfo->dev, XI_PROP_PRODUCT_ID, XA_INTEGER, 32, 2, values); - +#ifdef LOGGING + values[0] = common->LogMask; + prop_logmask = InitWcmAtom(pInfo->dev, WACOM_PROP_LOGMASK, XA_INTEGER, 8, 1, values); +#endif #ifdef DEBUG values[0] = priv->debugLevel; values[1] = common->debugLevel; @@ -852,6 +858,20 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, common->debugLevel = values[1]; } #endif +#ifdef LOGGING + } else if (property == prop_logmask) { + CARD8 *values; + + if (prop->size != 1 || prop->format != 8) + return BadMatch; + + values = (CARD8*)prop->data; + + if (!checkonly) + { + common->LogMask = values[0]; + } +#endif } else if (property == prop_btnactions) { int nbuttons = priv->nbuttons < 4 ? priv->nbuttons : priv->nbuttons + 4; diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index 587bf48..2db98b6 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -71,6 +71,29 @@ #define DBG(lvl, priv, ...) #endif +#ifdef LOG +#undef LOG +#endif +#ifdef LOGGING +void wcm_timestr(char *str, int str_n); +#define DO_LOG(m, v) (m->LogMask & v) +#define LOG(m, v, f, ...) do { \ + if (DO_LOG(m, v)) { \ + char tstr[30]; \ + wcm_timestr(tstr, sizeof(tstr)); \ + LogMessageVerbSigSafe(X_NONE, -1, "[LOG]%s " f, tstr, __VA_ARGS__); \ + } \ +} while (0) +#define LOG_PROXIMITY 1 +#define LOG_BUTTON 2 +#define LOG_MOTION 4 +#define LOG_PRESSURE 8 +#else +#define DO_LOG(m, v) (0) +#define LOG(m, v, f, ...) do { \ + } while (0) +#endif + /****************************************************************************** * WacomModule - all globals are packed in a single structure to keep the * global namespaces as clean as possible. diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index 65a3d68..a543bda 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -488,7 +488,9 @@ struct _WacomCommonRec int wcmRawSample; /* Number of raw data used to filter an event */ int wcmPressureRecalibration; /* Determine if pressure recalibration of worn pens should be performed */ - +#ifdef LOGGING + int LogMask; /* Mask to determine which event types to log. */ +#endif int bufpos; /* position with buffer */ unsigned char buffer[BUFFER_SIZE]; /* data read from device */ diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index b192f41..542c292 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -151,6 +151,18 @@ static param_t parameters[] = .prop_offset = 1, .arg_count = 1, }, +#ifdef LOGGING + { + .name = "LogMask", + .desc = "Mask whose bits determine which events to log: " + "0 ROXIMITY event, 1 BUTTON event, 2 MOTION event, " + "3 PRESSURE event", + .prop_name = WACOM_PROP_LOGMASK, + .prop_format = 8, + .prop_offset = 0, + .arg_count = 1, + }, +#endif { .name = "Suppress", .desc = "Number of points trimmed (default is 2). ", ++++++ u_08-Log-PROXIMITY-events.patch ++++++ From: Egbert Eich <[email protected]> Date: Mon Feb 10 19:55:45 2014 +0100 Subject: [PATCH 8/10]Log PROXIMITY events Patch-Mainline: to be upstreamed Git-commit: 4aa29ddd4963ef70202c9a86df03ac7e025daec9 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Signed-off-by: Egbert Eich <[email protected]> --- src/wcmUSB.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 01c13ea..3b4bbc5 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -511,6 +511,8 @@ static void usbWcmInitPadState(InputInfoPtr pInfo) ds->device_type = PAD_ID; ds->device_id = PAD_DEVICE_ID; ds->serial_num = channel; + LOG(common, LOG_PROXIMITY, "Proximity in for %s PAD serial -1\n", + pInfo->name); } int usbWcmGetRanges(InputInfoPtr pInfo) @@ -1639,6 +1641,7 @@ static void usbDispatchEvents(InputInfoPtr pInfo) int channel; WacomDeviceState dslast = common->wcmChannel[0].valid.state; wcmUSBData* private = common->private; + int log_proximity; DBG(6, common, "%d events received\n", private->wcmEventCnt); @@ -1686,6 +1689,7 @@ static void usbDispatchEvents(InputInfoPtr pInfo) ds = &common->wcmChannel[channel].work; dslast = common->wcmChannel[channel].valid.state; + log_proximity = ds->proximity; /* no device type? */ if (!ds->device_type && private->wcmDeviceType) { @@ -1697,10 +1701,16 @@ static void usbDispatchEvents(InputInfoPtr pInfo) /* all USB data operates from previous context except relative values*/ ds->relwheel = 0; ds->serial_num = private->wcmLastToolSerial; + if (log_proximity != ds->proximity) + LOG(common, LOG_PROXIMITY, "Proximity in for %s %s serial %d\n", + pInfo->name, + usbTypeName(ds->device_type), + private->wcmLastToolSerial); /* loop through all events in group */ for (i=0; i<private->wcmEventCnt; ++i) { + log_proximity = ds->proximity; event = private->wcmEvents + i; DBG(11, common, "event[%d]->type=%d code=%d value=%d\n", @@ -1737,6 +1747,12 @@ static void usbDispatchEvents(InputInfoPtr pInfo) usbParseKeyEvent(common, event, channel); usbParseBTNEvent(common, event, btn_channel); } + if (log_proximity != ds->proximity) + LOG(common, LOG_PROXIMITY, "Proximity %s for %s %s serial %d\n", + ds->proximity ? "in" : "out", + pInfo->name, + usbTypeName(ds->device_type), + private->wcmLastToolSerial); } /* next event */ /* DTF720 and DTF720a don't support eraser */ ++++++ u_09-Log-PRESSURE-events.patch ++++++ From: Egbert Eich <[email protected]> Date: Tue Feb 11 06:41:28 2014 +0100 Subject: [PATCH 9/10]Log PRESSURE events Patch-Mainline: to be upstreamed Git-commit: 541ef2ed195fc87d48be09adfc755c924a77046e Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Signed-off-by: Egbert Eich <[email protected]> --- src/wcmCommon.c | 3 +++ src/wcmUSB.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 54a7fb3..6162439 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1185,6 +1185,9 @@ static void detectPressureIssue(WacomDevicePtr priv, if (ds->pressure > pressureThreshold) { highProxInPressureCounter++; + LOG(common, LOG_PRESSURE, + "WARN: %s(%u) initial pressure %d > 0\n", + priv->pInfo->name, serial, ds->pressure); /* seen enough high prox-in pressure events? */ if (highProxInPressureCounter == LIMIT_HIGH_PRESSURE_COUNTER) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 3b4bbc5..05c7038 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1192,6 +1192,8 @@ static void usbParseAbsEvent(WacomCommonPtr common, break; case ABS_PRESSURE: ds->pressure = event->value; + LOG(common, LOG_PRESSURE, "Device %d got pressure %d\n", + ((wcmUSBData *)(common->private))->wcmLastToolSerial, ds->pressure); break; case ABS_DISTANCE: ds->distance = event->value; @@ -1292,6 +1294,8 @@ static void usbParseAbsMTEvent(WacomCommonPtr common, struct input_event *event) case ABS_MT_PRESSURE: ds->pressure = event->value; + LOG(common, LOG_PRESSURE, "Device %d got pressure %d\n", + ((wcmUSBData *)(common->private))->wcmLastToolSerial, ds->pressure); break; default: ++++++ u_10-Log-BUTTON-events.patch ++++++ From: Egbert Eich <[email protected]> Date: Tue Feb 11 12:51:32 2014 +0100 Subject: [PATCH 10/10]Log BUTTON events Patch-Mainline: to be upstreamed Git-commit: 44b8a7e6df822860b9a2a8258b2b826fe72ad3f7 Git-repo: References: Signed-off-by: Egbert Eich <[email protected]> Signed-off-by: Egbert Eich <[email protected]> --- src/wcmCommon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 6162439..f679b60 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -316,9 +316,17 @@ static void sendAButton(InputInfoPtr pInfo, int button, int mask, #ifdef DEBUG WacomCommonPtr common = priv->common; #endif - - DBG(4, priv, "TPCButton(%s) button=%d state=%d\n", - common->wcmTPCButton ? "on" : "off", button, mask); + if (DO_LOG(common, LOG_BUTTON)) { + int x = (first_val == 0 && num_val >= 1) ? + (int)((double)valuators[0] * priv->factorX) : -1; + int y = (first_val <= 1 && first_val + num_val > 1) ? + (int)((double)(valuators[1 - first_val]) * priv->factorY) : -1; + LOG(common, LOG_BUTTON, + "TPCButton(%s) button=%d state=%d x=%d y=%d\n", + common->wcmTPCButton ? "on" : "off", button, mask, x, y); + } else + DBG(4, priv, "TPCButton(%s) button=%d state=%d\n", + common->wcmTPCButton ? "on" : "off", button, mask); if (!priv->keys[button][0]) return; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
