diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-23 11:25:20 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-24 09:01:05 +1000 |
commit | c68fed3f13ca1335af548b88da72c27362d10ebd (patch) | |
tree | 0e5d3e8aee42daaec67a7ab8107c3122378d8e28 | |
parent | 2e03f1cde879fb9d16d21d79f4c71fcab703a578 (diff) | |
download | xf86-input-wacom-c68fed3f13ca1335af548b88da72c27362d10ebd.tar.gz |
Add "Wacom Debug Levels" property.
This property is only present if compiled with --enable-debug and allows for
run-time modification of the debug levels. Values supported are 0 to 10,
with 10 being the most verbose.
xsetwacom --set "device name" DebugLevel 10
xsetwacom --set "device name" CommonDBG 10
Since this is a driver-internal property clients are discouraged from using
this property for any purpose. It may disappear or change without warning in
future releases of the driver.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | include/wacom-properties.h | 6 | ||||
-rw-r--r-- | src/wcmXCommand.c | 27 | ||||
-rw-r--r-- | tools/xsetwacom.c | 10 |
3 files changed, 39 insertions, 4 deletions
diff --git a/include/wacom-properties.h b/include/wacom-properties.h index 6aa157d..153f4ab 100644 --- a/include/wacom-properties.h +++ b/include/wacom-properties.h @@ -78,4 +78,10 @@ */ #define WACOM_PROP_BUTTON_ACTIONS "Wacom Button Actions" +/* 8 bit, 2 values, priv->debugLevel and common->debugLevel. This property + * is for use in the driver only and only enabled if --enable-debug is + * given. No client may rely on this property being present or working. + */ +#define WACOM_PROP_DEBUGLEVELS "Wacom Debug Levels" + #endif diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index eecd759..a03749f 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -160,6 +160,9 @@ Atom prop_touch; Atom prop_hover; Atom prop_tooltype; Atom prop_btnactions; +#ifdef DEBUG +Atom prop_debuglevels; +#endif /* Special case: format -32 means type is XA_ATOM */ static Atom InitWcmAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values) @@ -288,6 +291,12 @@ void InitWcmDeviceProperties(LocalDevicePtr local) /* default to no actions */ memset(values, 0, sizeof(values)); prop_btnactions = InitWcmAtom(local->dev, WACOM_PROP_BUTTON_ACTIONS, -32, WCM_MAX_MOUSE_BUTTONS, values); + +#ifdef DEBUG + values[0] = priv->debugLevel; + values[1] = common->debugLevel; + prop_debuglevels = InitWcmAtom(local->dev, WACOM_PROP_DEBUGLEVELS, 8, 2, values); +#endif } int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, @@ -599,6 +608,24 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, /* reset screen info */ xf86WcmChangeScreen(local, priv->screen_no); } +#ifdef DEBUG + } else if (property == prop_debuglevels) + { + CARD8 *values; + + if (prop->size != 2 || prop->format != 8) + return BadMatch; + + values = (CARD8*)prop->data; + if (values[0] > 10 || values[1] > 10) + return BadValue; + + if (!checkonly) + { + priv->debugLevel = values[0]; + common->debugLevel = values[1]; + } +#endif } else if (property == prop_btnactions) { Atom *values; diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index 2644e6a..df6dd40 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -309,15 +309,17 @@ static param_t parameters[] = .name = "DebugLevel", .desc = "Level of debugging trace for individual devices, " "default is 0 (off). ", - .set_func = not_implemented, - .get_func = not_implemented, + .prop_name = WACOM_PROP_DEBUGLEVELS, + .prop_format = 8, + .prop_offset = 0, }, { .name = "CommonDBG", .desc = "Level of debugging statements applied to all devices " "associated with the same tablet. default is 0 (off). ", - .set_func = not_implemented, - .get_func = not_implemented, + .prop_name = WACOM_PROP_DEBUGLEVELS, + .prop_format = 8, + .prop_offset = 1, }, { .name = "Suppress", |