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 <[email protected]>
---
 include/wacom-properties.h |    6 ++++++
 src/wcmXCommand.c          |   27 +++++++++++++++++++++++++++
 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",
-- 
1.6.5.2


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to