[PATCH xf86-input-synaptics v2 1/2] Add MODEL_UNIBODY_MACBOOK touchpad model for bcm5974 devices

Chase Douglas chase.douglas at canonical.com
Wed Jun 6 15:34:39 PDT 2012


Initially, treat them the same as MODEL_APPLETOUCH devices, as that is
what they were recognized as before.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/eventcomm.c    |   19 ++++++++++++++-----
 src/synaptics.c    |    3 ++-
 src/synapticsstr.h |    3 ++-
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index f253205..bba2336 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -280,15 +280,17 @@ event_query_is_touchpad(int fd, BOOL test_grab)
 struct model_lookup_t {
     short vendor;
     short product;
+    char *name;
     enum TouchpadModel model;
 };
 
 
 static struct model_lookup_t model_lookup_table[] = {
-    {0x0002, 0x0007, MODEL_SYNAPTICS},
-    {0x0002, 0x0008, MODEL_ALPS},
-    {0x05ac, PRODUCT_ANY, MODEL_APPLETOUCH},
-    {0x0002, 0x000e, MODEL_ELANTECH},
+    {0x0002, 0x0007, NULL, MODEL_SYNAPTICS},
+    {0x0002, 0x0008, NULL, MODEL_ALPS},
+    {0x05ac, PRODUCT_ANY, NULL, MODEL_APPLETOUCH},
+    {0x05ac, PRODUCT_ANY, "bcm5974", MODEL_UNIBODY_MACBOOK},
+    {0x0002, 0x000e, NULL, MODEL_ELANTECH},
     {0x0, 0x0, 0x0}
 };
 
@@ -309,16 +311,23 @@ event_query_model(int fd, enum TouchpadModel *model_out,
     struct input_id id;
     int rc;
     struct model_lookup_t *model_lookup;
+    char name[80];
 
     SYSCALL(rc = ioctl(fd, EVIOCGID, &id));
     if (rc < 0)
         return FALSE;
 
+    SYSCALL(rc = ioctl(fd, EVIOCGNAME(sizeof(name)), name));
+    if (rc < 0)
+        return FALSE;
+
     for (model_lookup = model_lookup_table; model_lookup->vendor;
          model_lookup++) {
         if (model_lookup->vendor == id.vendor &&
             (model_lookup->product == id.product ||
-             model_lookup->product == PRODUCT_ANY))
+             model_lookup->product == PRODUCT_ANY) &&
+            (!model_lookup->name ||
+             !strncmp(model_lookup->name, name, sizeof(name))))
             *model_out = model_lookup->model;
     }
 
diff --git a/src/synaptics.c b/src/synaptics.c
index b7d23b7..68d35e8 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -299,7 +299,8 @@ calculate_edge_widths(SynapticsPrivate * priv, int *l, int *r, int *t, int *b)
         ewidth = width * .15;
         eheight = height * .15;
     }
-    else if (priv->model == MODEL_APPLETOUCH) {
+    else if (priv->model == MODEL_APPLETOUCH ||
+             priv->model == MODEL_UNIBODY_MACBOOK) {
         ewidth = width * .085;
         eheight = height * .085;
     }
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index ef7b4f4..0acb2ec 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -123,7 +123,8 @@ enum TouchpadModel {
     MODEL_SYNAPTICS,
     MODEL_ALPS,
     MODEL_APPLETOUCH,
-    MODEL_ELANTECH
+    MODEL_ELANTECH,
+    MODEL_UNIBODY_MACBOOK
 };
 
 typedef struct _SynapticsParameters {
-- 
1.7.9.5



More information about the xorg-devel mailing list