aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2007-11-14 06:13:26 -0500
committerJiri Kosina <jkosina@suse.cz>2008-01-28 08:51:20 -0500
commitaf9e0eacdc072ba28fd139b90de27023d9cb0598 (patch)
treeb93832415d5d19d76bb7348355978d4e0a04aedb
parent3ba5619f06300cd0944150901ed20de87483ad8c (diff)
HID: add full support for Genius KB-29E
Genius KB-29E has broken report descriptor, which causes some of the Consumer usages to appear incorrectly as Button usages. We fix it by fixing the report descriptor before it is being parsed. Also a few of the keys violate the HUT standard, so they need a special handling. They currently fall into "Reserved" range as per HUT 1.12. Reported-by: Szekeres Istvan <szekeres@iii.hu> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-input.c6
-rw-r--r--drivers/hid/usbhid/hid-quirks.c16
-rw-r--r--include/linux/hid.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index de270b16bde3..0da29cf43713 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -630,6 +630,12 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
630 case 0x0f6: map_key_clear(KEY_NEXT); break; 630 case 0x0f6: map_key_clear(KEY_NEXT); break;
631 case 0x0fa: map_key_clear(KEY_BACK); break; 631 case 0x0fa: map_key_clear(KEY_BACK); break;
632 632
633 /* reserved in HUT 1.12. Reported on Genius KB29E */
634 case 0x156: map_key_clear(KEY_WORDPROCESSOR); break;
635 case 0x157: map_key_clear(KEY_SPREADSHEET); break;
636 case 0x158: map_key_clear(KEY_PRESENTATION); break;
637 case 0x15c: map_key_clear(KEY_STOP); break;
638
633 case 0x182: map_key_clear(KEY_BOOKMARKS); break; 639 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
634 case 0x183: map_key_clear(KEY_CONFIG); break; 640 case 0x183: map_key_clear(KEY_CONFIG); break;
635 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; 641 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 836b06a86173..0ab18a401b77 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -301,6 +301,9 @@
301#define USB_VENDOR_ID_MICROSOFT 0x045e 301#define USB_VENDOR_ID_MICROSOFT 0x045e
302#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b 302#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
303 303
304#define USB_VENDOR_ID_MONTEREY 0x0566
305#define USB_DEVICE_ID_GENIUS_KB29E 0x3004
306
304#define USB_VENDOR_ID_NCR 0x0404 307#define USB_VENDOR_ID_NCR 0x0404
305#define USB_DEVICE_ID_NCR_FIRST 0x0300 308#define USB_DEVICE_ID_NCR_FIRST 0x0300
306#define USB_DEVICE_ID_NCR_LAST 0x03ff 309#define USB_DEVICE_ID_NCR_LAST 0x03ff
@@ -646,6 +649,8 @@ static const struct hid_rdesc_blacklist {
646 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER, HID_QUIRK_RDESC_LOGITECH }, 649 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER, HID_QUIRK_RDESC_LOGITECH },
647 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2, HID_QUIRK_RDESC_LOGITECH }, 650 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2, HID_QUIRK_RDESC_LOGITECH },
648 651
652 { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER },
653
649 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_RDESC_MACBOOK_JIS }, 654 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_RDESC_MACBOOK_JIS },
650 655
651 { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_RDESC_PETALYNX }, 656 { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_RDESC_PETALYNX },
@@ -973,6 +978,14 @@ static void usbhid_fixup_macbook_descriptor(unsigned char *rdesc, int rsize)
973 } 978 }
974} 979}
975 980
981static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rsize)
982{
983 if (rsize >= 30 && rdesc[29] == 0x05
984 && rdesc[30] == 0x09) {
985 printk(KERN_INFO "Fixing up button/consumer in HID report descriptor\n");
986 rdesc[30] = 0x0c;
987 }
988}
976 989
977static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize) 990static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize)
978{ 991{
@@ -990,6 +1003,9 @@ static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned
990 1003
991 if (quirks & HID_QUIRK_RDESC_MACBOOK_JIS) 1004 if (quirks & HID_QUIRK_RDESC_MACBOOK_JIS)
992 usbhid_fixup_macbook_descriptor(rdesc, rsize); 1005 usbhid_fixup_macbook_descriptor(rdesc, rsize);
1006
1007 if (quirks & HID_QUIRK_RDESC_BUTTON_CONSUMER)
1008 usbhid_fixup_button_consumer_descriptor(rdesc, rsize);
993} 1009}
994 1010
995/** 1011/**
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 991bbcdc1ca7..c67eeb516040 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -292,6 +292,7 @@ struct hid_item {
292#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 292#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
293#define HID_QUIRK_RDESC_PETALYNX 0x00000008 293#define HID_QUIRK_RDESC_PETALYNX 0x00000008
294#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 294#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
295#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
295 296
296/* 297/*
297 * This is the global environment of the parser. This information is 298 * This is the global environment of the parser. This information is