Logitech MX Keys Mac keyboard on Fedora 41

Since upgrading to Fecora 41 my keyboard, which was working fine on Fedora 40, now types < (less than) instead of ` (backtick) and > (greater than) instead of ~ (tilde). I have searched all over the place and think I narrowed it down to the hid_apple kernel module is not being loaded, and instead hid_logitech_hidpp module is loaded.

Relevant dmesg output:

[    5.259089] input: Logitech MX Keys Mac as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.2/1-4.2:1.2/0003:046D:C52B.0003/0003:046D:4092.0004/input/input15
[    5.296475] logitech-hidpp-device 0003:046D:4092.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech MX Keys Mac] on usb-0000:00:14.0-4.2/input2:1
[    6.606722] logitech-hidpp-device 0003:046D:4092.0004: HID++ 4.5 device connected.
[   14.167389] device-mapper: thin: Data device (dm-2) discard unsupported: Disabling discard passdown.

uname -a

Linux quad 6.12.4-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec  9 20:01:35 UTC 2024 x86_64 GNU/Linux

Is there a way to make the OS use the hid_apple module rather than hid_logitech_hidpp?

What changed to make Fedora 41 choose a different driver for the keyboard?

Edit: Re-post. Accidentally deleted.

1 Like

I think the hypothesis that hid_apple was previously being loaded and establishing a proper keyboard mapping is incorrect. Fedora 40 boot logs also show the keyboard being identified as logitech-hidpp-device, so I have no evidence that the hid_apple kernel module was being used on Fedora 40.

However, the question persists. Why did the keyboard mapping change on Fedora 41?

I wonder if the difference is identified between F40 and F41, or rather between kernels (6.11 vs 6.12)?

Is the keyboard behaving differently before the kernel is loaded, e.g. in the GRUB menu?

I assume there is no change in the keyboard layout, once logged into a graphical session.

When I boot into F40 the keyboard works as expected but in F41 it does not. They both boot from the same bootloader. I’m confused why keyboard behavior before the kernel is loaded would make a difference?

I’m in the middle of a deep dive into XKB keyboard mapping, and have managed to build a new mapping that fixes the issue, so that’s progress. Next time I get a chance to boot into F40 I’ll dump the XKB config to a file with xkbcomp $DISPLAY. That should at least show the mapping differences.

1 Like

The output of xkbcomp $DISPLAY is the same on Fedora 40 as on Fedora 41, so the issue appears to be caused by something other than XKB configuration. I haven’t figured that out yet.

However, I can temporarily solve my issue with this xmodmap command:

xmodmap -e "keycode 94 = grave asciitilde"

Or more persistently with a custom XKB configuration:

/etc/xkb/symbols/tickfix

default partial alphanumeric_keys
xkb_symbols "mx" {
   include "us(basic)"
   name[Group1]="English (US, Backtick/Tilde fix)";

   key.type = "FOUR_LEVEL";
   key <LSGT> { [ grave, asciitilde, section, plusminus ] };

   include "level3(ralt_switch)"
};

/etc/xkb/rules/evdev

! option     = symbols
  tickfix:mx  = +tickfix(mx)

! include %S/evdev

/etc/xkb/rules/evdev.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd">
<xkbConfigRegistry version="1.1">
  <layoutList>
    <layout>
      <configItem>
        <name>tickfix</name>
        <shortDescription>mx</shortDescription>
        <description>English (US, Backtick/Tilde fix)</description>
        <countryList>
          <iso3166Id>US</iso3166Id>
        </countryList>
        <languageList>
          <iso639Id>eng</iso639Id>
        </languageList>
      </configItem>
    </layout>
  </layoutList>
</xkbConfigRegistry>

Use these commands to install the custom keymap in the system and activate it

sudo ln -s /etc/xkb/symbols/tickfix /usr/share/X11/xkb/symbols/

setxkbmap -layout tickfix

It may be necessary to select the new input source in Keyboard Settings to persist it across sessions. I thought I had this working earlier, but it’s not working as expected today.

1 Like

Thank you so much for posting this!

I believe I’m in the same situation as you: I use an MX Keys Mac on Fedora Workstation 41, kernel 6.12.7, Gnome 47.2, Mutter WM. And my tilde/backtick key, left of the “1” key, suddenly started producing “<”/“>”.

I applied the changes you suggested, added the layout to the Gnome Settings and, voilá, everything works fine, again!

Again, thank you!