2 * HID driver for Redragon keyboards
4 * Copyright (c) 2017 Robert Munteanu
5 * SPDX-License-Identifier: GPL-2.0+
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
15 #include <linux/device.h>
16 #include <linux/hid.h>
17 #include <linux/module.h>
23 * The Redragon Asura keyboard sends an incorrect HID descriptor.
24 * At byte 100 it contains
28 * which is Input (Data, Arr, Abs), but it should be
32 * which is Input (Data, Var, Abs), which is consistent with the way
33 * key codes are generated.
36 static __u8
*redragon_report_fixup(struct hid_device
*hdev
, __u8
*rdesc
,
39 if (*rsize
>= 102 && rdesc
[100] == 0x81 && rdesc
[101] == 0x00) {
40 dev_info(&hdev
->dev
, "Fixing Redragon ASURA report descriptor.\n");
47 static const struct hid_device_id redragon_devices
[] = {
48 {HID_USB_DEVICE(USB_VENDOR_ID_JESS
, USB_DEVICE_ID_REDRAGON_ASURA
)},
52 MODULE_DEVICE_TABLE(hid
, redragon_devices
);
54 static struct hid_driver redragon_driver
= {
56 .id_table
= redragon_devices
,
57 .report_fixup
= redragon_report_fixup
60 module_hid_driver(redragon_driver
);
62 MODULE_LICENSE("GPL");