[PATCH synaptics 2/5] Ensure delta computation does not go crazy

Chase Douglas chase.douglas at canonical.com
Wed Feb 1 15:50:16 PST 2012


I have seen this a couple times, but I haven't been able to catch it
when it starts. It's a feedback loop, so once you miss the entrance of
the loop, you can't see what really went wrong.

This patch papers over the issue for now.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/synaptics.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 34915a2..8db1467 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1975,6 +1975,14 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
 
     /* report edge speed as synthetic motion. Of course, it would be
      * cooler to report floats than to buffer, but anyway. */
+
+    /* FIXME: When these values go NaN, bad things happen. Root cause is unknown
+     * thus far though. */
+    if (isnan(priv->frac_x))
+        priv->frac_x = 0;
+    if (isnan(priv->frac_y))
+        priv->frac_y = 0;
+
     tmpf = *dx + x_edge_speed * dtime + priv->frac_x;
     priv->frac_x = modf(tmpf, &integral);
     *dx = integral;
-- 
1.7.8.3



More information about the xorg-devel mailing list