From f23be31228daa7ce62f019acb8f7a127e5bd846c Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Mon, 13 Sep 2021 10:09:16 +0200 Subject: [PATCH] Clean up code --- hid-microsoft-ergonomic.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/hid-microsoft-ergonomic.c b/hid-microsoft-ergonomic.c index 4308512..b3adff6 100644 --- a/hid-microsoft-ergonomic.c +++ b/hid-microsoft-ergonomic.c @@ -12,14 +12,10 @@ #define USB_VENDOR_ID_MICROSOFT 0x045e #define USB_DEVICE_ID_MS_ERGONOMIC_KEYBOARD 0x082c -#define MS_ERGONOMY2 BIT(8) +#define MS_ERGONOMY2 BIT(8) struct ms_data { unsigned long quirks; - struct hid_device *hdev; - __u8 strong; - __u8 weak; - void *output_report_dmabuf; }; @@ -34,21 +30,10 @@ static int ms_raw_event(struct hid_device *hdev, struct hid_report *report, if (quirks & MS_ERGONOMY2) { if (size == 8 && ((data[1] & 0x0f) == 0x0f)) { - hid_info(hdev, "remapped button %x :)", data[1]); - // weird Office button just simulates Left Shift + Ctrl + Alt + Super! - data[1] |= 0x80; // other combination keys might also be pressed! - data[1] &= 0xf0; // clear the 4 key mess + // the weird Office button simulates Left Shift + Left Ctrl + Left Alt + Left Meta.. + data[1] |= 0x80; // instead set Right Meta + data[1] &= 0xf0; // ..and clear the previous mess } - /* - hid_info(hdev, "event of size %d", size); - int size2 = size; - while (size2 > 0) { - printk(KERN_CONT " %x", *data); - size2--; - data++; - } - printk(KERN_CONT "\n"); - */ } return 0; } @@ -81,6 +66,7 @@ static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id) return 0; err_free: + devm_kfree(&hdev->dev, ms); return ret; }