diff mbox

[v3] HID: apple: Use country code to detect ISO keyboards

Message ID 20170602152839.7810-1-alexhenrie24@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Henrie June 2, 2017, 3:28 p.m. UTC
At least on newer laptops, Apple uses the same USB ID for both ISO and
ANSI keyboards. However, they have been good about filling in the
bCountryCode field in the HID descriptor on all of their keyboards. A
value of 13 indicates an ISO layout and other values indicate various
country-specific ANSI layouts.

With this patch, users of Apple US keyboards will no longer have to run
`echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a working
tilde key.

Please test this patch and send feedback if you have a Macbook or an
Apple keyboard.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 drivers/hid/hid-apple.c | 59 ++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 32 deletions(-)

Comments

Benjamin Tissoires June 6, 2017, 7:29 a.m. UTC | #1
On Jun 02 2017 or thereabouts, Alex Henrie wrote:
> At least on newer laptops, Apple uses the same USB ID for both ISO and
> ANSI keyboards. However, they have been good about filling in the
> bCountryCode field in the HID descriptor on all of their keyboards. A
> value of 13 indicates an ISO layout and other values indicate various
> country-specific ANSI layouts.
> 
> With this patch, users of Apple US keyboards will no longer have to run
> `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a working
> tilde key.
> 
> Please test this patch and send feedback if you have a Macbook or an
> Apple keyboard.
> 
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> ---

Looks good to me. Thanks for the v3:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  drivers/hid/hid-apple.c | 59 ++++++++++++++++++++++---------------------------
>  1 file changed, 27 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> index 2e046082210f..25b7bd56ae11 100644
> --- a/drivers/hid/hid-apple.c
> +++ b/drivers/hid/hid-apple.c
> @@ -28,7 +28,7 @@
>  #define APPLE_IGNORE_MOUSE	0x0002
>  #define APPLE_HAS_FN		0x0004
>  #define APPLE_HIDDEV		0x0008
> -#define APPLE_ISO_KEYBOARD	0x0010
> +/* 0x0010 reserved, was: APPLE_ISO_KEYBOARD */
>  #define APPLE_MIGHTYMOUSE	0x0020
>  #define APPLE_INVERT_HWHEEL	0x0040
>  #define APPLE_IGNORE_HIDINPUT	0x0080
> @@ -36,6 +36,8 @@
>  
>  #define APPLE_FLAG_FKEY		0x01
>  
> +#define HID_COUNTRY_INTERNATIONAL_ISO	13
> +
>  static unsigned int fnmode = 1;
>  module_param(fnmode, uint, 0644);
>  MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, "
> @@ -247,7 +249,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
>  	}
>  
>  	if (iso_layout) {
> -		if (asc->quirks & APPLE_ISO_KEYBOARD) {
> +		if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) {
>  			trans = apple_find_translation(apple_iso_keyboard, usage->code);
>  			if (trans) {
>  				input_event(input, usage->type, trans->to, value);
> @@ -412,60 +414,54 @@ static const struct hid_device_id apple_devices[] = {
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
>  			APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
>  			APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
>  			APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
>  				USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
> @@ -479,86 +475,85 @@ static const struct hid_device_id apple_devices[] = {
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ 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 },
> +		.driver_data = APPLE_HAS_FN },
>  	{ 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 },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
>  		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI),
>  		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO),
> -		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_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),
> -		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
> -			APPLE_ISO_KEYBOARD },
> +		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS),
>  		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
> -- 
> 2.13.0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina June 8, 2017, 12:03 p.m. UTC | #2
On Fri, 2 Jun 2017, Alex Henrie wrote:

