summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Bagwell <chris@cnpbagwell.com>2010-07-15 21:44:03 -0500
committerPeter Hutterer <peter.hutterer@who-t.net>2010-07-19 14:50:59 +1000
commitcc9d34155297a85fb214d76d4fc45f26cf41f5f3 (patch)
tree2f4531ab562804d64b1f083c213755baa5b93384
parentdf9b639cef416ce694aa0be1592f99a41a0ea554 (diff)
Make default checks for x, y, w, and p separate.
Some input devices will not return any ranges and current code seems geared towards those. It assumed if invalid X/Y ranges then that was only case for invalid W and Pressure. Synaptics kernel drivers have been returning valid X/Y/Z values but invalid 0/0 values for P. Split up checks to allow setting defaults for any combination of unspecified or invalid values. I also think there was a bug in older code. It seemed odd it was checking minx > maxx but miny < maxy. I changed both to ">=" so that it also catches kernel reports of 0/0 and logically invalid ranges (i.e. 6/6 or 9/1). Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/synaptics.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index ba7b4f4..6883a06 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -187,20 +187,47 @@ SynapticsDefaultDimensions(LocalDevicePtr local)
{
SynapticsPrivate *priv = (SynapticsPrivate *)local->private;
- priv->minx = 1615;
- priv->maxx = 5685;
- priv->resx = 0;
+ if (priv->minx >= priv->maxx)
+ {
+ priv->minx = 1615;
+ priv->maxx = 5685;
+ priv->resx = 0;
+
+ xf86Msg(X_PROBED,
+ "%s: invalid x-axis range. defaulting to %d - %d\n",
+ local->name, priv->minx, priv->maxx);
+ }
- priv->miny = 1729;
- priv->maxy = 4171;
- priv->resx = 0;
+ if (priv->miny >= priv->maxy)
+ {
+ priv->miny = 1729;
+ priv->maxy = 4171;
+ priv->resx = 0;
- priv->minp = 0;
- priv->maxp = 256;
+ xf86Msg(X_PROBED,
+ "%s: invalid y-axis range. defaulting to %d - %d\n",
+ local->name, priv->miny, priv->maxy);
+ }
- priv->minw = 0;
- priv->maxw = 16;
+ if (priv->minp >= priv->maxp)
+ {
+ priv->minp = 0;
+ priv->maxp = 256;
+ xf86Msg(X_PROBED,
+ "%s: invalid pressure range. defaulting to %d - %d\n",
+ local->name, priv->minp, priv->maxp);
+ }
+
+ if (priv->minw >= priv->maxw)
+ {
+ priv->minw = 0;
+ priv->maxw = 16;
+
+ xf86Msg(X_PROBED,
+ "%s: invalid finger width range. defaulting to %d - %d\n",
+ local->name, priv->minw, priv->maxw);
+ }
}
static void
@@ -414,8 +441,7 @@ static void set_default_parameters(LocalDevicePtr local)
* If the range was autodetected, apply these edge widths to all four
* sides.
*/
- if (priv->minx > priv->maxx || priv->miny < priv->maxy)
- SynapticsDefaultDimensions(local);
+ SynapticsDefaultDimensions(local);
width = abs(priv->maxx - priv->minx);
height = abs(priv->maxy - priv->miny);