summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-05-07 18:17:55 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-08 14:14:12 +1000
commitc3ab0ae4f3f04da7018173662ede174c97710c8a (patch)
treec224e3f79e55a4e75c74f37179dbdf9c5f26d6d4
parentc50dba0b04f2115a5d23ed4a785c101f9b26900b (diff)
Add model-specific edges for appletouch.
Needs around 8.5% to be useable. I created a table to iterate through the different products rather than using if/else branches. I can enumerate the appletouch product_ids, but I suspect they will all be around the same range (hence the PRODUCT_ANY). If another product id shows different behavior, we can just add an entry to the table as appropriate. I also changed the default eheight to be 5.4% to match the spec. Reported-by: Jeremy Huddleston <jeremyhu@freedesktop.org> Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--src/eventcomm.c25
-rw-r--r--src/synaptics.c6
-rw-r--r--src/synapticsstr.h3
3 files changed, 27 insertions, 7 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index a1c3aa2..2b0bf68 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -110,22 +110,37 @@ event_query_is_touchpad(int fd)
return TRUE;
}
+typedef struct {
+ short vendor;
+ short product;
+ enum TouchpadModel model;
+} model_lookup_t;
+#define PRODUCT_ANY 0x0000
+
+static model_lookup_t model_lookup_table[] = {
+ {0x0002, 0x0007, MODEL_SYNAPTICS},
+ {0x0002, 0x0008, MODEL_ALPS},
+ {0x05ac, PRODUCT_ANY, MODEL_APPLETOUCH},
+ {0x0, 0x0, 0x0}
+};
+
static void
event_query_info(LocalDevicePtr local)
{
SynapticsPrivate *priv = (SynapticsPrivate *)local->private;
short id[4];
int rc;
+ model_lookup_t *model_lookup;
SYSCALL(rc = ioctl(local->fd, EVIOCGID, id));
if (rc < 0)
return;
- if (id[ID_VENDOR] == 0x2 && id[ID_PRODUCT] == 0x7)
- priv->model = MODEL_SYNAPTICS;
- else if (id[ID_VENDOR] == 0x2 && id[ID_PRODUCT] == 0x8)
- priv->model = MODEL_ALPS;
-
+ for(model_lookup = model_lookup_table; model_lookup->vendor; model_lookup++) {
+ if(model_lookup->vendor == id[ID_VENDOR] &&
+ (model_lookup->product == id[ID_PRODUCT] || model_lookup->product == PRODUCT_ANY))
+ priv->model = model_lookup->model;
+ }
}
/* Query device for axis ranges */
diff --git a/src/synaptics.c b/src/synaptics.c
index fc2e0b8..cab7ab6 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -340,10 +340,14 @@ static void set_default_parameters(LocalDevicePtr local)
{
ewidth = width * .15;
eheight = height * .15;
+ } else if (priv->model == MODEL_APPLETOUCH)
+ {
+ ewidth = width * .085;
+ eheight = height * .085;
} else
{
ewidth = width * .04;
- eheight = height * .04;
+ eheight = height * .054;
}
l = priv->minx + ewidth;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index ca3d26e..945aa0d 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -82,7 +82,8 @@ enum TapButtonState {
enum TouchpadModel {
MODEL_UNKNOWN = 0,
MODEL_SYNAPTICS,
- MODEL_ALPS
+ MODEL_ALPS,
+ MODEL_APPLETOUCH
};
typedef struct _SynapticsParameters