linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping
@ 2020-04-28 14:22 Hans de Goede
  2020-04-28 14:22 ` [PATCH 2/6] HID: asus: Simplify skipping of mappings for Asus T100CHI keyboard-dock Hans de Goede
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Hans de Goede @ 2020-04-28 14:22 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input

Make asus_input_mapping() only set EV_REP if we are adding a mapping.

The T100CHI bluetooth keyboard dock has a few input reports for which
we do not create any mappings (these input-reports are present in the
descriptors but never send).

The hid-asus code relies on the HID core not creating input devices for
input-reports without any mappings. But the present of the EV_REP but
counts as a mapping causing 6 /dev/input/event# nodes to be created for
the T100CHI bluetooth keyboard dock. This change brings the amount of
created /dev/input/event# nodes / input-devices down to 4.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-asus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index e6e4c841fb06..ac224c32eeb6 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -694,7 +694,6 @@ static int asus_input_mapping(struct hid_device *hdev,
 
 	/* ASUS-specific keyboard hotkeys */
 	if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
-		set_bit(EV_REP, hi->input->evbit);
 		switch (usage->hid & HID_USAGE) {
 		case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN);	break;
 		case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP);		break;
@@ -737,11 +736,11 @@ static int asus_input_mapping(struct hid_device *hdev,
 		if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT)
 			drvdata->enable_backlight = true;
 
+		set_bit(EV_REP, hi->input->evbit);
 		return 1;
 	}
 
 	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) {
-		set_bit(EV_REP, hi->input->evbit);
 		switch (usage->hid & HID_USAGE) {
 		case 0xff01: asus_map_key_clear(BTN_1);	break;
 		case 0xff02: asus_map_key_clear(BTN_2);	break;
@@ -764,6 +763,7 @@ static int asus_input_mapping(struct hid_device *hdev,
 			return 0;
 		}
 
+		set_bit(EV_REP, hi->input->evbit);
 		return 1;
 	}
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] HID: asus: Simplify skipping of mappings for Asus T100CHI keyboard-dock
  2020-04-28 14:22 [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping Hans de Goede
@ 2020-04-28 14:22 ` Hans de Goede
  2020-04-28 14:22 ` [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check Hans de Goede
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2020-04-28 14:22 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input

Before this commit the code was trying to keep the mapping for the
left mouse-button, do avoid the hidinput_has_been_populated() check
in hid-input.c from triggering and causing the touchpad input_dev ro
get cleaned up.

But the hidinput_has_been_populated() check happens after the
input_configured callback which sets up all the input bit for the
touchpad, so there is no need to preserve the left button mapping.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-asus.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index ac224c32eeb6..b3292ff3f61a 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -677,20 +677,13 @@ static int asus_input_mapping(struct hid_device *hdev,
 	 * This avoids a bunch of non-functional hid_input devices getting
 	 * created because of the T100CHI using HID_QUIRK_MULTI_INPUT.
 	 */
-	if (drvdata->quirks & (QUIRK_T100CHI | QUIRK_T90CHI)) {
-		if (field->application == (HID_UP_GENDESK | 0x0080) ||
-		    usage->hid == (HID_UP_GENDEVCTRLS | 0x0024) ||
-		    usage->hid == (HID_UP_GENDEVCTRLS | 0x0025) ||
-		    usage->hid == (HID_UP_GENDEVCTRLS | 0x0026))
-			return -1;
-		/*
-		 * We use the hid_input for the mouse report for the touchpad,
-		 * keep the left button, to avoid the core removing it.
-		 */
-		if (field->application == HID_GD_MOUSE &&
-		    usage->hid != (HID_UP_BUTTON | 1))
-			return -1;
-	}
+	if ((drvdata->quirks & (QUIRK_T100CHI | QUIRK_T90CHI)) &&
+	    (field->application == (HID_UP_GENDESK | 0x0080) ||
+	     field->application == HID_GD_MOUSE ||
+	     usage->hid == (HID_UP_GENDEVCTRLS | 0x0024) ||
+	     usage->hid == (HID_UP_GENDEVCTRLS | 0x0025) ||
+	     usage->hid == (HID_UP_GENDEVCTRLS | 0x0026)))
+		return -1;
 
 	/* ASUS-specific keyboard hotkeys */
 	if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check
  2020-04-28 14:22 [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping Hans de Goede
  2020-04-28 14:22 ` [PATCH 2/6] HID: asus: Simplify skipping of mappings for Asus T100CHI keyboard-dock Hans de Goede
@ 2020-04-28 14:22 ` Hans de Goede
  2020-05-05 14:32   ` Jiri Kosina
  2020-04-28 14:22 ` [PATCH 4/6] HID: asus: Add report_size to struct asus_touchpad_info Hans de Goede
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Hans de Goede @ 2020-04-28 14:22 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input

Add a hid_is_using_ll_driver(usb_hid_driver) check to ensure that the
parent device is an usb_interface, before casting the parent device
pointer to an usb_interface pointer with to_usb_interface().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-asus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index b3292ff3f61a..719eff589f92 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -842,7 +842,8 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
 		drvdata->tp = &asus_i2c_tp;
 
-	if (drvdata->quirks & QUIRK_T100_KEYBOARD) {
+	if ((drvdata->quirks & QUIRK_T100_KEYBOARD) &&
+	    hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
 		struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
 
 		if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) {
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] HID: asus: Add report_size to struct asus_touchpad_info
  2020-04-28 14:22 [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping Hans de Goede
  2020-04-28 14:22 ` [PATCH 2/6] HID: asus: Simplify skipping of mappings for Asus T100CHI keyboard-dock Hans de Goede
  2020-04-28 14:22 ` [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check Hans de Goede
@ 2020-04-28 14:22 ` Hans de Goede
  2020-04-28 14:22 ` [PATCH 5/6] HID: asus: Add support for multi-touch touchpad on Medion Akoya E1239T Hans de Goede
  2020-04-28 14:22 ` [PATCH 6/6] HID: asus: Fix mute and touchpad-toggle keys " Hans de Goede
  4 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2020-04-28 14:22 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input

Add the report_size to struct asus_touchpad_info instead of calculating it.

This is a preparation patch for adding support for the multi-touch touchpad
found on the Medion Akoya E1239T's keyboard-dock, which uses the same
custom multi-touch protocol as the Asus keyboard-docks (same chipset
vendor, Integrated Technology Express / ITE).

