DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 970,177 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
klo2k
klo2k

Posted on

Keychron K5 Function Keys + Unstable Bluetooth fix - Ubuntu 22.04

If you have problem getting the F1 - F12 (Function) keys to work, and unstable bluetooth connection on your new Keychron K5 keyboard, this will hopefully help you.

Here are the fixes that worked for me on Ubuntu 22.04.

Fixing top row keys as F1 to F12

So you can actually use the function key row as function keys:

  1. Set keyboard to Windows mode (use hardware switch)
  2. Hold Fn + X + L for 4 seconds to switch to "Function" mode
  3. Apply the fix temporarily --> check if it's working:

    echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
    
  4. Apply the fix permanently:

    echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf
    sudo update-initramfs -u
    
  5. Reboot (to verify)

Fixing unstable Bluetooth Connection

Before this fix the keyboard would randomly disconnect.

After this fix, not a single glitch the entire workday πŸ˜‹

  1. Enable fast connect:

    Edit /etc/bluetooth/main.conf - uncomment and set these values:

    FastConnectable = true
    ReconnectAttempts=7
    ReconnectIntervals=1, 2, 4
    
  2. Disable bluetooth auto suspend

    echo "options btusb enable_autosuspend=n" | sudo tee /etc/modprobe.d/btusb_disable_autosuspend.conf
    sudo update-initramfs -u
    
  3. Restart bluetooth

    sudo modprobe -r btusb
    sudo systemctl restart bluetooth
    sudo modprobe btusb
    
  4. Factory reset keyboard (Hold Fn + Z + J for 4 seconds) --> Re-pair keyboard

    This makes no sense but it did seem to make a difference...

Credits

This post is possible thanks to these awesome people:

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.