Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:16.0:Rings:1-MinimalX
xf86-input-wacom
n_01-Add-option-to-enable-logging.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File n_01-Add-option-to-enable-logging.patch of Package xf86-input-wacom
From: Egbert Eich <eich@suse.com> Date: Fri Feb 7 23:06:26 2014 +0100 Subject: [PATCH 1/4]Add option to enable logging Patch-Mainline: never Git-commit: 9717547311abfe18b7edad9e0b45f16b902e2f2d Git-repo: git://linuxwacom.git.sourceforge.net/gitroot/linuxwacom/xf86-input-wacom References: FATE# Signed-off-by: Egbert Eich <eich@suse.com> 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 low level event 1 PRESSURE low level event 2 BUTTON high level event 7 Signed-off-by: Egbert Eich <eich@suse.com> --- configure.ac | 11 +++++++++++ include/wacom-properties.h | 9 +++++++++ man/wacom.man | 19 +++++++++++++++++++ man/xsetwacom.man | 19 ++++++++++++++++++- src/wcmCommon.c | 35 +++++++++++++++++++++++++++++++++++ src/wcmConfig.c | 4 ++++ src/wcmUSB.c | 25 +++++++++++++++++++++++++ src/wcmXCommand.c | 22 +++++++++++++++++++++- src/xf86Wacom.h | 22 ++++++++++++++++++++++ src/xf86WacomDefs.h | 4 +++- tools/xsetwacom.c | 10 ++++++++++ 11 files changed, 177 insertions(+), 3 deletions(-) Index: xf86-input-wacom-0.39.0/configure.ac =================================================================== --- xf86-input-wacom-0.39.0.orig/configure.ac +++ xf86-input-wacom-0.39.0/configure.ac @@ -88,6 +88,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], Index: xf86-input-wacom-0.39.0/include/wacom-properties.h =================================================================== --- xf86-input-wacom-0.39.0.orig/include/wacom-properties.h +++ xf86-input-wacom-0.39.0/include/wacom-properties.h @@ -114,6 +114,15 @@ /* 32 bit, 1 values */ #define WACOM_PROP_PANSCROLL_THRESHOLD "Wacom Panscroll Threshold" +/* 8 bit, values: + Type bit + PROXIMITY_LOW_LEVEL event 1 + PRESSURE_LOW_LEVEL event 2 + BUTTON_HIGH_LEVEL event 7 + 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. Index: xf86-input-wacom-0.39.0/man/wacom.man =================================================================== --- xf86-input-wacom-0.39.0.orig/man/wacom.man +++ xf86-input-wacom-0.39.0/man/wacom.man @@ -279,6 +279,24 @@ good pen. If the consecutive pressure re 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 low level +.TP +1 +pressure low level +.TP +7 +button high level +.PD +.TP 4 .B Option \fI"PanScrollThreshold"\fP \fI"number"\fP Specifies the distance the pen must move (in tablet units) before a scroll event is generated when using the "pan" action. Smaller values Index: xf86-input-wacom-0.39.0/man/xsetwacom.man =================================================================== --- xf86-input-wacom-0.39.0.orig/man/xsetwacom.man +++ xf86-input-wacom-0.39.0/man/xsetwacom.man @@ -283,6 +283,24 @@ good pen. If the consecutive pressure re 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 low level +.TP +1 +pressure low level +.TP +7 +button high level +.PD +.TP \fBPanScrollThreshold\fR distance This specifies the distance the pen must move (in tablet units) before a scroll event is generated when using the "pan" action. Smaller values Index: xf86-input-wacom-0.39.0/src/wcmCommon.c =================================================================== --- xf86-input-wacom-0.39.0.orig/src/wcmCommon.c +++ xf86-input-wacom-0.39.0/src/wcmCommon.c @@ -27,6 +27,9 @@ #include "wcmTouchFilter.h" #include <xkbsrv.h> #include <xf86_OSproc.h> +#ifdef LOGGING +#include <time.h> +#endif struct _WacomDriverRec WACOM_DRIVER = { @@ -142,6 +145,35 @@ static void wcmPanscroll(InputInfoPtr pI *accumulated_y = wcmButtonPerNotch(priv, *accumulated_y, threshold, 4, 5); } +#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 + /***************************************************************************** * wcmSendButtons -- * Send button events by comparing the current button mask with the @@ -1563,6 +1595,9 @@ WacomCommonPtr wcmNewCommon(void) /* number of raw data to be used to for filtering */ common->wcmPanscrollThreshold = 0; common->wcmPressureRecalibration = 1; +#ifdef LOGGING + common->LogMask = 0; +#endif return common; } Index: xf86-input-wacom-0.39.0/src/wcmConfig.c =================================================================== --- xf86-input-wacom-0.39.0.orig/src/wcmConfig.c +++ xf86-input-wacom-0.39.0/src/wcmConfig.c @@ -653,6 +653,10 @@ static int wcmPreInit(InputDriverPtr drv 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)) Index: xf86-input-wacom-0.39.0/src/wcmUSB.c =================================================================== --- xf86-input-wacom-0.39.0.orig/src/wcmUSB.c +++ xf86-input-wacom-0.39.0/src/wcmUSB.c @@ -1230,6 +1230,31 @@ static int usbIdToType(WacomCommonPtr co 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. * Index: xf86-input-wacom-0.39.0/src/wcmXCommand.c =================================================================== --- xf86-input-wacom-0.39.0.orig/src/wcmXCommand.c +++ xf86-input-wacom-0.39.0/src/wcmXCommand.c @@ -99,6 +99,9 @@ static Atom prop_tooltype; static Atom prop_btnactions; static Atom prop_product_id; static Atom prop_pressure_recal; +#ifdef LOGGING +static Atom prop_logmask; +#endif static Atom prop_panscroll_threshold; #ifdef DEBUG static Atom prop_debuglevels; @@ -343,7 +346,10 @@ void InitWcmDeviceProperties(InputInfoPt 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; @@ -959,6 +965,20 @@ int wcmSetProperty(DeviceIntPtr dev, Ato 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; Index: xf86-input-wacom-0.39.0/src/xf86Wacom.h =================================================================== --- xf86-input-wacom-0.39.0.orig/src/xf86Wacom.h +++ xf86-input-wacom-0.39.0/src/xf86Wacom.h @@ -69,6 +69,28 @@ #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_LOW 1 << 0 +#define LOG_PRESSURE_LOW 1 << 1 +#define LOG_BUTTON_HIGH 1 << 7 +#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. Index: xf86-input-wacom-0.39.0/src/xf86WacomDefs.h =================================================================== --- xf86-input-wacom-0.39.0.orig/src/xf86WacomDefs.h +++ xf86-input-wacom-0.39.0/src/xf86WacomDefs.h @@ -468,6 +468,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 wcmPanscrollThreshold; /* distance pen must move to send a panscroll event */ int bufpos; /* position with buffer */ Index: xf86-input-wacom-0.39.0/tools/xsetwacom.c =================================================================== --- xf86-input-wacom-0.39.0.orig/tools/xsetwacom.c +++ xf86-input-wacom-0.39.0/tools/xsetwacom.c @@ -159,6 +159,16 @@ static param_t parameters[] = .arg_count = 1, }, { + .name = "LogMask", + .desc = "Mask whose bits determine which events to log: " + "0 PROXIMITY event, 1 BUTTON event, 2 MOTION event, " + "3 PRESSURE event", + .prop_name = WACOM_PROP_LOGMASK, + .prop_format = 8, + .prop_offset = 0, + .arg_count = 1, + }, + { .name = "Suppress", .x11name = "Suppress", .desc = "Number of points trimmed (default is 2). ", @@ -3028,7 +3038,7 @@ static void test_parameter_number(void) * deprecated them. * Numbers include trailing NULL entry. */ - assert(ARRAY_SIZE(parameters) == 40); + assert(ARRAY_SIZE(parameters) == 41); assert(ARRAY_SIZE(deprecated_parameters) == 17); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor