[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <41620071003212350adachi@il.is.s.u-tokyo.ac.jp>
Date: Thu, 04 Oct 2007 06:23:50 +0900
From: Tomoya Adachi <adachi@...is.s.u-tokyo.ac.jp>
To: Jiri Kosina <jkosina@...e.cz>
Cc: linux-usb-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: [PATCH] usbhid: report descriptor fix for MacBook JIS keyboard
From: Tomoya Adachi <adachi@...is.s.u-tokyo.ac.jp>
This patch fixes the problem, that Japanese MacBook doesn't recognize some keys
like '\'(yen, or backslash), '|'(pipe), and '_'(underscore).
It is due to that MacBook JIS keyboard (jp106) sends wrong report descriptor.
It saids "logical maximum = 0x65", so Keyboard.0089 is mapped to Key.Unknown,
while it should be accepted as Key.Yen.
Signed-off-by: Tomoya Adachi <adachi@...is.s.u-tokyo.ac.jp>
---
diff -uprN -X linux-2.6.23-rc9/Documentation/dontdiff linux-2.6.23-rc9/drivers/hid/usbhid/hid-quirks.c linux-2.6.23-rc9-patched/drivers/hid/usbhid/hid-quirks.c
--- linux-2.6.23-rc9/drivers/hid/usbhid/hid-quirks.c 2007-10-04 02:52:01.000000000 +0900
+++ linux-2.6.23-rc9-patched/drivers/hid/usbhid/hid-quirks.c 2007-10-04 06:03:45.000000000 +0900
@@ -619,6 +619,8 @@ static const struct hid_rdesc_blacklist
{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_RDESC_SWAPPED_MIN_MAX },
{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_RDESC_SWAPPED_MIN_MAX },
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_RDESC_MACBOOK_JIS },
+
{ 0, 0 }
};
@@ -927,6 +929,18 @@ static void usbhid_fixup_cypress_descrip
printk(KERN_INFO "Fixing up Cypress report descriptor\n");
}
+/*
+ * MacBook JIS keyboard has wrong logical maximum
+ */
+static void usbhid_fixup_macbook_descriptor(unsigned char *rdesc, int rsize)
+{
+ if (rsize >= 60 && rdesc[53] == 0x65
+ && rdesc[59] == 0x65) {
+ printk(KERN_INFO "Fixing up MacBook JIS keyboard report descriptor\n");
+ rdesc[53] = rdesc[59] = 0xe7;
+ }
+}
+
static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize)
{
@@ -941,6 +955,9 @@ static void __usbhid_fixup_report_descri
if (quirks & HID_QUIRK_RDESC_PETALYNX)
usbhid_fixup_petalynx_descriptor(rdesc, rsize);
+
+ if (quirks & HID_QUIRK_RDESC_MACBOOK_JIS)
+ usbhid_fixup_macbook_descriptor(rdesc, rsize);
}
/**
diff -uprN -X linux-2.6.23-rc9/Documentation/dontdiff linux-2.6.23-rc9/include/linux/hid.h linux-2.6.23-rc9-patched/include/linux/hid.h
--- linux-2.6.23-rc9/include/linux/hid.h 2007-10-04 02:52:03.000000000 +0900
+++ linux-2.6.23-rc9-patched/include/linux/hid.h 2007-10-04 06:00:57.000000000 +0900
@@ -285,6 +285,7 @@ struct hid_item {
#define HID_QUIRK_RDESC_LOGITECH 0x00000002
#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
#define HID_QUIRK_RDESC_PETALYNX 0x00000008
+#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
/*
* This is the global environment of the parser. This information is
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists