1

I have a MacBook Pro and installed Archlinux on it. I have read their article about Apple Keyboards, and managed to make the function key work properly (meaning pressing F5 actually triggers F5), fix some swapped keys using isolayout and would like to swap the opt and cmd key.

So I have create a file called /etc/modprobe.d/apple_keyboard.conf, and put the following content in it:

options hid_apple fnmode=2 isolayout=0 swap_opt_cmd=1

This works for the internal keyboard of the macbook, but I also have a apple bluetooth keyboard, for which these options don't seem to apply. Especially the opt and cmd key are not swapped for the bluetooth keyboard. I have no idea what I can check, so I would be thankful for any hint.

UPDATE:

Just realized that I have written isolayout instead of iso_layout. If I change that, < and ^ key are switched on the internal keyboard. I don't have the bluetooth keyboard with me, but I'll update on monday to see if it is at least correct with the other keyboard. However, if this is the case I would need a way to differ between both keyboards...

UPDATE

The bluetooth keyboard is still not affected by the iso_layout setting...

UPDATE

I've been told to add the output of dmesg, after plugging the keyboard (I did this by turning it off and on again), and this is what appears:

[56929.073859] hid-generic 0005:004C:026C.000B: unknown main item tag 0x0
[56929.073921] input: Magic Keyboard with Numeric Keypad as /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.3/1-8.3:1.0/bluetooth/hci0/hci0:11/0005:004C:026C.000B/input/input24
[56929.074084] hid-generic 0005:004C:026C.000B: input,hidraw2: BLUETOOTH HID v0.80 Keyboard [Magic Keyboard with Numeric Keypad] on 34:36:3b:ca:dd:71
4
  • Please edit your question with the lines that appear in dmesg after you plug in the bluetooth keyboard.
    – dirkt
    Jan 27, 2018 at 20:57
  • @dirkt Updated. Does look like the keyboard is not using hid_apple at all, right? Jan 30, 2018 at 9:58
  • Yup, looks like a generic HID device. The kernel input layer can remap scan codes to key codes via ioctls, but there are no packaged command line tools. You can try the udev hwdb instead.
    – dirkt
    Jan 31, 2018 at 17:24
  • Hm, I see... Isn't there an easier way to make the bluetooth keyboard also use the hid-apple driver? Feb 8, 2018 at 21:50

1 Answer 1

1

I had the exact same issue when the bluetooth connection was loading hid_generic but the USB connection was loading the correct hid_apple.

What fixed for me was installing the patched hid_apple module from free5lot/hid-apple-patched. Maintainers are frequently syncing upstream with the newest changes on the kernel. In my case installing the patched version on Ubuntu 20.04 with kernel 5.4.0-88-generic fixed the issue and now both bluetooh and USB are using hid_apple so all the options you set on /etc/modprobe.d/hid_apple.conf such as swap_opt_cmd (the one I was struggling with) are working.

Below both the USB and Bluetooth outputs from dmesg -w. Both prefixed with apple, meaning that the patched hid_apple module loaded actually fixed the issue. Besides, the last one shows how it was loading before applying the patched version, using hid-generic.

[70447.039634] apple 0003:05AC:024F.0029: input,hidraw2: USB HID v1.11 Keyboard [Keychron Keychron K8] on usb-0000:00:14.0-2/input0
[70447.039919] apple 0003:05AC:024F.002A: Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling
[70457.404925] input: Keychron K8 as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/bluetooth/hci0/hci0:256/0005:05AC:024F.002B/input/input155
[70457.405245] apple 0005:05AC:024F.002B: input,hidraw2: BLUETOOTH HID v1.05 Keyboard [Keychron K8] on 48:45:20:82:6c:33

Before the installation of the patched module:

[69784.281885] input: Keychron K8 Keyboard as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/bluetooth/hci0/hci0:256/0005:05AC:024F.0028/input/input147
[69784.282213] input: Keychron K8 Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/bluetooth/hci0/hci0:256/0005:05AC:024F.0028/input/input148
[69784.282345] input: Keychron K8 System Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/bluetooth/hci0/hci0:256/0005:05AC:024F.0028/input/input149
[69784.282481] hid-generic 0005:05AC:024F.0028: input,hidraw2: BLUETOOTH HID v1.05 Keyboard [Keychron K8] on 48:45:20:82:6c:33
1
  • The hid_apple module included in Ubuntu 22.04 or later should work without having to install a third-party package. Sep 1, 2023 at 2:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .