diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-04-11 15:27:11 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-04-15 06:10:08 +0200 |
| commit | 872fccb2f4214b99b82e74a8b9e90c9c5f0773c1 (patch) | |
| tree | 36c10114e7c9624497916dd2499bbe8a606d87fb /src/capabilities.c | |
| parent | a493e814663ddcb6353673e366bf61285b1695b5 (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/capabilities.c')
| -rw-r--r-- | src/capabilities.c | 10 |
1 files changed, 10 insertions, 0 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) | |||
| 47 | return rc >= 0; | 47 | return rc >= 0; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static int has_integrated_button(const struct Capabilities *cap) | ||
| 51 | { | ||
| 52 | static const int bcm5974_vmask_ibt = 1; | ||
| 53 | if (strcmp(cap->devname, "bcm5974")) | ||
| 54 | return 0; | ||
| 55 | return cap->devid.version & bcm5974_vmask_ibt; | ||
| 56 | } | ||
| 57 | |||
| 50 | int read_capabilities(struct Capabilities *cap, int fd) | 58 | int read_capabilities(struct Capabilities *cap, int fd) |
| 51 | { | 59 | { |
| 52 | unsigned long evbits[nlongs(EV_MAX)]; | 60 | unsigned long evbits[nlongs(EV_MAX)]; |
| @@ -85,6 +93,7 @@ int read_capabilities(struct Capabilities *cap, int fd) | |||
| 85 | SETABS(cap, position_y, absbits, ABS_MT_POSITION_Y, fd); | 93 | SETABS(cap, position_y, absbits, ABS_MT_POSITION_Y, fd); |
| 86 | 94 | ||
| 87 | cap->has_mtdata = cap->has_position_x && cap->has_position_y; | 95 | cap->has_mtdata = cap->has_position_x && cap->has_position_y; |
| 96 | cap->has_ibt = has_integrated_button(cap); | ||
| 88 | 97 | ||
| 89 | cap->xfuzz = cap->abs_position_x.fuzz; | 98 | cap->xfuzz = cap->abs_position_x.fuzz; |
| 90 | cap->yfuzz = cap->abs_position_y.fuzz; | 99 | cap->yfuzz = cap->abs_position_y.fuzz; |
| @@ -114,6 +123,7 @@ void output_capabilities(const struct Capabilities *cap) | |||
| 114 | ADDCAP(line, cap, middle); | 123 | ADDCAP(line, cap, middle); |
| 115 | ADDCAP(line, cap, right); | 124 | ADDCAP(line, cap, right); |
| 116 | ADDCAP(line, cap, mtdata); | 125 | ADDCAP(line, cap, mtdata); |
| 126 | ADDCAP(line, cap, ibt); | ||
| 117 | ADDCAP(line, cap, touch_major); | 127 | ADDCAP(line, cap, touch_major); |
| 118 | ADDCAP(line, cap, touch_minor); | 128 | ADDCAP(line, cap, touch_minor); |
| 119 | ADDCAP(line, cap, width_major); | 129 | ADDCAP(line, cap, width_major); |
