aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-apple.c46
-rw-r--r--drivers/hid/hid-core.c12
-rw-r--r--drivers/hid/hid-ids.h6
3 files changed, 60 insertions, 4 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index eaeca564a8d3..6c52203cdbdf 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -59,6 +59,27 @@ struct apple_key_translation {
59 u8 flags; 59 u8 flags;
60}; 60};
61 61
62static const struct apple_key_translation macbookair_fn_keys[] = {
63 { KEY_BACKSPACE, KEY_DELETE },
64 { KEY_ENTER, KEY_INSERT },
65 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
66 { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
67 { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
68 { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
69 { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
70 { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
71 { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY },
72 { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY },
73 { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
74 { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
75 { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY },
76 { KEY_UP, KEY_PAGEUP },
77 { KEY_DOWN, KEY_PAGEDOWN },
78 { KEY_LEFT, KEY_HOME },
79 { KEY_RIGHT, KEY_END },
80 { }
81};
82
62static const struct apple_key_translation apple_fn_keys[] = { 83static const struct apple_key_translation apple_fn_keys[] = {
63 { KEY_BACKSPACE, KEY_DELETE }, 84 { KEY_BACKSPACE, KEY_DELETE },
64 { KEY_ENTER, KEY_INSERT }, 85 { KEY_ENTER, KEY_INSERT },
@@ -157,10 +178,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
157 if (fnmode) { 178 if (fnmode) {
158 int do_translate; 179 int do_translate;
159 180
160 trans = apple_find_translation((hid->product < 0x21d || 181 if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
161 hid->product >= 0x300) ? 182 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) {
162 powerbook_fn_keys : apple_fn_keys, 183 trans = apple_find_translation(macbookair_fn_keys, usage->code);
163 usage->code); 184 } else if (hid->product < 0x21d || hid->product >= 0x300) {
185 trans = apple_find_translation(powerbook_fn_keys, usage->code);
186 } else {
187 trans = apple_find_translation(apple_fn_keys, usage->code);
188 }
189
164 if (trans) { 190 if (trans) {
165 if (test_bit(usage->code, asc->pressed_fn)) 191 if (test_bit(usage->code, asc->pressed_fn))
166 do_translate = 1; 192 do_translate = 1;
@@ -440,6 +466,18 @@ static const struct hid_device_id apple_devices[] = {
440 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 466 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
441 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), 467 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
442 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 468 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
469 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
470 .driver_data = APPLE_HAS_FN },
471 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
472 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
473 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
474 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
475 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
476 .driver_data = APPLE_HAS_FN },
477 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
478 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
479 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
480 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
443 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 481 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
444 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 482 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
445 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 483 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b3393e17b375..53ac909e2fff 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1276,6 +1276,12 @@ static const struct hid_device_id hid_blacklist[] = {
1276 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1276 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1277 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1277 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1278 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1278 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1279 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
1280 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
1281 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
1282 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1283 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1284 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1279 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1285 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
1280 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1286 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
1281 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1287 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -1757,6 +1763,12 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1757 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1763 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1758 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1764 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1759 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1765 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1766 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
1767 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
1768 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
1769 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1770 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1771 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1760 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1772 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1761 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1773 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1762 { } 1774 { }
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 68114dbcd895..104b9f9a4c0b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -97,6 +97,12 @@
97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
100#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
101#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
102#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
103#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
104#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
105#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
100#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 106#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
101#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a 107#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
102#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b 108#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b