diff options
author | Olaf Hering <olh@suse.de> | 2006-11-08 22:58:07 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-11-16 17:26:11 -0500 |
commit | bb7eef6eea53633a8a49f014fd27c08f7d5fda1a (patch) | |
tree | 955a168d1124910864c4970c11045a1177279c44 | |
parent | 583ceada075597a5b6acab1140d61ac81586a2a6 (diff) |
USB: correct keymapping on Powerbook built-in USB ISO keyboards
similar to the version in adbhid_input_register(): The '<>' key and the
'^°' key on a german keyboard is swapped. Provide correct keys to
userland, external USB keyboards will not work correctly when the
'badmap'/'goodmap' workarounds from xkeyboard-config are used.
It is expected that distributions drop the badmap/goodmap part from
keycodes/macintosh in the xkeyboard-config package.
This is probably 2.6.18.x material, if major distros settle on 2.6.18.
Signed-off-by: Olaf Hering <olh@suse.de>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/input/hid-core.c | 4 | ||||
-rw-r--r-- | drivers/usb/input/hid-input.c | 17 | ||||
-rw-r--r-- | drivers/usb/input/hid.h | 1 |
3 files changed, 20 insertions, 2 deletions
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 6daf85c6eeee..8fde85c4905c 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1797,10 +1797,10 @@ static const struct hid_blacklist { | |||
1797 | { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN }, | 1797 | { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN }, |
1798 | { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN }, | 1798 | { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN }, |
1799 | { USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN }, | 1799 | { USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN }, |
1800 | { USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN }, | 1800 | { USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
1801 | { USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN }, | 1801 | { USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN }, |
1802 | { USB_VENDOR_ID_APPLE, 0x0217, HID_QUIRK_POWERBOOK_HAS_FN }, | 1802 | { USB_VENDOR_ID_APPLE, 0x0217, HID_QUIRK_POWERBOOK_HAS_FN }, |
1803 | { USB_VENDOR_ID_APPLE, 0x0218, HID_QUIRK_POWERBOOK_HAS_FN }, | 1803 | { USB_VENDOR_ID_APPLE, 0x0218, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD}, |
1804 | { USB_VENDOR_ID_APPLE, 0x0219, HID_QUIRK_POWERBOOK_HAS_FN }, | 1804 | { USB_VENDOR_ID_APPLE, 0x0219, HID_QUIRK_POWERBOOK_HAS_FN }, |
1805 | { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN }, | 1805 | { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN }, |
1806 | { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN }, | 1806 | { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN }, |
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 9a808a3b4d37..68e7ebb978a9 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c | |||
@@ -121,6 +121,12 @@ static struct hidinput_key_translation powerbook_numlock_keys[] = { | |||
121 | { } | 121 | { } |
122 | }; | 122 | }; |
123 | 123 | ||
124 | static struct hidinput_key_translation powerbook_iso_keyboard[] = { | ||
125 | { KEY_GRAVE, KEY_102ND }, | ||
126 | { KEY_102ND, KEY_GRAVE }, | ||
127 | { } | ||
128 | }; | ||
129 | |||
124 | static int usbhid_pb_fnmode = 1; | 130 | static int usbhid_pb_fnmode = 1; |
125 | module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644); | 131 | module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644); |
126 | MODULE_PARM_DESC(pb_fnmode, | 132 | MODULE_PARM_DESC(pb_fnmode, |
@@ -195,6 +201,14 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, | |||
195 | } | 201 | } |
196 | } | 202 | } |
197 | 203 | ||
204 | if (hid->quirks & HID_QUIRK_POWERBOOK_ISO_KEYBOARD) { | ||
205 | trans = find_translation(powerbook_iso_keyboard, usage->code); | ||
206 | if (trans) { | ||
207 | input_event(input, usage->type, trans->to, value); | ||
208 | return 1; | ||
209 | } | ||
210 | } | ||
211 | |||
198 | return 0; | 212 | return 0; |
199 | } | 213 | } |
200 | 214 | ||
@@ -210,6 +224,9 @@ static void hidinput_pb_setup(struct input_dev *input) | |||
210 | 224 | ||
211 | for (trans = powerbook_numlock_keys; trans->from; trans++) | 225 | for (trans = powerbook_numlock_keys; trans->from; trans++) |
212 | set_bit(trans->to, input->keybit); | 226 | set_bit(trans->to, input->keybit); |
227 | |||
228 | for (trans = powerbook_iso_keyboard; trans->from; trans++) | ||
229 | set_bit(trans->to, input->keybit); | ||
213 | } | 230 | } |
214 | #else | 231 | #else |
215 | static inline int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, | 232 | static inline int hidinput_pb_event(struct hid_device *hid, struct input_dev *input, |
diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index 9b50effef758..0e76e6dcac37 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h | |||
@@ -260,6 +260,7 @@ struct hid_item { | |||
260 | #define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000 | 260 | #define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000 |
261 | #define HID_QUIRK_POWERBOOK_FN_ON 0x00002000 | 261 | #define HID_QUIRK_POWERBOOK_FN_ON 0x00002000 |
262 | #define HID_QUIRK_INVERT_HWHEEL 0x00004000 | 262 | #define HID_QUIRK_INVERT_HWHEEL 0x00004000 |
263 | #define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000 | ||
263 | 264 | ||
264 | /* | 265 | /* |
265 | * This is the global environment of the parser. This information is | 266 | * This is the global environment of the parser. This information is |