-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FN_key swap fix for hid-apple-mod patch
- Loading branch information
Showing
1 changed file
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ From: fedora kernel <[email protected]> | |
Subject: patch hid-apple-mod | ||
|
||
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c | ||
index 1cb4199..2760ffe 100644 | ||
index 1cb4199..3f30d04 100644 | ||
--- a/drivers/hid/hid-apple.c | ||
+++ b/drivers/hid/hid-apple.c | ||
@@ -54,6 +54,17 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") | ||
"(For people who want to keep Windows PC keyboard muscle memory. " | ||
"[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); | ||
|
||
+static unsigned int swap_fn_leftctrl; | ||
+module_param(swap_fn_leftctrl, uint, 0644); | ||
+MODULE_PARM_DESC(swap_fn_leftctrl, "Swap the Fn and left Control keys. " | ||
|
@@ -26,7 +26,7 @@ index 1cb4199..2760ffe 100644 | |
@@ -166,6 +177,16 @@ static const struct apple_key_translation swapped_option_cmd_keys[] = { | ||
{ } | ||
}; | ||
|
||
+static const struct apple_key_translation swapped_fn_leftctrl_keys[] = { | ||
+ { KEY_FN, KEY_LEFTCTRL }, | ||
+ { } | ||
|
@@ -40,19 +40,24 @@ index 1cb4199..2760ffe 100644 | |
static const struct apple_key_translation *apple_find_translation( | ||
const struct apple_key_translation *table, u16 from) | ||
{ | ||
@@ -185,6 +206,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | ||
@@ -185,9 +206,11 @@ 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; | ||
|
||
|
||
- if (usage->code == KEY_FN) { | ||
+ u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL) : (KEY_FN); | ||
+ | ||
if (usage->code == KEY_FN) { | ||
+ if (usage->code == fn_keycode) { | ||
asc->fn_on = !!value; | ||
input_event(input, usage->type, usage->code, value); | ||
- input_event(input, usage->type, usage->code, value); | ||
+ input_event(input, usage->type, KEY_FN, value); | ||
return 1; | ||
} | ||
|
||
@@ -266,6 +289,22 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | ||
} | ||
} | ||
|
||
+ if (rightalt_as_rightctrl) { | ||
+ trans = apple_find_translation(rightalt_as_rightctrl_keys, usage->code); | ||
+ if (trans) { | ||
|
@@ -71,9 +76,9 @@ index 1cb4199..2760ffe 100644 | |
+ | ||
return 0; | ||
} | ||
|
||
@@ -329,6 +368,17 @@ static void apple_setup_input(struct input_dev *input) | ||
|
||
for (trans = apple_iso_keyboard; trans->from; trans++) | ||
set_bit(trans->to, input->keybit); | ||
+ | ||
|
@@ -88,7 +93,7 @@ index 1cb4199..2760ffe 100644 | |
+ } | ||
+ | ||
} | ||
|
||
static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
@@ -557,6 +607,10 @@ static const struct hid_device_id apple_devices[] = { | ||
.driver_data = APPLE_HAS_FN }, | ||
|
@@ -101,3 +106,4 @@ index 1cb4199..2760ffe 100644 | |
{ 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), | ||
|