From 872fccb2f4214b99b82e74a8b9e90c9c5f0773c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sun, 11 Apr 2010 15:27:11 +0200 Subject: 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 --- src/capabilities.c | 10 ++++++++++ src/capabilities.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3