diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-02 10:06:01 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-05 08:51:46 +1000 |
commit | d3c1b80692013abb2f2dea6ec7acf1d8a89a18d2 (patch) | |
tree | a26d54a4bab598e37d73181d53d1dc79e2027659 /src | |
parent | 0198c02774a5063c5cf45b6eddef4a33d9f494d7 (diff) |
Clean up debugging system, allow for --enable-debug
Add --enable-debug to list of configure options.
Clean up the DBG macro to use xf86MsgVerb and supply the verbosity.
Don't use ErrorF from the driver, use xf86Msg instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/eventcomm.c | 6 | ||||
-rw-r--r-- | src/ps2comm.c | 30 | ||||
-rw-r--r-- | src/synaptics.c | 69 | ||||
-rw-r--r-- | src/synapticsstr.h | 11 |
4 files changed, 58 insertions, 58 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index d8138d4..8287ca2 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -437,11 +437,11 @@ EventAutoDevProbe(LocalDevicePtr local) i = scandir(DEV_INPUT_EVENT, &namelist, EventDevOnly, alphasort); if (i < 0) { - ErrorF("Couldn't open %s\n", DEV_INPUT_EVENT); + xf86Msg(X_ERROR, "Couldn't open %s\n", DEV_INPUT_EVENT); return FALSE; } else if (i == 0) { - ErrorF("%s The /dev/input/event* device nodes seem to be missing\n", + xf86Msg(X_ERROR, "%s The /dev/input/event* device nodes seem to be missing\n", local->name); free(namelist); return FALSE; @@ -471,7 +471,7 @@ EventAutoDevProbe(LocalDevicePtr local) free(namelist); if (!touchpad_found) { - ErrorF("%s no synaptics event device found\n", local->name); + xf86Msg(X_ERROR, "%s no synaptics event device found\n", local->name); return FALSE; } return TRUE; diff --git a/src/ps2comm.c b/src/ps2comm.c index e65e1af..ae2592f 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -65,18 +65,12 @@ #define PS2_RES_RESOLUTION(r) (((r) >> 8) & 0x03) #define PS2_RES_SAMPLE_RATE(r) ((r) & 0xff) -/* #define DEBUG */ - #ifdef DEBUG #define PS2DBG(x) (x) #else #define PS2DBG(x) #endif -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 1 -#define DBG(a,b) -#endif - struct SynapticsHwInfo { unsigned int model_id; /* Model-ID */ unsigned int capabilities; /* Capabilities */ @@ -411,7 +405,7 @@ ps2_query_is_synaptics(int fd, struct SynapticsHwInfo* synhw) if (ps2_synaptics_identify(fd, synhw)) { return TRUE; } else { - ErrorF("Query no Synaptics: %06X\n", synhw->identity); + xf86Msg(X_ERROR, "Query no Synaptics: %06X\n", synhw->identity); return FALSE; } } @@ -528,22 +522,22 @@ ps2_packet_ok(struct SynapticsHwInfo *synhw, struct CommData *comm) int newabs = SYN_MODEL_NEWABS(synhw); if (newabs ? ((buf[0] & 0xC0) != 0x80) : ((buf[0] & 0xC0) != 0xC0)) { - DBG(4, ErrorF("Synaptics driver lost sync at 1st byte\n")); + DBG(4, "Synaptics driver lost sync at 1st byte\n"); return FALSE; } if (!newabs && ((buf[1] & 0x60) != 0x00)) { - DBG(4, ErrorF("Synaptics driver lost sync at 2nd byte\n")); + DBG(4, "Synaptics driver lost sync at 2nd byte\n"); return FALSE; } if ((newabs ? ((buf[3] & 0xC0) != 0xC0) : ((buf[3] & 0xC0) != 0x80))) { - DBG(4, ErrorF("Synaptics driver lost sync at 4th byte\n")); + DBG(4, "Synaptics driver lost sync at 4th byte\n"); return FALSE; } if (!newabs && ((buf[4] & 0x60) != 0x00)) { - DBG(4, ErrorF("Synaptics driver lost sync at 5th byte\n")); + DBG(4, "Synaptics driver lost sync at 5th byte\n"); return FALSE; } @@ -565,16 +559,16 @@ ps2_synaptics_get_packet(LocalDevicePtr local, struct SynapticsHwInfo *synhw, /* test if there is a reset sequence received */ if ((c == 0x00) && (comm->lastByte == 0xAA)) { if (xf86WaitForInput(local->fd, 50000) == 0) { - DBG(7, ErrorF("Reset received\n")); + DBG(7, "Reset received\n"); proto_ops->QueryHardware(local); } else - DBG(3, ErrorF("faked reset received\n")); + DBG(3, "faked reset received\n"); } comm->lastByte = u; /* to avoid endless loops */ if (count++ > 30) { - ErrorF("Synaptics driver lost sync... got gigantic packet!\n"); + xf86Msg(X_ERROR, "Synaptics driver lost sync... got gigantic packet!\n"); return FALSE; } @@ -591,7 +585,7 @@ ps2_synaptics_get_packet(LocalDevicePtr local, struct SynapticsHwInfo *synhw, comm->outOfSync++; if (comm->outOfSync > MAX_UNSYNC_PACKETS) { comm->outOfSync = 0; - DBG(3, ErrorF("Synaptics synchronization lost too long -> reset touchpad.\n")); + DBG(3, "Synaptics synchronization lost too long -> reset touchpad.\n"); proto_ops->QueryHardware(local); /* including a reset */ continue; } @@ -601,7 +595,7 @@ ps2_synaptics_get_packet(LocalDevicePtr local, struct SynapticsHwInfo *synhw, if (comm->protoBufTail >= 6) { /* Full packet received */ if (comm->outOfSync > 0) { comm->outOfSync = 0; - DBG(4, ErrorF("Synaptics driver resynced.\n")); + DBG(4, "Synaptics driver resynced.\n"); } comm->protoBufTail = 0; return TRUE; @@ -664,7 +658,7 @@ PS2ReadHwState(LocalDevicePtr local, hw->multi[i] = FALSE; if (newabs) { /* newer protos...*/ - DBG(7, ErrorF("using new protocols\n")); + DBG(7, "using new protocols\n"); hw->x = (((buf[3] & 0x10) << 8) | ((buf[1] & 0x0f) << 8) | buf[4]); @@ -714,7 +708,7 @@ PS2ReadHwState(LocalDevicePtr local, } } } else { /* old proto...*/ - DBG(7, ErrorF("using old protocol\n")); + DBG(7, "using old protocol\n"); hw->x = (((buf[1] & 0x1F) << 8) | buf[2]); hw->y = (((buf[4] & 0x1F) << 8) | diff --git a/src/synaptics.c b/src/synaptics.c index e0d3555..7df3a72 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -107,10 +107,6 @@ typedef enum { #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 1 -#define DBG(a,b) -#endif - #define INPUT_BUFFER_SIZE 200 /***************************************************************************** @@ -638,7 +634,6 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) goto SetupProc_fail; priv->comm.buffer = XisbNew(local->fd, INPUT_BUFFER_SIZE); - DBG(9, XisbTrace(priv->comm.buffer, 1)); if (!QueryHardware(local)) { xf86Msg(X_ERROR, "%s Unable to query/initialize Synaptics hardware.\n", local->name); @@ -705,7 +700,7 @@ static void SynapticsUnInit(InputDriverPtr drv, static void SynapticsCtrl(DeviceIntPtr device, PtrCtrl *ctrl) { - DBG(3, ErrorF("SynapticsCtrl called.\n")); + DBG(3, "SynapticsCtrl called.\n"); /* pInfo = device->public.devicePrivate; pMse = pInfo->private; @@ -747,7 +742,7 @@ DeviceOn(DeviceIntPtr dev) LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (local->private); - DBG(3, ErrorF("Synaptics DeviceOn called\n")); + DBG(3, "Synaptics DeviceOn called\n"); SetDeviceAndProtocol(local); local->fd = xf86OpenSerial(local->options); @@ -790,7 +785,7 @@ DeviceOff(DeviceIntPtr dev) LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (local->private); - DBG(3, ErrorF("Synaptics DeviceOff called\n")); + DBG(3, "Synaptics DeviceOff called\n"); if (local->fd != -1) { TimerFree(priv->timer); @@ -876,7 +871,7 @@ DeviceInit(DeviceIntPtr dev) InitButtonLabels(btn_labels, SYN_MAX_BUTTONS); #endif - DBG(3, ErrorF("Synaptics DeviceInit called\n")); + DBG(3, "Synaptics DeviceInit called\n"); for (i = 0; i <= SYN_MAX_BUTTONS; i++) map[i] = i; @@ -1304,33 +1299,33 @@ SelectTapButton(SynapticsPrivate *priv, edge_type edge) default: switch (edge) { case RIGHT_TOP_EDGE: - DBG(7, ErrorF("right top edge\n")); + DBG(7, "right top edge\n"); tap = RT_TAP; break; case RIGHT_BOTTOM_EDGE: - DBG(7, ErrorF("right bottom edge\n")); + DBG(7, "right bottom edge\n"); tap = RB_TAP; break; case LEFT_TOP_EDGE: - DBG(7, ErrorF("left top edge\n")); + DBG(7, "left top edge\n"); tap = LT_TAP; break; case LEFT_BOTTOM_EDGE: - DBG(7, ErrorF("left bottom edge\n")); + DBG(7, "left bottom edge\n"); tap = LB_TAP; break; default: - DBG(7, ErrorF("no edge\n")); + DBG(7, "no edge\n"); tap = F1_TAP; break; } break; case 2: - DBG(7, ErrorF("two finger tap\n")); + DBG(7, "two finger tap\n"); tap = F2_TAP; break; case 3: - DBG(7, ErrorF("three finger tap\n")); + DBG(7, "three finger tap\n"); tap = F3_TAP; break; } @@ -1343,7 +1338,7 @@ static void SetTapState(SynapticsPrivate *priv, enum TapState tap_state, int millis) { SynapticsParameters *para = &priv->synpara; - DBG(7, ErrorF("SetTapState - %d -> %d (millis:%d)\n", priv->tap_state, tap_state, millis)); + DBG(7, "SetTapState - %d -> %d (millis:%d)\n", priv->tap_state, tap_state, millis); switch (tap_state) { case TS_START: priv->tap_button_state = TBS_BUTTON_UP; @@ -1383,8 +1378,8 @@ SetTapState(SynapticsPrivate *priv, enum TapState tap_state, int millis) static void SetMovingState(SynapticsPrivate *priv, enum MovingState moving_state, int millis) { - DBG(7, ErrorF("SetMovingState - %d -> %d center at %d/%d (millis:%d)\n", priv->moving_state, - moving_state,priv->hwState.x, priv->hwState.y, millis)); + DBG(7, "SetMovingState - %d -> %d center at %d/%d (millis:%d)\n", priv->moving_state, + moving_state,priv->hwState.x, priv->hwState.y, millis); if (moving_state == MS_TRACKSTICK) { priv->trackstick_neutral_x = priv->hwState.x; @@ -1817,7 +1812,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, priv->circ_scroll_on = TRUE; priv->circ_scroll_vert = TRUE; priv->scroll_a = angle(priv, hw->x, hw->y); - DBG(7, ErrorF("circular scroll detected on edge\n")); + DBG(7, "circular scroll detected on edge\n"); } } } @@ -1829,14 +1824,14 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, priv->vert_scroll_twofinger_on = TRUE; priv->vert_scroll_edge_on = FALSE; priv->scroll_y = hw->y; - DBG(7, ErrorF("vert two-finger scroll detected\n")); + DBG(7, "vert two-finger scroll detected\n"); } if (!priv->horiz_scroll_twofinger_on && (para->scroll_twofinger_horiz) && (para->scroll_dist_horiz != 0)) { priv->horiz_scroll_twofinger_on = TRUE; priv->horiz_scroll_edge_on = FALSE; priv->scroll_x = hw->x; - DBG(7, ErrorF("horiz two-finger scroll detected\n")); + DBG(7, "horiz two-finger scroll detected\n"); } } } @@ -1846,13 +1841,13 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, (edge & RIGHT_EDGE)) { priv->vert_scroll_edge_on = TRUE; priv->scroll_y = hw->y; - DBG(7, ErrorF("vert edge scroll detected on right edge\n")); + DBG(7, "vert edge scroll detected on right edge\n"); } if ((para->scroll_edge_horiz) && (para->scroll_dist_horiz != 0) && (edge & BOTTOM_EDGE)) { priv->horiz_scroll_edge_on = TRUE; priv->scroll_x = hw->x; - DBG(7, ErrorF("horiz edge scroll detected on bottom edge\n")); + DBG(7, "horiz edge scroll detected on bottom edge\n"); } } } @@ -1862,27 +1857,27 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, Bool oldh = priv->horiz_scroll_edge_on || (priv->circ_scroll_on && !priv->circ_scroll_vert); if (priv->circ_scroll_on && !finger) { /* circular scroll locks in until finger is raised */ - DBG(7, ErrorF("cicular scroll off\n")); + DBG(7, "cicular scroll off\n"); priv->circ_scroll_on = FALSE; } if (!finger || hw->numFingers < 2) { if (priv->vert_scroll_twofinger_on) { - DBG(7, ErrorF("vert two-finger scroll off\n")); + DBG(7, "vert two-finger scroll off\n"); priv->vert_scroll_twofinger_on = FALSE; } if (priv->horiz_scroll_twofinger_on) { - DBG(7, ErrorF("horiz two-finger scroll off\n")); + DBG(7, "horiz two-finger scroll off\n"); priv->horiz_scroll_twofinger_on = FALSE; } } if (priv->vert_scroll_edge_on && (!(edge & RIGHT_EDGE) || !finger)) { - DBG(7, ErrorF("vert edge scroll off\n")); + DBG(7, "vert edge scroll off\n"); priv->vert_scroll_edge_on = FALSE; } if (priv->horiz_scroll_edge_on && (!(edge & BOTTOM_EDGE) || !finger)) { - DBG(7, ErrorF("horiz edge scroll off\n")); + DBG(7, "horiz edge scroll off\n"); priv->horiz_scroll_edge_on = FALSE; } /* If we were corner edge scrolling (coasting), @@ -1892,7 +1887,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, ((edge & RIGHT_EDGE) && (edge & (TOP_EDGE | BOTTOM_EDGE))) || ((edge & BOTTOM_EDGE) && (edge & (LEFT_EDGE | RIGHT_EDGE))) ; if (!is_in_corner || !finger) { - DBG(7, ErrorF("corner edge scroll off\n")); + DBG(7, "corner edge scroll off\n"); stop_coasting(priv); } } @@ -1915,7 +1910,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, /* FYI: We can generate multiple start_coasting requests if * we're in the corner, but we were moving so slowly when we * got here that we didn't actually start coasting. */ - DBG(7, ErrorF("corner edge scroll on\n")); + DBG(7, "corner edge scroll on\n"); start_coasting(priv, hw, edge, TRUE); } } else if (para->circular_scrolling) { @@ -1923,7 +1918,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, priv->circ_scroll_on = TRUE; priv->circ_scroll_vert = TRUE; priv->scroll_a = angle(priv, hw->x, hw->y); - DBG(7, ErrorF("switching to circular scrolling\n")); + DBG(7, "switching to circular scrolling\n"); } } /* Same treatment for horizontal scrolling */ @@ -1934,7 +1929,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, /* FYI: We can generate multiple start_coasting requests if * we're in the corner, but we were moving so slowly when we * got here that we didn't actually start coasting. */ - DBG(7, ErrorF("corner edge scroll on\n")); + DBG(7, "corner edge scroll on\n"); start_coasting(priv, hw, edge, FALSE); } } else if (para->circular_scrolling) { @@ -1942,7 +1937,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, priv->circ_scroll_on = TRUE; priv->circ_scroll_vert = FALSE; priv->scroll_a = angle(priv, hw->x, hw->y); - DBG(7, ErrorF("switching to circular scrolling\n")); + DBG(7, "switching to circular scrolling\n"); } } @@ -2317,7 +2312,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw) static int ControlProc(LocalDevicePtr local, xDeviceCtl * control) { - DBG(3, ErrorF("Control Proc called\n")); + DBG(3, "Control Proc called\n"); return Success; } @@ -2325,13 +2320,13 @@ ControlProc(LocalDevicePtr local, xDeviceCtl * control) static void CloseProc(LocalDevicePtr local) { - DBG(3, ErrorF("Close Proc called\n")); + DBG(3, "Close Proc called\n"); } static int SwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) { - ErrorF("SwitchMode called\n"); + DBG(3, "SwitchMode called\n"); return Success; } diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 2986173..bd19c79 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -24,6 +24,17 @@ #include "synproto.h" +#ifdef DBG +# undef DBG +#endif + +#ifdef DEBUG +#define DBG(verb, ...) \ + xf86MsgVerb(X_INFO, verb, __VA_ARGS__) +#else +#define DBG(verb, msg, ...) /* */ +#endif + /****************************************************************************** * Definitions * structs, typedefs, #defines, enums |