> At least on newer laptops, Apple uses the same USB ID for both ISO and
> ANSI keyboards. However, they have been good about filling in the
> bCountryCode field in the HID descriptor on all of their keyboards. A
> value of 13 indicates an ISO layout and other values indicate various
> country-specific ANSI layouts.
> 
> With this patch, users of Apple US keyboards will no longer have to run
> `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a working
> tilde key.
> 
> Please test this patch and send feedback if you have a Macbook or an
> Apple keyboard.
> 
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>

Applied to for-4.13/apple. Thanks,
Alex Henrie June 8, 2017, 3:15 p.m. UTC | #3
2017-06-08 6:03 GMT-06:00 Jiri Kosina <jikos@kernel.org>:
> On Fri, 2 Jun 2017, Alex Henrie wrote:
>
>> At least on newer laptops, Apple uses the same USB ID for both ISO and
>> ANSI keyboards. However, they have been good about filling in the
>> bCountryCode field in the HID descriptor on all of their keyboards. A
>> value of 13 indicates an ISO layout and other values indicate various
>> country-specific ANSI layouts.
>>
>> With this patch, users of Apple US keyboards will no longer have to run
>> `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a working
>> tilde key.
>>
>> Please test this patch and send feedback if you have a Macbook or an
>> Apple keyboard.
>>
>> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
>
> Applied to for-4.13/apple. Thanks,

Thank you!

-Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukas Wunner June 17, 2017, 6:56 p.m. UTC | #4
On Thu, Jun 08, 2017 at 02:03:14PM +0200, Jiri Kosina wrote:
> On Fri, 2 Jun 2017, Alex Henrie wrote:
> > At least on newer laptops, Apple uses the same USB ID for both ISO and
> > ANSI keyboards. However, they have been good about filling in the
> > bCountryCode field in the HID descriptor on all of their keyboards. A
> > value of 13 indicates an ISO layout and other values indicate various
> > country-specific ANSI layouts.
> > 
> > With this patch, users of Apple US keyboards will no longer have to run
> > `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a working
> > tilde key.
> > 
> > Please test this patch and send feedback if you have a Macbook or an
> > Apple keyboard.
> > 
> > Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> 
> Applied to for-4.13/apple. Thanks,

Sorry, I'm late to the party, just wanted to report that I've been
carrying this patch on my development branch for a while now and
have not noticed any adverse effects.  This is on a MacBookPro9,1
with a German ISO keyboard (USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
HID bCountryCode = 0x0d.

So, FWIW,
Tested-by: Lukas Wunner <lukas@wunner.de>

Thanks,

Lukas
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bastien Nocera June 20, 2017, 11:54 a.m. UTC | #5
On Sat, 2017-06-17 at 20:56 +0200, Lukas Wunner wrote:
> On Thu, Jun 08, 2017 at 02:03:14PM +0200, Jiri Kosina wrote:
> > On Fri, 2 Jun 2017, Alex Henrie wrote:
> > > At least on newer laptops, Apple uses the same USB ID for both
> > > ISO and
> > > ANSI keyboards. However, they have been good about filling in the
> > > bCountryCode field in the HID descriptor on all of their
> > > keyboards. A
> > > value of 13 indicates an ISO layout and other values indicate
> > > various
> > > country-specific ANSI layouts.
> > > 
> > > With this patch, users of Apple US keyboards will no longer have
> > > to run
> > > `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a
> > > working
> > > tilde key.
> > > 
> > > Please test this patch and send feedback if you have a Macbook or
> > > an
> > > Apple keyboard.
> > > 
> > > Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> > 
> > Applied to for-4.13/apple. Thanks,
> 
> Sorry, I'm late to the party, just wanted to report that I've been
> carrying this patch on my development branch for a while now and
> have not noticed any adverse effects.  This is on a MacBookPro9,1
> with a German ISO keyboard (USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
> HID bCountryCode = 0x0d.
> 
> So, FWIW,
> Tested-by: Lukas Wunner <lukas@wunner.de>

Does this patch mean we can assume that the hardware model is "pc105"
instead of various flavours of "mac" in xkeyboard-config's X keymaps?

Does this also work with older Apple USB keyboards? (Most of the older
ones triggered the "press those 2 buttons so we can figure out which
type of keyboard you have", under macOS)

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Henrie June 20, 2017, 5:18 p.m. UTC | #6
2017-06-20 5:54 GMT-06:00 Bastien Nocera <hadess@hadess.net>:
> On Sat, 2017-06-17 at 20:56 +0200, Lukas Wunner wrote:
>> On Thu, Jun 08, 2017 at 02:03:14PM +0200, Jiri Kosina wrote:
>> > On Fri, 2 Jun 2017, Alex Henrie wrote:
>> > > At least on newer laptops, Apple uses the same USB ID for both
>> > > ISO and
>> > > ANSI keyboards. However, they have been good about filling in the
>> > > bCountryCode field in the HID descriptor on all of their
>> > > keyboards. A
>> > > value of 13 indicates an ISO layout and other values indicate
>> > > various
>> > > country-specific ANSI layouts.
>> > >
>> > > With this patch, users of Apple US keyboards will no longer have
>> > > to run
>> > > `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a
>> > > working
>> > > tilde key.
>> > >
>> > > Please test this patch and send feedback if you have a Macbook or
>> > > an
>> > > Apple keyboard.
>> > >
>> > > Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
>> >
>> > Applied to for-4.13/apple. Thanks,
>>
>> Sorry, I'm late to the party, just wanted to report that I've been
>> carrying this patch on my development branch for a while now and
>> have not noticed any adverse effects.  This is on a MacBookPro9,1
>> with a German ISO keyboard (USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
>> HID bCountryCode = 0x0d.
>>
>> So, FWIW,
>> Tested-by: Lukas Wunner <lukas@wunner.de>
>
> Does this patch mean we can assume that the hardware model is "pc105"
> instead of various flavours of "mac" in xkeyboard-config's X keymaps?

I use the pc105 keymap with my Macbook 12,1 and don't have any
problems, so for me at least, the answer is yes.

> Does this also work with older Apple USB keyboards? (Most of the older
> ones triggered the "press those 2 buttons so we can figure out which
> type of keyboard you have", under macOS)

The oldest Apple ISO keyboard I could find information on is the
"Apple Geyser3 ISO", USB ID 05ac:0218. In 2008 an Arch Linux forum
user posted the output of `lsusb -v` which shows that bCountryCode is
set to 13 on this keyboard:
https://bbs.archlinux.org/viewtopic.php?pid=328653#p328653

Do you have any old Apple ISO keyboards? If you find one that doesn't
fill in bCountryCode, we could bring back the APPLE_ISO_KEYBOARD quirk
for that model.

-Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bastien Nocera June 20, 2017, 6 p.m. UTC | #7
On Tue, 2017-06-20 at 11:18 -0600, Alex Henrie wrote:
> 
<snip>
> > Does this patch mean we can assume that the hardware model is
> > "pc105"
> > instead of various flavours of "mac" in xkeyboard-config's X
> > keymaps?
> 
> I use the pc105 keymap with my Macbook 12,1 and don't have any
> problems, so for me at least, the answer is yes.

Yay! This was a long-standing "wouldn't it be nice" bug from when I
still used a MacBook Air on a daily basis:
https://bugzilla.gnome.org/show_bug.cgi?id=650379
https://bugzilla.gnome.org/show_bug.cgi?id=650772
https://bugs.freedesktop.org/show_bug.cgi?id=37446

> > Does this also work with older Apple USB keyboards? (Most of the
> > older
> > ones triggered the "press those 2 buttons so we can figure out
> > which
> > type of keyboard you have", under macOS)
> 
> The oldest Apple ISO keyboard I could find information on is the
> "Apple Geyser3 ISO", USB ID 05ac:0218. In 2008 an Arch Linux forum
> user posted the output of `lsusb -v` which shows that bCountryCode is
> set to 13 on this keyboard:
> https://bbs.archlinux.org/viewtopic.php?pid=328653#p328653
> 
> Do you have any old Apple ISO keyboards? If you find one that doesn't
> fill in bCountryCode, we could bring back the APPLE_ISO_KEYBOARD
> quirk
> for that model.

I have a 2011 MacBook Pro on which I could test this (I honestly don't
remember the cut-off for ADB/BIOS keyboards to USB), but no external
ones.

I also wonder whether that data is exported for Bluetooth and the newer
I2C keyboards.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukas Wunner Aug. 5, 2017, 5:09 p.m. UTC | #8
On Tue, Jun 20, 2017 at 08:00:53PM +0200, Bastien Nocera wrote:
> On Tue, 2017-06-20 at 11:18 -0600, Alex Henrie wrote:
> > > Does this patch mean we can assume that the hardware model is
> > > "pc105"
> > > instead of various flavours of "mac" in xkeyboard-config's X
> > > keymaps?
> > 
> > I use the pc105 keymap with my Macbook 12,1 and don't have any
> > problems, so for me at least, the answer is yes.
> 
> Yay! This was a long-standing "wouldn't it be nice" bug from when I
> still used a MacBook Air on a daily basis:
> https://bugzilla.gnome.org/show_bug.cgi?id=650379
> https://bugzilla.gnome.org/show_bug.cgi?id=650772
> https://bugs.freedesktop.org/show_bug.cgi?id=37446
> 
> > > Does this also work with older Apple USB keyboards? (Most of the
> > > older
> > > ones triggered the "press those 2 buttons so we can figure out
> > > which
> > > type of keyboard you have", under macOS)
> > 
> > The oldest Apple ISO keyboard I could find information on is the
> > "Apple Geyser3 ISO", USB ID 05ac:0218. In 2008 an Arch Linux forum
> > user posted the output of `lsusb -v` which shows that bCountryCode is
> > set to 13 on this keyboard:
> > https://bbs.archlinux.org/viewtopic.php?pid=328653#p328653
> > 
> > Do you have any old Apple ISO keyboards? If you find one that doesn't
> > fill in bCountryCode, we could bring back the APPLE_ISO_KEYBOARD
> > quirk
> > for that model.
> 
> I have a 2011 MacBook Pro on which I could test this (I honestly don't
> remember the cut-off for ADB/BIOS keyboards to USB), but no external
> ones.
> 
> I also wonder whether that data is exported for Bluetooth and the newer
> I2C keyboards.

Good point, the folks working on the driver for SPI (not I2C) keyboards
have recently *added* a command line option to enable/disable the ISO
layout.  Ideally it should likewise be autosensed so I've opened this
issue:

https://github.com/cb22/macbook12-spi-driver/issues/44

Adding some of the SPI driver devs to cc.

Thanks,

Lukas
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 2e046082210f..25b7bd56ae11 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -28,7 +28,7 @@ 
 #define APPLE_IGNORE_MOUSE	0x0002
 #define APPLE_HAS_FN		0x0004
 #define APPLE_HIDDEV		0x0008
-#define APPLE_ISO_KEYBOARD	0x0010
+/* 0x0010 reserved, was: APPLE_ISO_KEYBOARD */
 #define APPLE_MIGHTYMOUSE	0x0020
 #define APPLE_INVERT_HWHEEL	0x0040
 #define APPLE_IGNORE_HIDINPUT	0x0080
@@ -36,6 +36,8 @@ 
 
 #define APPLE_FLAG_FKEY		0x01
 
+#define HID_COUNTRY_INTERNATIONAL_ISO	13
+
 static unsigned int fnmode = 1;
 module_param(fnmode, uint, 0644);
 MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, "
@@ -247,7 +249,7 @@  static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
 	}
 
 	if (iso_layout) {
-		if (asc->quirks & APPLE_ISO_KEYBOARD) {
+		if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) {
 			trans = apple_find_translation(apple_iso_keyboard, usage->code);
 			if (trans) {
 				input_event(input, usage->type, trans->to, value);
@@ -412,60 +414,54 @@  static const struct hid_device_id apple_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
 			APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
 			APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
 			APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
 				USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
@@ -479,86 +475,85 @@  static const struct hid_device_id apple_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ 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 },
+		.driver_data = APPLE_HAS_FN },
 	{ 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 },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI),
 		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_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),
-		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
-			APPLE_ISO_KEYBOARD },
+		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),