Skip to content

Commit 015fdaa

Browse files
bentissJiri Kosina
authored andcommitted
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 <[email protected]> Tested-by: Jason Ekstrand <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent c4bbb39 commit 015fdaa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct mt_device {
116116
__u8 touches_by_report; /* how many touches are present in one report:
117117
* 1 means we should use a serial protocol
118118
* > 1 means hybrid (multitouch) protocol */
119+
__u8 buttons_count; /* number of physical buttons per touchpad */
119120
bool serial_maybe; /* need to check for serial protocol */
120121
bool curvalid; /* is the current contact valid? */
121122
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,
379380
td->inputmode_value = MT_INPUTMODE_TOUCHPAD;
380381
}
381382

383+
/* count the buttons on touchpads */
384+
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
385+
td->buttons_count++;
386+
382387
if (usage->usage_index)
383388
prev_usage = &field->usage[usage->usage_index - 1];
384389

@@ -728,6 +733,10 @@ static void mt_touch_input_configured(struct hid_device *hdev,
728733
if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
729734
td->mt_flags |= INPUT_MT_DROP_UNUSED;
730735

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+
731740
input_mt_init_slots(input, td->maxcontacts, td->mt_flags);
732741

733742
td->mt_flags = 0;

0 commit comments

Comments
 (0)