summaryrefslogtreecommitdiff
path: root/tools/wacom-record.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/wacom-record.c')
-rw-r--r--tools/wacom-record.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/wacom-record.c b/tools/wacom-record.c
index 7562351..d096653 100644
--- a/tools/wacom-record.c
+++ b/tools/wacom-record.c
@@ -58,6 +58,35 @@ static void debug_message(WacomDevice *device, int debug_level, const char *func
static inline void print_axes(const WacomEventData *data)
{
+ char buf[1024] = {0};
+ const char *prefix = "";
+ uint32_t mask = data->mask;
+
+ for (uint32_t flag = 0x1; flag <= _WACOM_EVENT_AXIS_LAST; flag <<= 1) {
+ const char *name = "unknown axis";
+ if ((mask & flag) == 0)
+ continue;
+
+ switch (flag) {
+ case WACOM_X: name = "x"; break;
+ case WACOM_Y: name = "y"; break;
+ case WACOM_PRESSURE: name = "pressure"; break;
+ case WACOM_TILT_X: name = "tilt-x"; break;
+ case WACOM_TILT_Y: name = "tilt-y"; break;
+ case WACOM_ROTATION: name = "rotation"; break;
+ case WACOM_THROTTLE: name = "throttle"; break;
+ case WACOM_WHEEL: name = "wheel"; break;
+ case WACOM_RING: name = "ring"; break;
+ case WACOM_RING2: name = "ring"; break;
+ }
+
+ g_assert_cmpint(strlen(buf) + strlen(prefix) + strlen(name), <, sizeof(buf));
+
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s\"%s\"", prefix, name);
+ prefix = ", ";
+ }
+
+ printf(" mask: [ %s ]\n", buf);
printf(" axes: { x: %5d, y: %5d, pressure: %4d, tilt: [%3d,%3d], rotation: %3d, throttle: %3d, wheel: %3d, rings: [%3d, %3d] }\n",
data->x, data->y,
(data->mask & WACOM_PRESSURE) ? data->pressure : 0,