Closed Aetf closed 9 years ago
Hm, thank you @Aetf for this information, it's quite impotent. Please post your GNU/Linux distribution, version and kernel version here.
PS. And how did you get a key code 464 for FN key on your Macbook Pro?
Distribution: Archlinux
Kernel: mainline kernel with this patch applied
Output of uname -a
Linux Aetf-Arch-Mac 4.3.0-rc2-mainline #1 SMP PREEMPT Wed Sep 23 14:35:46 EDT 2015 x86_64 GNU/Linux
And for the key code, I'm following the instruction on ArchWiki
Edit:
More test, strange result... Seems fn and lctrl aren't totally swapped. And with this patch, I indeed got a keycode 84 for fn today, which didn't appear when I tested a few weeks ago.
showkey --scancodes
: noneshowkey --keycodes
: 464showkey --scancodes
: 0x1d for press, 0x9d for releaseshowkey --keycodes
: 29showkey --scancodes
: 0x1d for press, 0x9d for releaseshowkey --keycodes
: 29showkey --scancodes
: noneshowkey --keycodes
: nonefn + F10
to muteshowkey --scancodes
: 0x54 for press, 0xd4 for releaseshowkey --keycodes
: 84showkey --scancodes
: 0x1d for press, 0x9d for releaseshowkey --keycodes
: 29Maybe the difference in codes between patched version and not-patched is because of something being changed in kernel with file like hid-ids.h. I've been pushing this patch to mainstream (links in issue #1) and it was built on the latest kernel code with all code requirements for kernel patches, but it was ignored by hid-apple maintainer and may become somehow outdated. I don't know what to do in this situation as for now I don't have enough time to figure it out and don't have 2015's Macbook Pro (if it's device-related thing). If someone has any suggestions please give me a message.
More investigation shows that the driver support for 2015's Macbook Pro was added some version between 4.0.1 and 4.2, so Fn key on 2015's MBP is recognized with a standard key code KEY_FN(464). So no need for a special key code 84. However, this should also be the case for earlier models, not sure why :/
For the problem that when swap_fn_leftctrl disabled, Fn key not working properly, I think I have found the reason.
There should be only one place dealing with changed fn keycode and other parts should be left unmodified. The function apple_input_mapping
is called before hidinput_apple_event
each time a key pressed. Thus modifying function apple_input_mapping
isn't necessary.
If revert apple_input_mapping
to original version, the patch works perfectly both when swap_fn_leftctrl enabled or disabled. Tested using Archlinux stable kernel version 4.2.2.
I have created a PR #10 with the bug fixed and updated against kernel version 4.2.2
Thank you, @Aetf, great job! If anything works as expected after fix then I'm accepting you PR, thanks.
The keycode for Fn key is 464(0x1d0) on my macbook pro, not 84.
After changing Line 40, the module works as expected.
The model identifier is MacbookPro12,1 if that is needed.