The only difference in that the Akoya E1239T keyboard-dock's input-reports
have a 5 byte footer instead of a 1 byte footer, which requires the
report_size to be configurable per touchpad-model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-asus.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 719eff589f92..6d97dbbcc287 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -102,6 +102,7 @@ struct asus_touchpad_info {
 	int res_y;
 	int contact_size;
 	int max_contacts;
+	int report_size;
 };
 
 struct asus_drvdata {
@@ -126,6 +127,7 @@ static const struct asus_touchpad_info asus_i2c_tp = {
 	.max_y = 1758,
 	.contact_size = 5,
 	.max_contacts = 5,
+	.report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
 };
 
 static const struct asus_touchpad_info asus_t100ta_tp = {
@@ -135,6 +137,7 @@ static const struct asus_touchpad_info asus_t100ta_tp = {
 	.res_y = 27, /* units/mm */
 	.contact_size = 5,
 	.max_contacts = 5,
+	.report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
 };
 
 static const struct asus_touchpad_info asus_t100ha_tp = {
@@ -144,6 +147,7 @@ static const struct asus_touchpad_info asus_t100ha_tp = {
 	.res_y = 29, /* units/mm */
 	.contact_size = 5,
 	.max_contacts = 5,
+	.report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
 };
 
 static const struct asus_touchpad_info asus_t200ta_tp = {
@@ -153,6 +157,7 @@ static const struct asus_touchpad_info asus_t200ta_tp = {
 	.res_y = 28, /* units/mm */
 	.contact_size = 5,
 	.max_contacts = 5,
+	.report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
 };
 
 static const struct asus_touchpad_info asus_t100chi_tp = {
@@ -162,6 +167,7 @@ static const struct asus_touchpad_info asus_t100chi_tp = {
 	.res_y = 29, /* units/mm */
 	.contact_size = 3,
 	.max_contacts = 4,
+	.report_size = 15 /* 2 byte header + 3 * 4 + 1 byte footer */,
 };
 
 static void asus_report_contact_down(struct asus_drvdata *drvdat,
@@ -229,7 +235,7 @@ static int asus_report_input(struct asus_drvdata *drvdat, u8 *data, int size)
 	int i, toolType = MT_TOOL_FINGER;
 	u8 *contactData = data + 2;
 
-	if (size != 3 + drvdat->tp->contact_size * drvdat->tp->max_contacts)
+	if (size != drvdat->tp->report_size)
 		return 0;
 
 	for (i = 0; i < drvdat->tp->max_contacts; i++) {
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] HID: asus: Add support for multi-touch touchpad on Medion Akoya E1239T
  2020-04-28 14:22 [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping Hans de Goede
                   ` (2 preceding siblings ...)
  2020-04-28 14:22 ` [PATCH 4/6] HID: asus: Add report_size to struct asus_touchpad_info Hans de Goede
@ 2020-04-28 14:22 ` Hans de Goede
  2020-04-28 14:22 ` [PATCH 6/6] HID: asus: Fix mute and touchpad-toggle keys " Hans de Goede
  4 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2020-04-28 14:22 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input

The multi-touch touchpad found on the Medion Akoya E1239T's keyboard-dock,
uses the same custom multi-touch protocol as the Asus keyboard-docks
(same chipset vendor, Integrated Technology Express / ITE).

Add support for this using the existing multi-touch touchpad support in
the hid-asus driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-asus.c | 26 +++++++++++++++++++++++++-
 drivers/hid/hid-ids.h  |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 6d97dbbcc287..317d7392ca8b 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -40,6 +40,7 @@ MODULE_AUTHOR("Frederik Wenigwieser <frederik.wenigwieser@gmail.com>");
 MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 
 #define T100_TPAD_INTF 2
+#define MEDION_E1239T_TPAD_INTF 1
 
 #define T100CHI_MOUSE_REPORT_ID 0x06
 #define FEATURE_REPORT_ID 0x0d
@@ -77,6 +78,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 #define QUIRK_G752_KEYBOARD		BIT(8)
 #define QUIRK_T101HA_DOCK		BIT(9)
 #define QUIRK_T90CHI			BIT(10)
+#define QUIRK_MEDION_E1239T		BIT(11)
 
 #define I2C_KEYBOARD_QUIRKS			(QUIRK_FIX_NOTEBOOK_REPORT | \
 						 QUIRK_NO_INIT_REPORTS | \
@@ -170,6 +172,16 @@ static const struct asus_touchpad_info asus_t100chi_tp = {
 	.report_size = 15 /* 2 byte header + 3 * 4 + 1 byte footer */,
 };
 
+static const struct asus_touchpad_info medion_e1239t_tp = {
+	.max_x = 2640,
+	.max_y = 1380,
+	.res_x = 29, /* units/mm */
+	.res_y = 28, /* units/mm */
+	.contact_size = 5,
+	.max_contacts = 5,
+	.report_size = 32 /* 2 byte header + 5 * 5 + 5 byte footer */,
+};
+
 static void asus_report_contact_down(struct asus_drvdata *drvdat,
 		int toolType, u8 *data)
 {
@@ -877,6 +889,17 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		drvdata->tp = &asus_t100chi_tp;
 	}
 
+	if ((drvdata->quirks & QUIRK_MEDION_E1239T) &&
+	    hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
+		struct usb_host_interface *alt =
+			to_usb_interface(hdev->dev.parent)->altsetting;
+
+		if (alt->desc.bInterfaceNumber == MEDION_E1239T_TPAD_INTF) {
+			drvdata->quirks |= QUIRK_SKIP_INPUT_MAPPING;
+			drvdata->tp = &medion_e1239t_tp;
+		}
+	}
+
 	if (drvdata->quirks & QUIRK_NO_INIT_REPORTS)
 		hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
 
@@ -1056,7 +1079,8 @@ static const struct hid_device_id asus_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK,
 		USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI },
-
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE_MEDION_E1239T),
+		QUIRK_MEDION_E1239T },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, asus_devices);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index b18b13147a6f..2efa823a87e4 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -639,6 +639,7 @@
 #define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720	0x837a
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900	0x8396
 #define USB_DEVICE_ID_ITE8595		0x8595
+#define USB_DEVICE_ID_ITE_MEDION_E1239T	0xce50
 
 #define USB_VENDOR_ID_JABRA		0x0b0e
 #define USB_DEVICE_ID_JABRA_SPEAK_410	0x0412
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] HID: asus: Fix mute and touchpad-toggle keys on Medion Akoya E1239T
  2020-04-28 14:22 [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping Hans de Goede
                   ` (3 preceding siblings ...)
  2020-04-28 14:22 ` [PATCH 5/6] HID: asus: Add support for multi-touch touchpad on Medion Akoya E1239T Hans de Goede
@ 2020-04-28 14:22 ` Hans de Goede
  4 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2020-04-28 14:22 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input

The mute key, is broken. All the consumer keys on the keyboard USB
interface work normally, except for mute which only sends press events
and never sends release events.

The touchpad key sends the otherwise unused input report with a report-id
of 5 on the touchpad interface. It too only sends press events. This also
requires extra special handling since the multi-touch touchpad events and
the KEY_F21 events for the touchpad toggle must not be send from the same
input_dev (userspace cannot handle this).

This commit adds special handlig for both, fixing these keys not working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-asus.c | 60 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 317d7392ca8b..c183caf89d49 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -42,6 +42,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 #define T100_TPAD_INTF 2
 #define MEDION_E1239T_TPAD_INTF 1
 
+#define E1239T_TP_TOGGLE_REPORT_ID 0x05
 #define T100CHI_MOUSE_REPORT_ID 0x06
 #define FEATURE_REPORT_ID 0x0d
 #define INPUT_REPORT_ID 0x5d
@@ -111,6 +112,7 @@ struct asus_drvdata {
 	unsigned long quirks;
 	struct hid_device *hdev;
 	struct input_dev *input;
+	struct input_dev *tp_kbd_input;
 	struct asus_kbd_leds *kbd_backlight;
 	const struct asus_touchpad_info *tp;
 	bool enable_backlight;
@@ -275,6 +277,34 @@ static int asus_report_input(struct asus_drvdata *drvdat, u8 *data, int size)
 	return 1;
 }
 
+static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
+{
+	if (size != 3)
+		return 0;
+
+	/* Handle broken mute key which only sends press events */
+	if (!drvdat->tp &&
+	    data[0] == 0x02 && data[1] == 0xe2 && data[2] == 0x00) {
+		input_report_key(drvdat->input, KEY_MUTE, 1);
+		input_sync(drvdat->input);
+		input_report_key(drvdat->input, KEY_MUTE, 0);
+		input_sync(drvdat->input);
+		return 1;
+	}
+
+	/* Handle custom touchpad toggle key which only sends press events */
+	if (drvdat->tp_kbd_input &&
+	    data[0] == 0x05 && data[1] == 0x02 && data[2] == 0x28) {
+		input_report_key(drvdat->tp_kbd_input, KEY_F21, 1);
+		input_sync(drvdat->tp_kbd_input);
+		input_report_key(drvdat->tp_kbd_input, KEY_F21, 0);
+		input_sync(drvdat->tp_kbd_input);
+		return 1;
+	}
+
+	return 0;
+}
+
 static int asus_event(struct hid_device *hdev, struct hid_field *field,
 		      struct hid_usage *usage, __s32 value)
 {
@@ -299,6 +329,9 @@ static int asus_raw_event(struct hid_device *hdev,
 	if (drvdata->tp && data[0] == INPUT_REPORT_ID)
 		return asus_report_input(drvdata, data, size);
 
+	if (drvdata->quirks & QUIRK_MEDION_E1239T)
+		return asus_e1239t_event(drvdata, data, size);
+
 	return 0;
 }
 
@@ -633,6 +666,21 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
 	    hi->report->id != T100CHI_MOUSE_REPORT_ID)
 		return 0;
 
+	/* Handle MULTI_INPUT on E1239T mouse/touchpad USB interface */
+	if (drvdata->tp && (drvdata->quirks & QUIRK_MEDION_E1239T)) {
+		switch (hi->report->id) {
+		case E1239T_TP_TOGGLE_REPORT_ID:
+			input_set_capability(input, EV_KEY, KEY_F21);
+			input->name = "Asus Touchpad Keys";
+			drvdata->tp_kbd_input = input;
+			return 0;
+		case INPUT_REPORT_ID:
+			break; /* Touchpad report, handled below */
+		default:
+			return 0; /* Ignore other reports */
+		}
+	}
+
 	if (drvdata->tp) {
 		int ret;
 
@@ -793,6 +841,16 @@ static int asus_input_mapping(struct hid_device *hdev,
 		}
 	}
 
+	/*
+	 * The mute button is broken and only sends press events, we
+	 * deal with this in our raw_event handler, so do not map it.
+	 */
+	if ((drvdata->quirks & QUIRK_MEDION_E1239T) &&
+	    usage->hid == (HID_UP_CONSUMER | 0xe2)) {
+		input_set_capability(hi->input, EV_KEY, KEY_MUTE);
+		return -1;
+	}
+
 	return 0;
 }
 
@@ -895,6 +953,8 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
 			to_usb_interface(hdev->dev.parent)->altsetting;
 
 		if (alt->desc.bInterfaceNumber == MEDION_E1239T_TPAD_INTF) {
+			/* For separate input-devs for tp and tp toggle key */
+			hdev->quirks |= HID_QUIRK_MULTI_INPUT;
 			drvdata->quirks |= QUIRK_SKIP_INPUT_MAPPING;
 			drvdata->tp = &medion_e1239t_tp;
 		}
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check
  2020-04-28 14:22 ` [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check Hans de Goede
@ 2020-05-05 14:32   ` Jiri Kosina
  2020-05-06  8:41     ` Hans de Goede
  0 siblings, 1 reply; 9+ messages in thread
From: Jiri Kosina @ 2020-05-05 14:32 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Benjamin Tissoires, linux-input

On Tue, 28 Apr 2020, Hans de Goede wrote:

> Add a hid_is_using_ll_driver(usb_hid_driver) check to ensure that the
> parent device is an usb_interface, before casting the parent device
> pointer to an usb_interface pointer with to_usb_interface().
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/hid/hid-asus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index b3292ff3f61a..719eff589f92 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -842,7 +842,8 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  	if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
>  		drvdata->tp = &asus_i2c_tp;
>  
> -	if (drvdata->quirks & QUIRK_T100_KEYBOARD) {
> +	if ((drvdata->quirks & QUIRK_T100_KEYBOARD) &&
> +	    hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
>  		struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
>  

I am going to push the whole patchset to for-5.8/asus branch later today, 
but I guess this one should better be taken as 5.7 fix still, right?

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check
  2020-05-05 14:32   ` Jiri Kosina
@ 2020-05-06  8:41     ` Hans de Goede
  2020-05-06  9:42       ` Jiri Kosina
  0 siblings, 1 reply; 9+ messages in thread
From: Hans de Goede @ 2020-05-06  8:41 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Benjamin Tissoires, linux-input

Hi,

On 5/5/20 4:32 PM, Jiri Kosina wrote:
> On Tue, 28 Apr 2020, Hans de Goede wrote:
> 
>> Add a hid_is_using_ll_driver(usb_hid_driver) check to ensure that the
>> parent device is an usb_interface, before casting the parent device
>> pointer to an usb_interface pointer with to_usb_interface().
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/hid/hid-asus.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
>> index b3292ff3f61a..719eff589f92 100644
>> --- a/drivers/hid/hid-asus.c
>> +++ b/drivers/hid/hid-asus.c
>> @@ -842,7 +842,8 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
>>   	if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
>>   		drvdata->tp = &asus_i2c_tp;
>>   
>> -	if (drvdata->quirks & QUIRK_T100_KEYBOARD) {
>> +	if ((drvdata->quirks & QUIRK_T100_KEYBOARD) &&
>> +	    hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
>>   		struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
>>   
> 
> I am going to push the whole patchset to for-5.8/asus branch later today,

Thanks.

> but I guess this one should better be taken as 5.7 fix still, right?

I know that Benjamin has been insisting on these extra checks, which
is why I added it. But in practice not having the check does not really
seem to be a big issue, so whether to add it to 5.7.x or not is your call.

Regards,

Hans


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check
  2020-05-06  8:41     ` Hans de Goede
@ 2020-05-06  9:42       ` Jiri Kosina
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Kosina @ 2020-05-06  9:42 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Benjamin Tissoires, linux-input

On Wed, 6 May 2020, Hans de Goede wrote:

> >> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> >> index b3292ff3f61a..719eff589f92 100644
> >> --- a/drivers/hid/hid-asus.c
> >> +++ b/drivers/hid/hid-asus.c
> >> @@ -842,7 +842,8 @@ static int asus_probe(struct hid_device *hdev, const
> >> struct hid_device_id *id)
> >>    if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
> >>     drvdata->tp = &asus_i2c_tp;
> >>   -	if (drvdata->quirks & QUIRK_T100_KEYBOARD) {
> >> +	if ((drvdata->quirks & QUIRK_T100_KEYBOARD) &&
> >> +	    hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
> >>     struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
> >>   
> > 
> > I am going to push the whole patchset to for-5.8/asus branch later today,
> 
> Thanks.

Now pushed out, thanks.

> > but I guess this one should better be taken as 5.7 fix still, right?
> 
> I know that Benjamin has been insisting on these extra checks, which
> is why I added it. But in practice not having the check does not really
> seem to be a big issue, so whether to add it to 5.7.x or not is your call.

So I guess some wild device fuzzer might in theory be able to confuse it, 
but I don't immediately see how. So let's queue this all for 5.8.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-06  9:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 14:22 [PATCH 1/6] HID: asus: Only set EV_REP if we are adding a mapping Hans de Goede
2020-04-28 14:22 ` [PATCH 2/6] HID: asus: Simplify skipping of mappings for Asus T100CHI keyboard-dock Hans de Goede
2020-04-28 14:22 ` [PATCH 3/6] HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check Hans de Goede
2020-05-05 14:32   ` Jiri Kosina
2020-05-06  8:41     ` Hans de Goede
2020-05-06  9:42       ` Jiri Kosina
2020-04-28 14:22 ` [PATCH 4/6] HID: asus: Add report_size to struct asus_touchpad_info Hans de Goede
2020-04-28 14:22 ` [PATCH 5/6] HID: asus: Add support for multi-touch touchpad on Medion Akoya E1239T Hans de Goede
2020-04-28 14:22 ` [PATCH 6/6] HID: asus: Fix mute and touchpad-toggle keys " Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).