Clean up code

This commit is contained in:
Arne Keller 2021-09-13 10:09:16 +02:00
parent e363ff04dd
commit f23be31228

View File

@ -12,14 +12,10 @@
#define USB_VENDOR_ID_MICROSOFT 0x045e #define USB_VENDOR_ID_MICROSOFT 0x045e
#define USB_DEVICE_ID_MS_ERGONOMIC_KEYBOARD 0x082c #define USB_DEVICE_ID_MS_ERGONOMIC_KEYBOARD 0x082c
#define MS_ERGONOMY2 BIT(8) #define MS_ERGONOMY2 BIT(8)
struct ms_data { struct ms_data {
unsigned long quirks; 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 (quirks & MS_ERGONOMY2) {
if (size == 8 && ((data[1] & 0x0f) == 0x0f)) { if (size == 8 && ((data[1] & 0x0f) == 0x0f)) {
hid_info(hdev, "remapped button %x :)", data[1]); // the weird Office button simulates Left Shift + Left Ctrl + Left Alt + Left Meta..
// weird Office button just simulates Left Shift + Ctrl + Alt + Super! data[1] |= 0x80; // instead set Right Meta
data[1] |= 0x80; // other combination keys might also be pressed! data[1] &= 0xf0; // ..and clear the previous mess
data[1] &= 0xf0; // clear the 4 key 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; return 0;
} }
@ -81,6 +66,7 @@ static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id)
return 0; return 0;
err_free: err_free:
devm_kfree(&hdev->dev, ms);
return ret; return ret;
} }