HID: quirks: Add Apple Magic Trackpad 2 to hid_have_special_driver list
PATCH 1/1 HID: quirks: Add Apple Magic Trackpad 2 to hid_have_special_driver list
The Apple Magic Trackpad 2 is handled by the magicmouse driver. And there were severe stability issues when both drivers (hid-generic and hid-magicmouse) were loaded for this device.
--- drivers/hid/hid-quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-quirks.c +2 -0
@@ -473,6 +473,8 @@ static const struct hid_device_id hid_have_special_driver[] = { #if IS_ENABLED(CONFIG_HID_MAGICMOUSE) { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) }, #endif #if IS_ENABLED(CONFIG_HID_MAYFLASH) { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) },
--
2.29.2
Quoted 6 lines · Felix Hädicke
The Apple Magic Trackpad 2 is handled by the magicmouse driver. And there were severe stability issues when both drivers (hid-generic and hid-magicmouse) were loaded for this device.
+Jiri Kosina +Benjamin Tissoires for visibility.
Quoted 20 lines
Signed-off-by Felix Hädicke <[email protected]>--- drivers/hid/hid-quirks.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hid/hid-quirks.c +2
-1@@ -473,6 +473,8 @@ static const struct hid_device_id hid_have_special_driver[] = { #if IS_ENABLED(CONFIG_HID_MAGICMOUSE) { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) }, #endif #if IS_ENABLED(CONFIG_HID_MAYFLASH) { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) }, --
Quoted 2 lines
2.29.2
Thanks.
Signature · 1 line
Dmitry
Hi Felix,
Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Felix Hädicke
The Apple Magic Trackpad 2 is handled by the magicmouse driver. And there were severe stability issues when both drivers (hid-generic and hid-magicmouse) were loaded for this device.
As mentioned in the bug, this hardly looks like the correct solution.
The magicmouse is one of the 2 only drivers that calls hid_register_report and then overwrites the size of the report manually. I can not figure out immediately if this is wrong, and how that would impact a free in usbhid, but this is highly suspicious to me.
Cheers,
Benjamin
Quoted 31 lines
+Jiri Kosina +Benjamin Tissoires for visibility.
Quoted 20 lines
Signed-off-by Felix Hädicke <[email protected]>--- drivers/hid/hid-quirks.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hid/hid-quirks.c +2
-1@@ -473,6 +473,8 @@ static const struct hid_device_id hid_have_special_driver[] = { #if IS_ENABLED(CONFIG_HID_MAGICMOUSE) { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) }, #endif #if IS_ENABLED(CONFIG_HID_MAYFLASH) { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) }, --Quoted 2 lines
2.29.2
Thanks.
--
Dmitry
Hello Benjamin,
Quoted 16 lines · Benjamin Tissoires
Hi Felix,
Quoted 11 lines · Dmitry Torokhov
Quoted 8 lines · Felix Hädicke
The Apple Magic Trackpad 2 is handled by the magicmouse driver. And
there were severe stability issues when both drivers (hid-generic and
hid-magicmouse) were loaded for this device.
Quoted 7 lines
As mentioned in the bug, this hardly looks like the correct solution.
The magicmouse is one of the 2 only drivers that calls
hid_register_reportand then overwrites the size of the report manually. I can not figure out immediately if this is wrong, and how that would impact a free in usbhid, but this is highly suspicious to me.
Sorry for my late reply.
Now I have now found time to investigate this further, and tried to understand what effect overwriting the size of the report could have. Without success, I found nothing about this, which could explain a memory corruption.
But as I commented in bug 210241 (see comment #13), usbhid_stop() is called twice for the same hid_device instance pointer. The first call seems to happen when the HID default driver tries to initialise this device, which failes (probably because the hid-magicmouse driver is already active for this device).
Adding the Magic Trackpad 2 to the hid_have_special_driver list makes hid_generic_match() return false (in the hid-generic driver), and the device is ignored by this driver.
Is it not the right thing to have the Magic Trackpad 2 in the hid_have_special_driver list anyway?
Regards,
Felix
Quoted 42 lines
Cheers,
BenjaminQuoted 37 lines
+Jiri Kosina +Benjamin Tissoires for visibility.
Quoted 19 lines
Signed-off-by Felix Hädicke <[email protected]>---
drivers/hid/hid-quirks.c | 2 ++1 file changed, 2 insertions(+)drivers/hid/hid-quirks.c +1
-0@@ -473,6 +473,8 @@ static const struct hid_device_id hid_have_special_driver[] = { #if IS_ENABLED(CONFIG_HID_MAGICMOUSE) { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE,
USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) },Quoted 9 lines
+ {
HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)}, #endif
#ifIS_ENABLED(CONFIG_HID_MAYFLASH)
{HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3)},
--
2.29.2Thanks.
--
Dmitry