HID: add support for Keytouch IEC 60945
authorJiri Kosina <jkosina@suse.cz>
Thu, 17 Feb 2011 14:12:45 +0000 (15:12 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 17 Feb 2011 14:12:45 +0000 (15:12 +0100)
The keyboard has several bugs in its report descriptor, most
importantly the Logical Min/Max are completely off.

Replace it with simplified descriptor which describes it properly.

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-keytouch.c [new file with mode: 0644]

index 94e73db580d2603e49b7bc4ae8d592117c5c890d..5fa0b952914c729d5d50bb5a266cca8d067efe9b 100644 (file)
@@ -180,6 +180,14 @@ config HID_EZKEY
        ---help---
        Support for Ezkey BTC 8193 keyboard.
 
+config HID_KEYTOUCH
+       tristate "Keyoutch HID devices"
+       depends on USB_HID
+       ---help---
+       Support for Keytouch HID devices not fully compliant with
+       the specification. Currently supported:
+               - Keytouch IEC 60945
+
 config HID_KYE
        tristate "Kye/Genius Ergo Mouse" if EMBEDDED
        depends on USB_HID
index 2e1b1e3326c96f9109edf8d7c941e2daea841e1c..569647763d1bb8fbf2a060a3a7c0721250fd6425 100644 (file)
@@ -41,6 +41,7 @@ obj-$(CONFIG_HID_ELECOM)      += hid-elecom.o
 obj-$(CONFIG_HID_EZKEY)                += hid-ezkey.o
 obj-$(CONFIG_HID_GYRATION)     += hid-gyration.o
 obj-$(CONFIG_HID_KENSINGTON)   += hid-kensington.o
+obj-$(CONFIG_HID_KEYTOUCH)     += hid-keytouch.o
 obj-$(CONFIG_HID_KYE)          += hid-kye.o
 obj-$(CONFIG_HID_LCPOWER)       += hid-lcpower.o
 obj-$(CONFIG_HID_LOGITECH)     += hid-logitech.o
index 5e0e4eea7065f6ebb1e9b4ad0e36dfb37fcb84ed..570db37d574d448064e30662ddd1e5a069efda88 100644 (file)
@@ -1379,6 +1379,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HANVON, USB_DEVICE_ID_HANVON_MULTITOUCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) },
index 15aca15a0a7bdced375562558d94ca5d250d4a32..8fc82a7b2a82de2ee09cd715c0fe94fc1b305458 100644 (file)
 #define USB_VENDOR_ID_KWORLD           0x1b80
 #define USB_DEVICE_ID_KWORLD_RADIO_FM700       0xd700
 
+#define USB_VENDOR_ID_KEYTOUCH         0x0926
+#define USB_DEVICE_ID_KEYTOUCH_IEC     0x3333
+
 #define USB_VENDOR_ID_KYE              0x0458
 #define USB_DEVICE_ID_KYE_ERGO_525V    0x0087
 #define USB_DEVICE_ID_KYE_GPEN_560     0x5003
diff --git a/drivers/hid/hid-keytouch.c b/drivers/hid/hid-keytouch.c
new file mode 100644 (file)
index 0000000..07cd825
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *  HID driver for Keytouch devices not fully compliant with HID standard
+ *
+ *  Copyright (c) 2011 Jiri Kosina
+ */
+
+/*
+ * 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"
+
+/* Replace the broken report descriptor of this device with rather
+ * a default one */
+static __u8 keytouch_fixed_rdesc[] = {
+0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
+0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
+0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
+0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00,
+0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0
+};
+
+static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+               unsigned int *rsize)
+{
+       hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
+
+       rdesc = keytouch_fixed_rdesc;
+       *rsize = sizeof(keytouch_fixed_rdesc);
+
+       return rdesc;
+}
+
+static const struct hid_device_id keytouch_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, keytouch_devices);
+
+static struct hid_driver keytouch_driver = {
+       .name = "keytouch",
+       .id_table = keytouch_devices,
+       .report_fixup = keytouch_report_fixup,
+};
+
+static int __init keytouch_init(void)
+{
+       return hid_register_driver(&keytouch_driver);
+}
+
+static void __exit keytouch_exit(void)
+{
+       hid_unregister_driver(&keytouch_driver);
+}
+
+module_init(keytouch_init);
+module_exit(keytouch_exit);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jiri Kosina");