Commit e0976a61 authored by Kerem Karabay's avatar Kerem Karabay Committed by Jiri Kosina
Browse files

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 c2ef8f21
("HID: multitouch: add support for trackpads").

Acked-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
Signed-off-by: default avatarKerem Karabay <kekrby@gmail.com>
Co-developed-by: default avatarAditya Garg <gargaditya08@live.com>
Signed-off-by: default avatarAditya Garg <gargaditya08@live.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
parent f41d736a
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -827,6 +827,17 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,

			MT_STORE_FIELD(confidence_state);
			return 1;
		case HID_DG_TOUCH:
			/*
			 * Legacy devices use TIPSWITCH and not TOUCH.
			 * One special case here is of the Apple Touch Bars.
			 * In these devices, the tip state is contained in
			 * fields with the HID_DG_TOUCH usage.
			 * Let's just ignore this field for other devices.
			 */
			if (!(cls->quirks & MT_QUIRK_APPLE_TOUCHBAR))
				return -1;
			fallthrough;
		case HID_DG_TIPSWITCH:
			if (field->application != HID_GD_SYSTEM_MULTIAXIS)
				input_set_capability(hi->input,
@@ -897,10 +908,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		case HID_DG_CONTACTMAX:
			/* contact max are global to the report */
			return -1;
		case HID_DG_TOUCH:
			/* Legacy devices use TIPSWITCH and not TOUCH.
			 * Let's just ignore this field. */
			return -1;
		}
		/* let hid-input decide for the others */
		return 0;