]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
HID: add support for Kye/Genius Ergo 525V
authorJiri Kosina <jkosina@suse.cz>
Wed, 11 Mar 2009 10:43:27 +0000 (11:43 +0100)
committerJiri Kosina <jkosina@suse.cz>
Mon, 30 Mar 2009 13:12:54 +0000 (15:12 +0200)
This device sends several buttons in a separate field, which is
wrongly described in the report descriptor. Fix it in the following
way:

- change led usage page to button
- report size 8 count 1 becomes report size 1 count 8
- the button usage range changed to 4-7 (the mouse has three buttons in
  a different field already).

Reported-by: Tomas Hanak <tomas.hanak@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-core.c
drivers/hid/hid-dummy.c
drivers/hid/hid-ids.h
drivers/hid/hid-kye.c [new file with mode: 0644]

index c16fc4fb13bfd778947ade4d6a29ebd11fb1d7a6..88e16ef9324740f88fa2ddd62ebb01b70721e695 100644 (file)
@@ -143,6 +143,13 @@ config HID_EZKEY
        ---help---
        Support for Ezkey BTC 8193 keyboard.
 
+config HID_KYE
+       tristate "Kye" if EMBEDDED
+       depends on USB_HID
+       default !EMBEDDED
+       ---help---
+       Support for Kye/Genius Ergo Mouse.
+
 config HID_GYRATION
        tristate "Gyration" if EMBEDDED
        depends on USB_HID
index 53e133146b5844a3a42d4009d62c4c72103f7ea4..e6b72ed0d70a2d1bf62ee5da65de843697b0d310 100644 (file)
@@ -30,6 +30,7 @@ obj-$(CONFIG_DRAGONRISE_FF)   += hid-drff.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_KYE)          += hid-kye.o
 obj-$(CONFIG_HID_LOGITECH)     += hid-logitech.o
 obj-$(CONFIG_HID_MICROSOFT)    += hid-microsoft.o
 obj-$(CONFIG_HID_MONTEREY)     += hid-monterey.o
index 74bec03ef881c3d230c527ce1ab623ece0c3456c..b96fbd5dab55cfc94db63c760ea3e4ae96e7633d 100644 (file)
@@ -1274,6 +1274,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
+       { 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_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
index 28815fd6c28577a9e81c955bea8469329bf8a4d0..74d765f386241e7a9f0aa0b0496a0d486fd3432b 100644 (file)
@@ -34,6 +34,9 @@ static int __init hid_dummy_init(void)
 #ifdef CONFIG_HID_EZKEY_MODULE
        HID_COMPAT_CALL_DRIVER(ezkey);
 #endif
+#ifdef CONFIG_HID_KYE_MODULE
+       HID_COMPAT_CALL_DRIVER(kye);
+#endif
 #ifdef CONFIG_HID_GYRATION_MODULE
        HID_COMPAT_CALL_DRIVER(gyration);
 #endif
index 65b790fd6bfa97319a8ee3983bd04b6825f6378b..bdeda4c7cc13ecd00202385050f03136122ff103 100644 (file)
 #define USB_VENDOR_ID_ZEROPLUS         0x0c12
 
 #define USB_VENDOR_ID_KYE              0x0458
+#define USB_DEVICE_ID_KYE_ERGO_525V    0x0087
 #define USB_DEVICE_ID_KYE_GPEN_560     0x5003
 
+
 #endif
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
new file mode 100644 (file)
index 0000000..ea7f412
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ *  HID driver for Kye/Genius devices not fully compliant with HID standard
+ *
+ *  Copyright (c) 2009 Jiri Kosina
+ *  Copyright (c) 2009 Tomas Hanak
+ */
+
+/*
+ * 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"
+
+/* the fixups that need to be done:
+ *   - change led usage page to button for extra buttons
+ *   - report size 8 count 1 must be size 1 count 8 for button bitfield
+ *   - change the button usage range to 4-7 for the extra buttons
+ */
+static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+               unsigned int rsize)
+{
+       if (rsize >= 74 &&
+               rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
+               rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
+               rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
+               rdesc[71] == 0x75 && rdesc[72] == 0x08 &&
+               rdesc[73] == 0x95 && rdesc[74] == 0x01) {
+               dev_info(&hdev->dev, "fixing up Kye/Genius Ergo Mouse report "
+                               "descriptor\n");
+               rdesc[62] = 0x09;
+               rdesc[64] = 0x04;
+               rdesc[66] = 0x07;
+               rdesc[72] = 0x01;
+               rdesc[74] = 0x08;
+       }
+}
+
+static const struct hid_device_id kye_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, kye_devices);
+
+static struct hid_driver kye_driver = {
+       .name = "kye",
+       .id_table = kye_devices,
+       .report_fixup = kye_report_fixup,
+};
+
+static int kye_init(void)
+{
+       return hid_register_driver(&kye_driver);
+}
+
+static void kye_exit(void)
+{
+       hid_unregister_driver(&kye_driver);
+}
+
+module_init(kye_init);
+module_exit(kye_exit);
+MODULE_LICENSE("GPL");
+
+HID_COMPAT_LOAD_DRIVER(kye);