Re: Keytouch IEC 60945 USB Keyboard not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 16 Feb 2011, kholis wrote:

> == 2. In case, Your patch and Alan patch applied:

Alan, what are your plans with the patch in question btw?

> Give same behavior as Alan patch applied. But events output is changed.
> >
> > Please apply the patch below, compile your kernel with CONFIG_HID_KEYTOUCH
> > enabled, retest, and report back the results.
> >
> I've manually added "CONFIG_HID_KEYTOUCH=y" to my config file before
> compiled, but it automatically change to "CONFIG_HID_KEYTOUCH=m" after
> compilation.

You can also run 'make oldconfig' and manualy chose 'm', or do the same in 
'make menuconfig'.

> Because 'lsmod' show nothing about keytouch module, I've tried to load
> module manually:

That's because I made a stupid mistake in my patch (missing entry in the 
list of IDs in hid-core.c).

> But nothing change.

And also the indices were wrong. I definitely had my day yesterday.

> > If the problem is still not fixed, I'd need the exact same output you
> > already provided in the previous round, plus dmesg output.
> >
> Your patch changed events output. Here is the logs:
>    evtest /dev/input/event9 -> http://pastebin.com/gkyFH1BG
>    cat /sys/kernel/debug/hid/0003:0926:3333.0002/rdesc ->
> http://pastebin.com/zm2sJ1y6
>    cat /sys/kernel/debug/hid/0003:0926:3333.0002/events ->
> http://pastebin.com/64UR8hzR (Second row means: when released)
> 
> Tested on kernel 2.6.35 (with some modification. such a 'hid_info' ->
> 'dev_info') and on latest kernel 2.6.28rc5.

Please retest with the patch below, it should hopefully work much better.

If not, I'll need the same output again. Plus provide dmesg output, 
please.



From: Jiri Kosina <jkosina@xxxxxxx>
Subject: [PATCH] HID: add support for Keytouch IEC 60945

This device has wrong Logical Min and Logical Max in its report
descriptor.

Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
---
 drivers/hid/Kconfig        |    8 +++++
 drivers/hid/Makefile       |    1 +
 drivers/hid/hid-core.c     |    1 +
 drivers/hid/hid-ids.h      |    3 ++
 drivers/hid/hid-keytouch.c |   62 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hid/hid-keytouch.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 2560f01..4d25c8f 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -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 EXPERT
 	depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 6efc2a0..f62b657 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -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_LOGITECH)	+= hid-logitech.o
 obj-$(CONFIG_HID_MAGICMOUSE)    += hid-magicmouse.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d678cf3..da908a0 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1346,6 +1346,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_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 92a0d61..2f997e5 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -345,6 +345,9 @@
 #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
index 0000000..e802150
--- /dev/null
+++ b/drivers/hid/hid-keytouch.c
@@ -0,0 +1,62 @@
+/*
+ *  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"
+
+/* The device has wrong Logical Minimum (0x80) and Logical Maximum (0x7f)
+ * specified for the keyboard usage page
+ */
+static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+		unsigned int *rsize)
+{
+	if (*rsize >= 52 &&
+		rdesc[48] == 0x15 && rdesc[49] == 0x80 &&
+		rdesc[50] == 0x25 && rdesc[51] == 0x7f) {
+		hid_info(hdev,
+			 "fixing up Keytouch IEC report descriptor\n");
+		rdesc[49] = 0x00;
+		rdesc[51] = 0x65;
+	}
+	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");
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux