Skip to content

Commit

Permalink
HID: microsoft: fix tCover 2nd gen
Browse files Browse the repository at this point in the history
Trackpad right/left click correctly send BTN_LEFT/RIGHT but additionally sends KEY_F23.
KEY_F23 is linked to some special actions:
pmOS -> trackpad disabled notifitcation
raspiOS -> open new terminal

This problem is fixed now.

Signed-off-by: Jonas Schwöbel <[email protected]>
  • Loading branch information
jonasschwoebel authored and digetx committed Feb 20, 2022
1 parent 933f82e commit 5a07aa1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/hid/hid-microsoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define MS_DUPLICATE_USAGES BIT(5)
#define MS_SURFACE_DIAL BIT(6)
#define MS_QUIRK_FF BIT(7)
#define MS_T_COVER_2 BIT(8)

struct ms_data {
unsigned long quirks;
Expand Down Expand Up @@ -203,6 +204,12 @@ static int ms_input_mapping(struct hid_device *hdev, struct hid_input *hi,
return ret;
}

if (quirks & MS_T_COVER_2)
// tCover 2nd gen will send KEY_F23 on trackpad left/right click
// despite this BTN_LEFT/RIGHT event is send correctly
// just ignore the KEY_F23 event
ms_map_key_clear(KEY_F23);

return 0;
}

Expand Down Expand Up @@ -450,6 +457,11 @@ static const struct hid_device_id ms_devices[] = {
.driver_data = MS_QUIRK_FF },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS),
.driver_data = MS_QUIRK_FF },

{ HID_I2C_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2),
.driver_data = MS_T_COVER_2 },
{ HID_I2C_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2),
.driver_data = MS_T_COVER_2 },
{ }
};
MODULE_DEVICE_TABLE(hid, ms_devices);
Expand Down

0 comments on commit 5a07aa1

Please sign in to comment.