summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-04-11 15:27:11 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-04-15 06:10:08 +0200
commit872fccb2f4214b99b82e74a8b9e90c9c5f0773c1 (patch)
tree36c10114e7c9624497916dd2499bbe8a606d87fb /src
parenta493e814663ddcb6353673e366bf61285b1695b5 (diff)
Add integrated button property to capabilities
The new Apple unibody macbooks have a trackpad with an integrated button, which needs special treatment. This patch tests the device for an integrated button and keeps the result in the capabilities struture. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src')
-rw-r--r--src/capabilities.c10
-rw-r--r--src/capabilities.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/capabilities.c b/src/capabilities.c
index 804b626..065c810 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -47,6 +47,14 @@ static int getabs(struct input_absinfo *abs, int key, int fd)
return rc >= 0;
}
+static int has_integrated_button(const struct Capabilities *cap)
+{
+ static const int bcm5974_vmask_ibt = 1;
+ if (strcmp(cap->devname, "bcm5974"))
+ return 0;
+ return cap->devid.version & bcm5974_vmask_ibt;
+}
+
int read_capabilities(struct Capabilities *cap, int fd)
{
unsigned long evbits[nlongs(EV_MAX)];
@@ -85,6 +93,7 @@ int read_capabilities(struct Capabilities *cap, int fd)
SETABS(cap, position_y, absbits, ABS_MT_POSITION_Y, fd);
cap->has_mtdata = cap->has_position_x && cap->has_position_y;
+ cap->has_ibt = has_integrated_button(cap);
cap->xfuzz = cap->abs_position_x.fuzz;
cap->yfuzz = cap->abs_position_y.fuzz;
@@ -114,6 +123,7 @@ void output_capabilities(const struct Capabilities *cap)
ADDCAP(line, cap, middle);
ADDCAP(line, cap, right);
ADDCAP(line, cap, mtdata);
+ ADDCAP(line, cap, ibt);
ADDCAP(line, cap, touch_major);
ADDCAP(line, cap, touch_minor);
ADDCAP(line, cap, width_major);
diff --git a/src/capabilities.h b/src/capabilities.h
index 68835c6..34c1767 100644
--- a/src/capabilities.h
+++ b/src/capabilities.h
@@ -28,7 +28,7 @@ struct Capabilities {
struct input_id devid;
char devname[32];
int has_left, has_middle;
- int has_right, has_mtdata;
+ int has_right, has_mtdata, has_ibt;
int has_touch_major, has_touch_minor;
int has_width_major, has_width_minor;
int has_orientation, has_dummy;