aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2015-03-06 11:14:42 -0500
committerJiri Kosina <jkosina@suse.cz>2015-03-06 16:54:01 -0500
commit015fdaa9f8edd89a456b3331088e1b77ebdad9d0 (patch)
tree021bb337d4a5a1225dfc3ae2815a13c9e0f14841
parentc4bbb39806cf4098d7a01a779b40171047004046 (diff)
HID: multitouch: add support of clickpads
Touchpads that have only one button are called clickpads and should be advertised as such by the kernel. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-multitouch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index f65e78b46999..ef06dc30b9b1 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -116,6 +116,7 @@ struct mt_device {
116 __u8 touches_by_report; /* how many touches are present in one report: 116 __u8 touches_by_report; /* how many touches are present in one report:
117 * 1 means we should use a serial protocol 117 * 1 means we should use a serial protocol
118 * > 1 means hybrid (multitouch) protocol */ 118 * > 1 means hybrid (multitouch) protocol */
119 __u8 buttons_count; /* number of physical buttons per touchpad */
119 bool serial_maybe; /* need to check for serial protocol */ 120 bool serial_maybe; /* need to check for serial protocol */
120 bool curvalid; /* is the current contact valid? */ 121 bool curvalid; /* is the current contact valid? */
121 unsigned mt_flags; /* flags to pass to input-mt */ 122 unsigned mt_flags; /* flags to pass to input-mt */
@@ -379,6 +380,10 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
379 td->inputmode_value = MT_INPUTMODE_TOUCHPAD; 380 td->inputmode_value = MT_INPUTMODE_TOUCHPAD;
380 } 381 }
381 382
383 /* count the buttons on touchpads */
384 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
385 td->buttons_count++;
386
382 if (usage->usage_index) 387 if (usage->usage_index)
383 prev_usage = &field->usage[usage->usage_index - 1]; 388 prev_usage = &field->usage[usage->usage_index - 1];
384 389
@@ -728,6 +733,10 @@ static void mt_touch_input_configured(struct hid_device *hdev,
728 if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) 733 if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
729 td->mt_flags |= INPUT_MT_DROP_UNUSED; 734 td->mt_flags |= INPUT_MT_DROP_UNUSED;
730 735
736 /* check for clickpads */
737 if ((td->mt_flags & INPUT_MT_POINTER) && (td->buttons_count == 1))
738 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
739
731 input_mt_init_slots(input, td->maxcontacts, td->mt_flags); 740 input_mt_init_slots(input, td->maxcontacts, td->mt_flags);
732 741
733 td->mt_flags = 0; 742 td->mt_flags = 0;