Skip to content

Commit e0976a6

Browse files
kekrbyJiri Kosina
authored andcommitted
HID: multitouch: support getting the tip state from HID_DG_TOUCH fields in Apple Touch Bar
In Apple Touch Bar, the tip state is contained in fields with the HID_DG_TOUCH usage. This feature is gated by a quirk in order to prevent breaking other devices, see commit c2ef8f2 ("HID: multitouch: add support for trackpads"). Acked-by: Benjamin Tissoires <[email protected]> Signed-off-by: Kerem Karabay <[email protected]> Co-developed-by: Aditya Garg <[email protected]> Signed-off-by: Aditya Garg <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f41d736 commit e0976a6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,17 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
827827

828828
MT_STORE_FIELD(confidence_state);
829829
return 1;
830+
case HID_DG_TOUCH:
831+
/*
832+
* Legacy devices use TIPSWITCH and not TOUCH.
833+
* One special case here is of the Apple Touch Bars.
834+
* In these devices, the tip state is contained in
835+
* fields with the HID_DG_TOUCH usage.
836+
* Let's just ignore this field for other devices.
837+
*/
838+
if (!(cls->quirks & MT_QUIRK_APPLE_TOUCHBAR))
839+
return -1;
840+
fallthrough;
830841
case HID_DG_TIPSWITCH:
831842
if (field->application != HID_GD_SYSTEM_MULTIAXIS)
832843
input_set_capability(hi->input,
@@ -897,10 +908,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
897908
case HID_DG_CONTACTMAX:
898909
/* contact max are global to the report */
899910
return -1;
900-
case HID_DG_TOUCH:
901-
/* Legacy devices use TIPSWITCH and not TOUCH.
902-
* Let's just ignore this field. */
903-
return -1;
904911
}
905912
/* let hid-input decide for the others */
906913
return 0;

0 commit comments

Comments
 (0)