summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-02-02 13:19:15 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2012-02-04 23:45:43 +1000
commit0c83d1f9a71a4fef38f7f8d46c2646c36e92d5f6 (patch)
treea5025c104571319c82362a873e60b47392d0a934
parent53adb8399d468d429cd879516aa24a8420f60f60 (diff)
Ensure delta computation does not go crazy
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@canonical.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/synaptics.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 1d963cb..907f054 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;