* [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
@ 2025-02-14 10:05 Aditya Garg
2025-02-14 10:06 ` [PATCH v2 2/4] HID: apple: Use common table for Magic Keyboard aluminium and 2015 " Aditya Garg
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Aditya Garg @ 2025-02-14 10:05 UTC (permalink / raw)
To: Jiri Kosina, jkosina, jkosina, Benjamin Tissoires, bentiss
Cc: Alex Henrie, jose.exposito89, bruners, seobrien,
Linux Kernel Mailing List, linux-input
From: Aditya Garg <gargaditya08@live.com>
The only difference between the fn mapping of the MacBook Pros with esc key
and those without is of the presence of KEY_GRAVE in the translation table.
We can easily use a flag instead of writing the whole table again to omit
it from the models that have an esc key.
Additionally, APPLE_IGNORE_MOUSE quirk was unused in this driver, so has
been removed in this commit.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-apple.c | 72 ++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 45 deletions(-)
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 49812a76b..e31c9e8e8 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -30,7 +30,7 @@
#include "hid-ids.h"
#define APPLE_RDESC_JIS BIT(0)
-#define APPLE_IGNORE_MOUSE BIT(1)
+/* BIT(1) reserved, was: APPLE_IGNORE_MOUSE */
#define APPLE_HAS_FN BIT(2)
/* BIT(3) reserved, was: APPLE_HIDDEV */
#define APPLE_ISO_TILDE_QUIRK BIT(4)
@@ -43,7 +43,8 @@
#define APPLE_IS_NON_APPLE BIT(11)
#define APPLE_MAGIC_BACKLIGHT BIT(12)
-#define APPLE_FLAG_FKEY 0x01
+#define APPLE_FLAG_FKEY 0x01
+#define APPLE_FLAG_DONT_TRANSLATE 0x02
#define HID_COUNTRY_INTERNATIONAL_ISO 13
#define APPLE_BATTERY_TIMEOUT_MS 60000
@@ -89,6 +90,19 @@ struct apple_sc_backlight {
struct hid_device *hdev;
};
+struct apple_backlight_config_report {
+ u8 report_id;
+ u8 version;
+ u16 backlight_off, backlight_on_min, backlight_on_max;
+};
+
+struct apple_backlight_set_report {
+ u8 report_id;
+ u8 version;
+ u16 backlight;
+ u16 rate;
+};
+
struct apple_magic_backlight {
struct led_classdev cdev;
struct hid_report *brightness;
@@ -152,20 +166,6 @@ static const struct apple_key_translation magic_keyboard_2015_fn_keys[] = {
{ }
};
-struct apple_backlight_config_report {
- u8 report_id;
- u8 version;
- u16 backlight_off, backlight_on_min, backlight_on_max;
-};
-
-struct apple_backlight_set_report {
- u8 report_id;
- u8 version;
- u16 backlight;
- u16 rate;
-};
-
-
static const struct apple_key_translation apple2021_fn_keys[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_ENTER, KEY_INSERT },
@@ -209,32 +209,10 @@ static const struct apple_key_translation macbookair_fn_keys[] = {
{ }
};
-static const struct apple_key_translation macbookpro_no_esc_fn_keys[] = {
- { KEY_BACKSPACE, KEY_DELETE },
- { KEY_ENTER, KEY_INSERT },
- { KEY_GRAVE, KEY_ESC },
- { KEY_1, KEY_F1 },
- { KEY_2, KEY_F2 },
- { KEY_3, KEY_F3 },
- { KEY_4, KEY_F4 },
- { KEY_5, KEY_F5 },
- { KEY_6, KEY_F6 },
- { KEY_7, KEY_F7 },
- { KEY_8, KEY_F8 },
- { KEY_9, KEY_F9 },
- { KEY_0, KEY_F10 },
- { KEY_MINUS, KEY_F11 },
- { KEY_EQUAL, KEY_F12 },
- { KEY_UP, KEY_PAGEUP },
- { KEY_DOWN, KEY_PAGEDOWN },
- { KEY_LEFT, KEY_HOME },
- { KEY_RIGHT, KEY_END },
- { }
-};
-
-static const struct apple_key_translation macbookpro_dedicated_esc_fn_keys[] = {
+static const struct apple_key_translation macbookpro_fn_keys[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_ENTER, KEY_INSERT },
+ { KEY_GRAVE, KEY_ESC, APPLE_FLAG_DONT_TRANSLATE },
{ KEY_1, KEY_F1 },
{ KEY_2, KEY_F2 },
{ KEY_3, KEY_F3 },
@@ -415,6 +393,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
struct apple_sc *asc = hid_get_drvdata(hid);
const struct apple_key_translation *trans, *table;
bool do_translate;
+ bool dont_translate_flagged_key = false;
u16 code = usage->code;
unsigned int real_fnmode;
@@ -481,14 +460,14 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132 ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680 ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213)
- table = macbookpro_no_esc_fn_keys;
+ table = macbookpro_fn_keys;
else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223 ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J152F)
- table = macbookpro_dedicated_esc_fn_keys;
+ table = macbookpro_fn_keys, dont_translate_flagged_key = true;
else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J230K)
- table = apple_fn_keys;
+ table = apple_fn_keys;
else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
table = macbookair_fn_keys;
@@ -525,6 +504,10 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
do_translate = asc->fn_on;
}
+ if (dont_translate_flagged_key &&
+ trans->flags & APPLE_FLAG_DONT_TRANSLATE)
+ do_translate = false;
+
if (do_translate)
code = trans->to;
}
@@ -680,8 +663,7 @@ static void apple_setup_input(struct input_dev *input)
apple_setup_key_translation(input, magic_keyboard_alu_fn_keys);
apple_setup_key_translation(input, magic_keyboard_2015_fn_keys);
apple_setup_key_translation(input, apple2021_fn_keys);
- apple_setup_key_translation(input, macbookpro_no_esc_fn_keys);
- apple_setup_key_translation(input, macbookpro_dedicated_esc_fn_keys);
+ apple_setup_key_translation(input, macbookpro_fn_keys);
}
static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 2/4] HID: apple: Use common table for Magic Keyboard aluminium and 2015 fn mapping
2025-02-14 10:05 [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping Aditya Garg
@ 2025-02-14 10:06 ` Aditya Garg
2025-02-14 10:07 ` [PATCH v2 3/4] HID: apple: simplify logic for swapping only left sided option and command keys Aditya Garg
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Aditya Garg @ 2025-02-14 10:06 UTC (permalink / raw)
To: Jiri Kosina, jkosina, jkosina, Benjamin Tissoires, bentiss
Cc: Alex Henrie, jose.exposito89, bruners, seobrien,
Linux Kernel Mailing List, linux-input
From: Aditya Garg <gargaditya08@live.com>
The only difference between the fn mapping of Magic Keyboard aluminium and
2015 is of the presence of KEY_F6 in the translation table.
We can easily use a flag instead of writing the whole table again to omit
it from 2015 model.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-apple.c | 37 ++++++++-----------------------------
1 file changed, 8 insertions(+), 29 deletions(-)
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index e31c9e8e8..ca462e483 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -125,14 +125,14 @@ struct apple_key_translation {
u8 flags;
};
-static const struct apple_key_translation magic_keyboard_alu_fn_keys[] = {
+static const struct apple_key_translation magic_keyboard_alu_and_2015_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_NUMLOCK, APPLE_FLAG_FKEY },
+ { KEY_F6, KEY_NUMLOCK, APPLE_FLAG_FKEY | APPLE_FLAG_DONT_TRANSLATE },
{ KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
{ KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
{ KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY },
@@ -146,27 +146,7 @@ static const struct apple_key_translation magic_keyboard_alu_fn_keys[] = {
{ }
};
-static const struct apple_key_translation magic_keyboard_2015_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_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
- { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
- { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY },
- { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY },
- { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
- { KEY_F12, KEY_VOLUMEUP, 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 apple2021_fn_keys[] = {
+static const struct apple_key_translation magic_keyboard_2021_and_2024_fn_keys[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_ENTER, KEY_INSERT },
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
@@ -448,15 +428,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI ||
hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO ||
hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS)
- table = magic_keyboard_alu_fn_keys;
+ table = magic_keyboard_alu_and_2015_fn_keys;
else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015 ||
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015)
- table = magic_keyboard_2015_fn_keys;
+ table = magic_keyboard_alu_and_2015_fn_keys, dont_translate_flagged_key = true;
else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 ||
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 ||
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 ||
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021)
- table = apple2021_fn_keys;
+ table = magic_keyboard_2021_and_2024_fn_keys;
else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132 ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680 ||
hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213)
@@ -660,9 +640,8 @@ static void apple_setup_input(struct input_dev *input)
apple_setup_key_translation(input, powerbook_fn_keys);
apple_setup_key_translation(input, powerbook_numlock_keys);
apple_setup_key_translation(input, apple_iso_keyboard);
- apple_setup_key_translation(input, magic_keyboard_alu_fn_keys);
- apple_setup_key_translation(input, magic_keyboard_2015_fn_keys);
- apple_setup_key_translation(input, apple2021_fn_keys);
+ apple_setup_key_translation(input, magic_keyboard_alu_and_2015_fn_keys);
+ apple_setup_key_translation(input, magic_keyboard_2021_and_2024_fn_keys);
apple_setup_key_translation(input, macbookpro_fn_keys);
}
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 3/4] HID: apple: simplify logic for swapping only left sided option and command keys
2025-02-14 10:05 [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping Aditya Garg
2025-02-14 10:06 ` [PATCH v2 2/4] HID: apple: Use common table for Magic Keyboard aluminium and 2015 " Aditya Garg
@ 2025-02-14 10:07 ` Aditya Garg
2025-02-14 10:08 ` [PATCH v2 4/4] HID: apple: use switch case to assign devices to their respective fn mapping Aditya Garg
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Aditya Garg @ 2025-02-14 10:07 UTC (permalink / raw)
To: Jiri Kosina, jkosina, jkosina, Benjamin Tissoires, bentiss
Cc: Alex Henrie, jose.exposito89, bruners, seobrien,
Linux Kernel Mailing List, linux-input
From: Aditya Garg <gargaditya08@live.com>
In order to swap only left sided option and command keys a separate table
was in use. This commit makes use of the APPLE_FLAG_DONT_TRANSLATE flag to
remove the need of such separate tables.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-apple.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index ca462e483..c672ffc97 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -285,14 +285,8 @@ static const struct apple_key_translation apple_iso_keyboard[] = {
static const struct apple_key_translation swapped_option_cmd_keys[] = {
{ KEY_LEFTALT, KEY_LEFTMETA },
{ KEY_LEFTMETA, KEY_LEFTALT },
- { KEY_RIGHTALT, KEY_RIGHTMETA },
- { KEY_RIGHTMETA, KEY_RIGHTALT },
- { }
-};
-
-static const struct apple_key_translation swapped_option_cmd_left_keys[] = {
- { KEY_LEFTALT, KEY_LEFTMETA },
- { KEY_LEFTMETA, KEY_LEFTALT },
+ { KEY_RIGHTALT, KEY_RIGHTMETA, APPLE_FLAG_DONT_TRANSLATE },
+ { KEY_RIGHTMETA, KEY_RIGHTALT, APPLE_FLAG_DONT_TRANSLATE },
{ }
};
@@ -399,12 +393,9 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
}
if (swap_opt_cmd) {
- if (swap_opt_cmd == 2)
- trans = apple_find_translation(swapped_option_cmd_left_keys, code);
- else
- trans = apple_find_translation(swapped_option_cmd_keys, code);
+ trans = apple_find_translation(swapped_option_cmd_keys, code);
- if (trans)
+ if (trans && !(swap_opt_cmd == 2 && trans->flags & APPLE_FLAG_DONT_TRANSLATE))
code = trans->to;
}
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 4/4] HID: apple: use switch case to assign devices to their respective fn mapping
2025-02-14 10:05 [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping Aditya Garg
2025-02-14 10:06 ` [PATCH v2 2/4] HID: apple: Use common table for Magic Keyboard aluminium and 2015 " Aditya Garg
2025-02-14 10:07 ` [PATCH v2 3/4] HID: apple: simplify logic for swapping only left sided option and command keys Aditya Garg
@ 2025-02-14 10:08 ` Aditya Garg
2025-02-18 19:59 ` [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro " Jiri Kosina
2025-03-04 20:23 ` Jiri Kosina
4 siblings, 0 replies; 10+ messages in thread
From: Aditya Garg @ 2025-02-14 10:08 UTC (permalink / raw)
To: Jiri Kosina, jkosina, jkosina, Benjamin Tissoires, bentiss
Cc: Alex Henrie, jose.exposito89, bruners, seobrien,
Linux Kernel Mailing List, linux-input
From: Aditya Garg <gargaditya08@live.com>
There has been a continuous increase in the number of devices requiring
hid-apple driver during the last few years. Moreover, unlike previous
releases, the PIDs of the newer devices released cannot be combined in a
specific range, thus filling up the if else if statements with individual
device IDs. For such large table, its now more suitable to use switch case
instead of if else if for improved readability.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-apple.c | 75 +++++++++++++++++++++++------------------
1 file changed, 43 insertions(+), 32 deletions(-)
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index c672ffc97..4e8b01793 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -410,42 +410,53 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
asc->fn_on = !!value;
if (real_fnmode) {
- if (hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO ||
- hid->product == USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS)
+ switch (hid->product) {
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO:
+ case USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS:
table = magic_keyboard_alu_and_2015_fn_keys;
- else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015 ||
- hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015)
- table = magic_keyboard_alu_and_2015_fn_keys, dont_translate_flagged_key = true;
- else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 ||
- hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 ||
- hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 ||
- hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021)
+ break;
+ case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015:
+ case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015:
+ table = magic_keyboard_alu_and_2015_fn_keys;
+ dont_translate_flagged_key = true;
+ break;
+ case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021:
+ case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024:
+ case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021:
+ case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021:
table = magic_keyboard_2021_and_2024_fn_keys;
- else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132 ||
- hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680 ||
- hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213)
+ break;
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J680:
table = macbookpro_fn_keys;
- else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K ||
- hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223 ||
- hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J152F)
- table = macbookpro_fn_keys, dont_translate_flagged_key = true;
- else if (hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K ||
- hid->product == USB_DEVICE_ID_APPLE_WELLSPRINGT2_J230K)
- table = apple_fn_keys;
- else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
- hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
- table = macbookair_fn_keys;
- else if (hid->product < 0x21d || hid->product >= 0x300)
- table = powerbook_fn_keys;
- else
+ break;
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J152F:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J214K:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J223:
+ table = macbookpro_fn_keys;
+ dont_translate_flagged_key = true;
+ break;
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J140K:
+ case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J230K:
table = apple_fn_keys;
+ break;
+ default:
+ if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
+ hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
+ table = macbookair_fn_keys;
+ else if (hid->product < 0x21d || hid->product >= 0x300)
+ table = powerbook_fn_keys;
+ else
+ table = apple_fn_keys;
+ }
trans = apple_find_translation(table, code);
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
2025-02-14 10:05 [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping Aditya Garg
` (2 preceding siblings ...)
2025-02-14 10:08 ` [PATCH v2 4/4] HID: apple: use switch case to assign devices to their respective fn mapping Aditya Garg
@ 2025-02-18 19:59 ` Jiri Kosina
2025-02-18 20:08 ` Aditya Garg
2025-03-04 20:23 ` Jiri Kosina
4 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2025-02-18 19:59 UTC (permalink / raw)
To: Aditya Garg
Cc: Benjamin Tissoires, bentiss, Alex Henrie, jose.exposito89,
bruners, seobrien, Linux Kernel Mailing List, linux-input
On Fri, 14 Feb 2025, Aditya Garg wrote:
> From: Aditya Garg <gargaditya08@live.com>
>
> The only difference between the fn mapping of the MacBook Pros with esc key
> and those without is of the presence of KEY_GRAVE in the translation table.
>
> We can easily use a flag instead of writing the whole table again to omit
> it from the models that have an esc key.
>
> Additionally, APPLE_IGNORE_MOUSE quirk was unused in this driver, so has
> been removed in this commit.
>
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
Why am I getting v1, [RESEND v1] and v2 in the timespan of 1 day without
any documentation whatsoever what are the changes between the individual
submission and why do we have so many of them?
Thanks in advance for clarification,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
2025-02-18 19:59 ` [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro " Jiri Kosina
@ 2025-02-18 20:08 ` Aditya Garg
2025-02-19 16:43 ` Aditya Garg
0 siblings, 1 reply; 10+ messages in thread
From: Aditya Garg @ 2025-02-18 20:08 UTC (permalink / raw)
To: Jiri Kosina
Cc: Benjamin Tissoires, bentiss, Alex Henrie, jose.exposito89,
bruners, seobrien, Linux Kernel Mailing List, linux-input
Hi Jiri
> On 19 Feb 2025, at 1:29 AM, Jiri Kosina <jikos@kernel.org> wrote:
>
> On Fri, 14 Feb 2025, Aditya Garg wrote:
>
>> From: Aditya Garg <gargaditya08@live.com>
>>
>> The only difference between the fn mapping of the MacBook Pros with esc key
>> and those without is of the presence of KEY_GRAVE in the translation table.
>>
>> We can easily use a flag instead of writing the whole table again to omit
>> it from the models that have an esc key.
>>
>> Additionally, APPLE_IGNORE_MOUSE quirk was unused in this driver, so has
>> been removed in this commit.
>>
>> Signed-off-by: Aditya Garg <gargaditya08@live.com>
>> ---
>
> Why am I getting v1, [RESEND v1] and v2 in the timespan of 1 day without
> any documentation whatsoever what are the changes between the individual
> submission and why do we have so many of them?
I'll make sure changelog is provided next time.
RESEND was done because I forgot to Cc the mailing lists. Its my fault here
V2: I was suggested to use switch case by a colleague later that day, so added 4/4
>
> Thanks in advance for clarification,
>
> --
> Jiri Kosina
> SUSE Labs
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
2025-02-18 20:08 ` Aditya Garg
@ 2025-02-19 16:43 ` Aditya Garg
0 siblings, 0 replies; 10+ messages in thread
From: Aditya Garg @ 2025-02-19 16:43 UTC (permalink / raw)
To: Jiri Kosina
Cc: Benjamin Tissoires, bentiss, Alex Henrie, jose.exposito89,
bruners, seobrien, Linux Kernel Mailing List, linux-input
Hi Jiri
I would also like to mention that these patches were made from the for-next branch of your hid tree.
> On 19 Feb 2025, at 1:38 AM, Aditya Garg <gargaditya08@live.com> wrote:
>
> Hi Jiri
>
>> On 19 Feb 2025, at 1:29 AM, Jiri Kosina <jikos@kernel.org> wrote:
>>
>>> On Fri, 14 Feb 2025, Aditya Garg wrote:
>>>
>>> From: Aditya Garg <gargaditya08@live.com>
>>>
>>> The only difference between the fn mapping of the MacBook Pros with esc key
>>> and those without is of the presence of KEY_GRAVE in the translation table.
>>>
>>> We can easily use a flag instead of writing the whole table again to omit
>>> it from the models that have an esc key.
>>>
>>> Additionally, APPLE_IGNORE_MOUSE quirk was unused in this driver, so has
>>> been removed in this commit.
>>>
>>> Signed-off-by: Aditya Garg <gargaditya08@live.com>
>>> ---
>>
>> Why am I getting v1, [RESEND v1] and v2 in the timespan of 1 day without
>> any documentation whatsoever what are the changes between the individual
>> submission and why do we have so many of them?
>
> I'll make sure changelog is provided next time.
>
> RESEND was done because I forgot to Cc the mailing lists. Its my fault here
>
> V2: I was suggested to use switch case by a colleague later that day, so added 4/4
>
>>
>> Thanks in advance for clarification,
>>
>> --
>> Jiri Kosina
>> SUSE Labs
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
2025-02-14 10:05 [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping Aditya Garg
` (3 preceding siblings ...)
2025-02-18 19:59 ` [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro " Jiri Kosina
@ 2025-03-04 20:23 ` Jiri Kosina
2025-03-05 3:33 ` Aditya Garg
4 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2025-03-04 20:23 UTC (permalink / raw)
To: Aditya Garg
Cc: Benjamin Tissoires, bentiss, Alex Henrie, jose.exposito89,
bruners, seobrien, Linux Kernel Mailing List, linux-input
On Fri, 14 Feb 2025, Aditya Garg wrote:
> From: Aditya Garg <gargaditya08@live.com>
>
> The only difference between the fn mapping of the MacBook Pros with esc key
> and those without is of the presence of KEY_GRAVE in the translation table.
>
> We can easily use a flag instead of writing the whole table again to omit
> it from the models that have an esc key.
>
> Additionally, APPLE_IGNORE_MOUSE quirk was unused in this driver, so has
> been removed in this commit.
>
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
> drivers/hid/hid-apple.c | 72 ++++++++++++++++-------------------------
> 1 file changed, 27 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> index 49812a76b..e31c9e8e8 100644
> --- a/drivers/hid/hid-apple.c
> +++ b/drivers/hid/hid-apple.c
> @@ -30,7 +30,7 @@
> #include "hid-ids.h"
>
> #define APPLE_RDESC_JIS BIT(0)
> -#define APPLE_IGNORE_MOUSE BIT(1)
> +/* BIT(1) reserved, was: APPLE_IGNORE_MOUSE */
> #define APPLE_HAS_FN BIT(2)
> /* BIT(3) reserved, was: APPLE_HIDDEV */
> #define APPLE_ISO_TILDE_QUIRK BIT(4)
> @@ -43,7 +43,8 @@
> #define APPLE_IS_NON_APPLE BIT(11)
> #define APPLE_MAGIC_BACKLIGHT BIT(12)
This patch is corrupt -- the context lines are missing the leading space.
For some reason, it's only the 1/4 which is corrupted, the rest is fine.
Can you please look into this and resubmit?
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
2025-03-04 20:23 ` Jiri Kosina
@ 2025-03-05 3:33 ` Aditya Garg
2025-03-05 4:11 ` Aditya Garg
0 siblings, 1 reply; 10+ messages in thread
From: Aditya Garg @ 2025-03-05 3:33 UTC (permalink / raw)
To: Jiri Kosina
Cc: Benjamin Tissoires, bentiss, Alex Henrie, jose.exposito89,
bruners, seobrien, Linux Kernel Mailing List, linux-input
Hi Jiri
>
> This patch is corrupt -- the context lines are missing the leading space.
> For some reason, it's only the 1/4 which is corrupted, the rest is fine.
>
> Can you please look into this and resubmit?
I sent another patchset yesterday since common tables were becoming confusing for people, so dropped those patches.
Please review this patchset:
https://lore.kernel.org/linux-input/F4DF8D56-7095-43AE-A788-F10B8CE477B0@live.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping
2025-03-05 3:33 ` Aditya Garg
@ 2025-03-05 4:11 ` Aditya Garg
0 siblings, 0 replies; 10+ messages in thread
From: Aditya Garg @ 2025-03-05 4:11 UTC (permalink / raw)
To: Jiri Kosina
Cc: Benjamin Tissoires, bentiss, Alex Henrie, jose.exposito89,
bruners, seobrien, Linux Kernel Mailing List, linux-input
> On 5 Mar 2025, at 9:03 AM, Aditya Garg <gargaditya08@live.com> wrote:
>
> Hi Jiri
>>
>> This patch is corrupt -- the context lines are missing the leading space.
>> For some reason, it's only the 1/4 which is corrupted, the rest is fine.
>>
>> Can you please look into this and resubmit?
>
>
> I sent another patchset yesterday since common tables were becoming confusing for people, so dropped those patches.
>
> Please review this patchset:
>
> https://lore.kernel.org/linux-input/F4DF8D56-7095-43AE-A788-F10B8CE477B0@live.com/
You may also want to review this small patch, which is related:
https://lore.kernel.org/linux-input/4CBC715A-59C2-4815-8D90-62683850E176@live.com/T/#u
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-03-05 4:11 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-14 10:05 [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro fn mapping Aditya Garg
2025-02-14 10:06 ` [PATCH v2 2/4] HID: apple: Use common table for Magic Keyboard aluminium and 2015 " Aditya Garg
2025-02-14 10:07 ` [PATCH v2 3/4] HID: apple: simplify logic for swapping only left sided option and command keys Aditya Garg
2025-02-14 10:08 ` [PATCH v2 4/4] HID: apple: use switch case to assign devices to their respective fn mapping Aditya Garg
2025-02-18 19:59 ` [PATCH v2 1/4] HID: apple: Use common table for MacBook Pro " Jiri Kosina
2025-02-18 20:08 ` Aditya Garg
2025-02-19 16:43 ` Aditya Garg
2025-03-04 20:23 ` Jiri Kosina
2025-03-05 3:33 ` Aditya Garg
2025-03-05 4:11 ` Aditya Garg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®