From 5962b0fe4932a9908c97a44cb48921576940a3d3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 18:23:36 +0100 Subject: [PATCH 1/5] Abolish uses of %+d (EE) BUG: triggered 'if (f[f_idx])' (EE) BUG: ../../os/log.c:565 in vpnprintf() (EE) Unsupported printf directive '+' --- src/mtstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mtstate.c b/src/mtstate.c index 2cc0c32..348d214 100644 --- a/src/mtstate.c +++ b/src/mtstate.c @@ -286,23 +286,23 @@ static void mtstate_output(const struct MTState* ms, foreach_bit(i, ms->touch_used) { if (GETBIT(ms->touch[i].state, MT_RELEASED)) { timersub(&hs->evtime, &ms->touch[i].down, &tv); - xf86Msg(X_INFO, " released p(%d, %d) d(%+d, %+d) dir(%f) down(%llu) time(%lld)\n", + xf86Msg(X_INFO, " released p(%d, %d) d(%d, %d) dir(%f) down(%llu) time(%lld)\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, ms->touch[i].direction, timertoms(&ms->touch[i].down), timertoms(&tv)); } else if (GETBIT(ms->touch[i].state, MT_NEW)) { - xf86Msg(X_INFO, " new p(%d, %d) d(%+d, %+d) dir(%f) down(%llu)\n", + xf86Msg(X_INFO, " new p(%d, %d) d(%d, %d) dir(%f) down(%llu)\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, ms->touch[i].direction, timertoms(&ms->touch[i].down)); } else if (GETBIT(ms->touch[i].state, MT_INVALID)) { timersub(&hs->evtime, &ms->touch[i].down, &tv); - xf86Msg(X_INFO, " invalid p(%d, %d) d(%+d, %+d) dir(%f) down(%llu) time(%lld)\n", + xf86Msg(X_INFO, " invalid p(%d, %d) d(%d, %d) dir(%f) down(%llu) time(%lld)\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, ms->touch[i].direction, timertoms(&ms->touch[i].down), timertoms(&tv)); } else { - xf86Msg(X_INFO, " touching p(%d, %d) d(%+d, %+d) dir(%f) down(%llu)\n", + xf86Msg(X_INFO, " touching p(%d, %d) d(%d, %d) dir(%f) down(%llu)\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, ms->touch[i].direction, timertoms(&ms->touch[i].down)); } From 477d8bc168638abd77eae74990e0cb99e1f46652 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 20:30:24 +0100 Subject: [PATCH 2/5] common.h: Add missing include of Otherwise we get an implicit declaration warning about mtdev_empty. Signed-off-by: Ian Jackson --- include/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/common.h b/include/common.h index 1021067..44537f8 100644 --- a/include/common.h +++ b/include/common.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include From 52802ab46a1a287886d4d91ae5188798b7677106 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 20:31:28 +0100 Subject: [PATCH 3/5] mtrack-test.c: include Otherwise we get an implicit declaration warning about close(). Signed-off-by: Ian Jackson --- tools/mtrack-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/mtrack-test.c b/tools/mtrack-test.c index 2f455a4..88ed60b 100644 --- a/tools/mtrack-test.c +++ b/tools/mtrack-test.c @@ -23,6 +23,7 @@ #include "mtouch.h" #include #include +#include void xf86Msg(int type, const char *format, ...) { From 8403908bfe1951e1ae2febea230e583c57251bf7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 20:52:50 +0100 Subject: [PATCH 4/5] common.h: bitmaps: Provide PRBITMASK This is a printf format specifier, a la PRIx32 et al. This avoids us having to write %#x explicitly, which would be annoying if bitmask_t ever changed its type. No use sites introduced in this commit, so no functional change yet. Signed-off-by: Ian Jackson --- include/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/common.h b/include/common.h index 44537f8..b774ead 100644 --- a/include/common.h +++ b/include/common.h @@ -52,6 +52,7 @@ typedef unsigned int bitmask_t; #define SETBIT(m, x) (m |= BITMASK(x)) #define CLEARBIT(m, x) (m &= ~BITMASK(x)) #define MODBIT(m, x, b) ((b) ? SETBIT(m, x) : CLEARBIT(m, x)) +#define PRBITMASK "0x%x" #define ABSVAL(x) ((x) < 0 ? -1*(x) : (x)) #define MINVAL(x, y) ((x) < (y) ? (x) : (y)) From 41fcd9a9488321728f6defefdc3e45b3059b5dd9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Apr 2016 20:54:49 +0100 Subject: [PATCH 5/5] Debugging: Print each touch's state bitmask in mtstate_output The user is expected to decode the hex (with reference to the bit numbers defined in mtstate.h). Signed-off-by: Ian Jackson --- src/mtstate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mtstate.c b/src/mtstate.c index 348d214..bd9a7e3 100644 --- a/src/mtstate.c +++ b/src/mtstate.c @@ -286,25 +286,25 @@ static void mtstate_output(const struct MTState* ms, foreach_bit(i, ms->touch_used) { if (GETBIT(ms->touch[i].state, MT_RELEASED)) { timersub(&hs->evtime, &ms->touch[i].down, &tv); - xf86Msg(X_INFO, " released p(%d, %d) d(%d, %d) dir(%f) down(%llu) time(%lld)\n", + xf86Msg(X_INFO, " released p(%d, %d) d(%d, %d) dir(%f) down(%llu) state("PRBITMASK") time(%lld)\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, - ms->touch[i].direction, timertoms(&ms->touch[i].down), timertoms(&tv)); + ms->touch[i].direction, timertoms(&ms->touch[i].down), ms->touch[i].state, timertoms(&tv)); } else if (GETBIT(ms->touch[i].state, MT_NEW)) { - xf86Msg(X_INFO, " new p(%d, %d) d(%d, %d) dir(%f) down(%llu)\n", + xf86Msg(X_INFO, " new p(%d, %d) d(%d, %d) dir(%f) down(%llu) state("PRBITMASK")\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, - ms->touch[i].direction, timertoms(&ms->touch[i].down)); + ms->touch[i].direction, timertoms(&ms->touch[i].down), ms->touch[i].state); } else if (GETBIT(ms->touch[i].state, MT_INVALID)) { timersub(&hs->evtime, &ms->touch[i].down, &tv); - xf86Msg(X_INFO, " invalid p(%d, %d) d(%d, %d) dir(%f) down(%llu) time(%lld)\n", + xf86Msg(X_INFO, " invalid p(%d, %d) d(%d, %d) dir(%f) down(%llu) state("PRBITMASK") time(%lld)\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, - ms->touch[i].direction, timertoms(&ms->touch[i].down), timertoms(&tv)); + ms->touch[i].direction, timertoms(&ms->touch[i].down), ms->touch[i].state, timertoms(&tv)); } else { - xf86Msg(X_INFO, " touching p(%d, %d) d(%d, %d) dir(%f) down(%llu)\n", + xf86Msg(X_INFO, " touching p(%d, %d) d(%d, %d) dir(%f) down(%llu) state("PRBITMASK")\n", ms->touch[i].x, ms->touch[i].y, ms->touch[i].dx, ms->touch[i].dy, - ms->touch[i].direction, timertoms(&ms->touch[i].down)); + ms->touch[i].direction, timertoms(&ms->touch[i].down), ms->touch[i].state); } } }