diff mbox series

[1/3] HID: asus: Cleanup Asus T101HA keyboard-dock handling

Message ID 20210306133716.453447-1-hdegoede@redhat.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show
Series [1/3] HID: asus: Cleanup Asus T101HA keyboard-dock handling | expand

Commit Message

Hans de Goede March 6, 2021, 1:37 p.m. UTC
There is no need to use a quirk and then return -ENODEV from the
asus_probe() function to avoid that hid-asus binds to the hiddev
for the USB-interface for the hid-multitouch touchpad.

The hid-multitouch hiddev has a group of HID_GROUP_MULTITOUCH_WIN_8,
so the same result can be achieved by making the hid_device_id entry
for the dock in the asus_devices[] table only match on HID_GROUP_GENERIC
instead of having it match HID_GROUP_ANY.

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

Comments

Jiri Kosina March 31, 2021, 9:41 a.m. UTC | #1
On Sat, 6 Mar 2021, Hans de Goede wrote:

> There is no need to use a quirk and then return -ENODEV from the
> asus_probe() function to avoid that hid-asus binds to the hiddev
> for the USB-interface for the hid-multitouch touchpad.
> 
> The hid-multitouch hiddev has a group of HID_GROUP_MULTITOUCH_WIN_8,
> so the same result can be achieved by making the hid_device_id entry
> for the dock in the asus_devices[] table only match on HID_GROUP_GENERIC
> instead of having it match HID_GROUP_ANY.

Benjamin, could you please Ack this series, as it touches hid-multitouch, 
please?

Thanks,
Jiri Kosina May 5, 2021, 12:24 p.m. UTC | #2
On Wed, 31 Mar 2021, Jiri Kosina wrote:

> > There is no need to use a quirk and then return -ENODEV from the
> > asus_probe() function to avoid that hid-asus binds to the hiddev
> > for the USB-interface for the hid-multitouch touchpad.
> > 
> > The hid-multitouch hiddev has a group of HID_GROUP_MULTITOUCH_WIN_8,
> > so the same result can be achieved by making the hid_device_id entry
> > for the dock in the asus_devices[] table only match on HID_GROUP_GENERIC
> > instead of having it match HID_GROUP_ANY.
> 
> Benjamin, could you please Ack this series, as it touches hid-multitouch, 
> please?

Benjamin, friendly ping on this one.

Thanks,
Benjamin Tissoires May 5, 2021, 1:36 p.m. UTC | #3
On Wed, May 5, 2021 at 2:24 PM Jiri Kosina <jikos@kernel.org> wrote:
>
> On Wed, 31 Mar 2021, Jiri Kosina wrote:
>
> > > There is no need to use a quirk and then return -ENODEV from the
> > > asus_probe() function to avoid that hid-asus binds to the hiddev
> > > for the USB-interface for the hid-multitouch touchpad.
> > >
> > > The hid-multitouch hiddev has a group of HID_GROUP_MULTITOUCH_WIN_8,
> > > so the same result can be achieved by making the hid_device_id entry
> > > for the dock in the asus_devices[] table only match on HID_GROUP_GENERIC
> > > instead of having it match HID_GROUP_ANY.
> >
> > Benjamin, could you please Ack this series, as it touches hid-multitouch,
> > please?
>
> Benjamin, friendly ping on this one.
>

Sorry for being such a bad co-maintainer... :(

This one completely fell through the cracks.

I have no objections for 1/3 and 2/3. I'll comment on 3/3.

Cheers,
Benjamin
Jiri Kosina May 13, 2021, 10:33 a.m. UTC | #4
On Sat, 6 Mar 2021, Hans de Goede wrote:

> There is no need to use a quirk and then return -ENODEV from the
> asus_probe() function to avoid that hid-asus binds to the hiddev
> for the USB-interface for the hid-multitouch touchpad.
> 
> The hid-multitouch hiddev has a group of HID_GROUP_MULTITOUCH_WIN_8,
> so the same result can be achieved by making the hid_device_id entry
> for the dock in the asus_devices[] table only match on HID_GROUP_GENERIC
> instead of having it match HID_GROUP_ANY.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied to for-5.13/upstream-fixes.
diff mbox series

Patch

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 1dfe184ebf5a..b892aea673f9 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -79,10 +79,9 @@  MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 #define QUIRK_T100_KEYBOARD		BIT(6)
 #define QUIRK_T100CHI			BIT(7)
 #define QUIRK_G752_KEYBOARD		BIT(8)
-#define QUIRK_T101HA_DOCK		BIT(9)
-#define QUIRK_T90CHI			BIT(10)
-#define QUIRK_MEDION_E1239T		BIT(11)
-#define QUIRK_ROG_NKEY_KEYBOARD		BIT(12)
+#define QUIRK_T90CHI			BIT(9)
+#define QUIRK_MEDION_E1239T		BIT(10)
+#define QUIRK_ROG_NKEY_KEYBOARD		BIT(11)
 
 #define I2C_KEYBOARD_QUIRKS			(QUIRK_FIX_NOTEBOOK_REPORT | \
 						 QUIRK_NO_INIT_REPORTS | \
@@ -1072,11 +1071,6 @@  static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return ret;
 	}
 
-	/* use hid-multitouch for T101HA touchpad */
-	if (id->driver_data & QUIRK_T101HA_DOCK &&
-	    hdev->collection->usage == HID_GD_MOUSE)
-		return -ENODEV;
-
 	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
 	if (ret) {
 		hid_err(hdev, "Asus hw start failed: %d\n", ret);
@@ -1227,8 +1221,6 @@  static const struct hid_device_id asus_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 		USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD),
 	  QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
-		USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD), QUIRK_T101HA_DOCK },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
@@ -1236,6 +1228,12 @@  static const struct hid_device_id asus_devices[] = {
 		USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE_MEDION_E1239T),
 		QUIRK_MEDION_E1239T },
+	/*
+	 * Note bind to the HID_GROUP_GENERIC group, so that we only bind to the keyboard
+	 * part, while letting hid-multitouch.c handle the touchpad.
+	 */
+	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
+		USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, asus_devices);