Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't not work with MacBook Pro (Retina, 13-inch, Early 2015) #9

Closed
Aetf opened this issue Sep 24, 2015 · 6 comments
Closed

Doesn't not work with MacBook Pro (Retina, 13-inch, Early 2015) #9

Aetf opened this issue Sep 24, 2015 · 6 comments
Labels

Comments

@Aetf
Copy link
Contributor

Aetf commented Sep 24, 2015

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.

@free5lot
Copy link
Owner

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?

@Aetf
Copy link
Contributor Author

Aetf commented Sep 30, 2015

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.

  • w/o this patch
    • fn key works normally
    • fn key
      • showkey --scancodes: none
      • showkey --keycodes: 464
    • leftctrl key
      • showkey --scancodes: 0x1d for press, 0x9d for release
      • showkey --keycodes: 29
  • with this patch and swap_fn_leftctrl enabled
    • leftctrl key works as fn key perfectly
    • fn key
      • showkey --scancodes: 0x1d for press, 0x9d for release
      • showkey --keycodes: 29
    • leftctrl key
      • showkey --scancodes: none
      • showkey --keycodes: none
  • with this patch and swap_fn_leftctrl disabled
    • fn key doesn't work, i.e. can't use fn + F10 to mute
    • fn key
      • showkey --scancodes: 0x54 for press, 0xd4 for release
      • showkey --keycodes: 84
    • leftctrl key
      • showkey --scancodes: 0x1d for press, 0x9d for release
      • showkey --keycodes: 29

@free5lot
Copy link
Owner

free5lot commented Oct 2, 2015

Maybe 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.

@Aetf
Copy link
Contributor Author

Aetf commented Oct 4, 2015

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.

@Aetf
Copy link
Contributor Author

Aetf commented Oct 4, 2015

I have created a PR #10 with the bug fixed and updated against kernel version 4.2.2

@free5lot
Copy link
Owner

free5lot commented Oct 4, 2015

Thank you, @Aetf, great job!
If anything works as expected after fix then I'm accepting you PR, thanks.

@free5lot free5lot closed this as completed Oct 4, 2015
@free5lot free5lot added the bug label Oct 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants