HID: add support for Ortek WKB-2000
authorJohnathon Harris <jmharris@gmail.com>
Thu, 21 Jan 2010 14:36:52 +0000 (14:36 +0000)
committerJiri Kosina <jkosina@suse.cz>
Tue, 26 Jan 2010 00:57:35 +0000 (01:57 +0100)
This patch adds a new USB HID driver for the Ortek WKB-2000, working around an
incorrect LogicalMaximum value in the USB resource descriptor.

Tracked by http://bugzilla.kernel.org/show_bug.cgi?id=14787
Bug originally reported by Ubuntu users: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/405390

Signed-off-by: Johnathon Harris <jmharris@gmail.com>
Tested-by: Daniel J Blueman <daniel.blueman@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-ortek.c [new file with mode: 0644]

index 38e969207636fbb6716d0912dbefba848574efd4..139668d6382a0ca779ee49c416dc0afb3c8e9ce3 100644 (file)
@@ -218,6 +218,13 @@ config HID_NTRIG
        ---help---
        Support for N-Trig touch screen.
 
+config HID_ORTEK
+       tristate "Ortek" if EMBEDDED
+       depends on USB_HID
+       default !EMBEDDED
+       ---help---
+       Support for Ortek WKB-2000 wireless keyboard + mouse trackpad.
+
 config HID_PANTHERLORD
        tristate "Pantherlord support" if EMBEDDED
        depends on USB_HID
index 15541c47b172256027e72c86526e45a2bc4b7c41..b62d4b3afdc2a1f863e775f94d0cf9fd6121919b 100644 (file)
@@ -38,6 +38,7 @@ obj-$(CONFIG_HID_LOGITECH)    += hid-logitech.o
 obj-$(CONFIG_HID_MICROSOFT)    += hid-microsoft.o
 obj-$(CONFIG_HID_MONTEREY)     += hid-monterey.o
 obj-$(CONFIG_HID_NTRIG)                += hid-ntrig.o
+obj-$(CONFIG_HID_ORTEK)                += hid-ortek.o
 obj-$(CONFIG_HID_QUANTA)       += hid-quanta.o
 obj-$(CONFIG_HID_PANTHERLORD)  += hid-pl.o
 obj-$(CONFIG_HID_PETALYNX)     += hid-petalynx.o
index 116a3460e75a5260bfb4f3ce8ea46e40be987bbc..7fe509879fe32a4a155dfd8fb09eb4325d908fb7 100644 (file)
@@ -1337,6 +1337,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
        { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
        { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
index 064c09a221ef3b57f8f741998751922c4b11eaac..6c38359385a927825798ab101b7302b34c1f5b68 100644 (file)
 #define USB_VENDOR_ID_ONTRAK           0x0a07
 #define USB_DEVICE_ID_ONTRAK_ADU100    0x0064
 
+#define USB_VENDOR_ID_ORTEK            0x05a4
+#define USB_DEVICE_ID_ORTEK_WKB2000    0x2000
+
 #define USB_VENDOR_ID_PANJIT           0x134c
 
 #define USB_VENDOR_ID_PANTHERLORD      0x0810
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
new file mode 100644 (file)
index 0000000..aa9a960
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *  HID driver for Ortek WKB-2000 (wireless keyboard + mouse trackpad).
+ *  Fixes LogicalMaximum error in USB report description, see
+ *  http://bugzilla.kernel.org/show_bug.cgi?id=14787
+ *
+ *  Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+               unsigned int rsize)
+{
+       if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
+               dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 "
+                               "report descriptor.\n");
+               rdesc[55] = 0x92;
+       }
+}
+
+static const struct hid_device_id ortek_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, ortek_devices);
+
+static struct hid_driver ortek_driver = {
+       .name = "ortek",
+       .id_table = ortek_devices,
+       .report_fixup = ortek_report_fixup
+};
+
+static int __init ortek_init(void)
+{
+       return hid_register_driver(&ortek_driver);
+}
+
+static void __exit ortek_exit(void)
+{
+       hid_unregister_driver(&ortek_driver);
+}
+
+module_init(ortek_init);
+module_exit(ortek_exit);
+MODULE_LICENSE("GPL");