Commit 015fdaa9 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

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: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tested-by: default avatarJason Ekstrand <jason@jlekstrand.net>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c4bbb398
...@@ -116,6 +116,7 @@ struct mt_device { ...@@ -116,6 +116,7 @@ struct mt_device {
__u8 touches_by_report; /* how many touches are present in one report: __u8 touches_by_report; /* how many touches are present in one report:
* 1 means we should use a serial protocol * 1 means we should use a serial protocol
* > 1 means hybrid (multitouch) protocol */ * > 1 means hybrid (multitouch) protocol */
__u8 buttons_count; /* number of physical buttons per touchpad */
bool serial_maybe; /* need to check for serial protocol */ bool serial_maybe; /* need to check for serial protocol */
bool curvalid; /* is the current contact valid? */ bool curvalid; /* is the current contact valid? */
unsigned mt_flags; /* flags to pass to input-mt */ 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,6 +380,10 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
td->inputmode_value = MT_INPUTMODE_TOUCHPAD; td->inputmode_value = MT_INPUTMODE_TOUCHPAD;
} }
/* count the buttons on touchpads */
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
td->buttons_count++;
if (usage->usage_index) if (usage->usage_index)
prev_usage = &field->usage[usage->usage_index - 1]; prev_usage = &field->usage[usage->usage_index - 1];
...@@ -728,6 +733,10 @@ static void mt_touch_input_configured(struct hid_device *hdev, ...@@ -728,6 +733,10 @@ static void mt_touch_input_configured(struct hid_device *hdev,
if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
td->mt_flags |= INPUT_MT_DROP_UNUSED; td->mt_flags |= INPUT_MT_DROP_UNUSED;
/* check for clickpads */
if ((td->mt_flags & INPUT_MT_POINTER) && (td->buttons_count == 1))
__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
input_mt_init_slots(input, td->maxcontacts, td->mt_flags); input_mt_init_slots(input, td->maxcontacts, td->mt_flags);
td->mt_flags = 0; td->mt_flags = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment