MacBookAir3,1(3,2) hid support
PATCH 4/6 MacBookAir3,1(3,2) hid support
This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the hid driver.
drivers/hid/hid-apple.c +38 -1
@@ -59,6 +59,27 @@u8 flags; }; +static const struct apple_key_translation macbookair_fn_keys[] = { + {KEY_BACKSPACE ,KEY_DELETE }, + {KEY_ENTER ,KEY_INSERT }, + {KEY_F1 ,KEY_BRIGHTNESSDOWN ,APPLE_FLAG_FKEY }, + {KEY_F2 ,KEY_BRIGHTNESSUP ,APPLE_FLAG_FKEY }, + {KEY_F3 ,KEY_SCALE ,APPLE_FLAG_FKEY }, + {KEY_F4 ,KEY_DASHBOARD ,APPLE_FLAG_FKEY }, + {KEY_F6 ,KEY_PREVIOUSSONG ,APPLE_FLAG_FKEY }, + {KEY_F7 ,KEY_PLAYPAUSE ,APPLE_FLAG_FKEY }, + {KEY_F8 ,KEY_NEXTSONG ,APPLE_FLAG_FKEY }, + {KEY_F9 ,KEY_MUTE ,APPLE_FLAG_FKEY }, + {KEY_F10 ,KEY_VOLUMEDOWN ,APPLE_FLAG_FKEY }, + {KEY_F11 ,KEY_VOLUMEUP ,APPLE_FLAG_FKEY }, + {KEY_F12 ,KEY_EJECTCD ,APPLE_FLAG_FKEY }, + {KEY_UP ,KEY_PAGEUP }, + {KEY_DOWN ,KEY_PAGEDOWN }, + {KEY_LEFT ,KEY_HOME }, + {KEY_RIGHT ,KEY_END }, + { } +}; +static const struct apple_key_translation apple_fn_keys[] = { {KEY_BACKSPACE ,KEY_DELETE }, {KEY_ENTER ,KEY_INSERT },
@@ -157,10 +178,14 @@if (fnmode) {int do_translate; - trans =apple_find_translation ((hid->product <0x21d || +if (hid->product >=0x023f && hid->product <=0x0244 ) { + trans =apple_find_translation (macbookair_fn_keys, usage->code); + }else { + trans =apple_find_translation ((hid->product <0x21d || hid->product >=0x300 ) ? powerbook_fn_keys : apple_fn_keys, usage->code); + }if (trans) {if (test_bit (usage->code, asc->pressed_fn)) do_translate =1 ;
@@ -439,6 +464,18 @@ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), + .driver_data = APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), + .driver_data = APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
drivers/hid/hid-core.c +12 -0
@@ -1276,6 +1276,12 @@ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -1736,6 +1742,12 @@ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { }
drivers/hid/hid-ids.h +6 -0
@@ -94,6 +94,12 @@#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 +#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
Quoted 5 lines · gimli
This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the hid driver.
Signed-off-by Edgar (gimli) Hucek <[email protected]>
Hi Edgar,
thanks for the information. Are the device ids correlated to the 13'' and 11'' versions of these machines? If so, why are they mapped to the same keyboard? The apple_fn_keys also covers the existing Macbook Airs, but appears not to be used for any of the new device ids.
Thanks,
Henrik
Quoted 3 lines · Henrik Rydberg
Quoted 1 line · gimli
This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the
hid
Quoted 6 lines
Quoted 4 lines
driver.
Signed-off-by Edgar (gimli) Hucek <[email protected]>
Quoted 7 lines
Hi Edgar,
thanks for the information. Are the device ids correlated to the 13'' and 11''
versions of these machines? If so, why are they mapped to the same keyboard? Theapple_fn_keysalso covers the existing Macbook Airs, but appears not to
be
Quoted 2 lines
used
for any of the new device ids.
The keyboard layout changed on the new Air's. Thats the reason why i use a new apple_fn_keys for the new Air's.
lg
Edgar (gimli) Hucek
Quoted 4 lines
Thanks,
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Henrik Rydberg
Acked-byQuoted 19 lines · gimli
Quoted 3 lines · Henrik Rydberg
Quoted 1 line · gimli
This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the
hid
Quoted 6 lines
Quoted 4 lines
driver.
Signed-off-by Edgar (gimli) Hucek <[email protected]>Quoted 7 lines
Hi Edgar,
thanks for the information. Are the device ids correlated to the 13'' and 11''
versions of these machines? If so, why are they mapped to the same keyboard? Theapple_fn_keysalso covers the existing Macbook Airs, but appears not to
Quoted 6 lines
be
Quoted 2 lines
used
for any of the new device ids.The keyboard layout changed on the new Air's. Thats the reason why i use a new
apple_fn_keysfor the new Air's.
Thanks for the clarification, it all makes sense.
Did you consider using quirks for the keyboard layouts instead? Either way,
Thanks,
Henrik