Created
August 3, 2019 13:00
-
-
Save rhomel/346d80ffde9619b8300d0030d3c621e5 to your computer and use it in GitHub Desktop.
Remap the function keys on an Anker slim bluetooth keyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Invert Anker A7726 Keyboard FN Keys | |
# | |
# This is the keyboard I bought: | |
# https://www.amazon.co.jp/gp/product/B00U260UR0/ | |
# But the fn keys default to media keys which is very annoying. | |
# | |
# This will make the FN media keys function as F keys without pushing the FN | |
# button. Also you can still use the media keys by pushing the FN + Media key | |
# combination. | |
# | |
# Place this file in the udev hwdb directory: | |
# /etc/udev/hwdb.d/99-AnkerBT-keyboard.hwdb | |
# | |
# Run the following to apply the new mapping immediately: | |
# | |
# $ sudo systemd-hwdb update && sudo udevadm trigger | |
# | |
# CAUTION: Because Anker functions are split into 3 event devices, Gnome may | |
# not recognize the new keys until restarted. | |
# | |
# Basic process to find these mappings: | |
# | |
# The Anker keyboard will show up as three event devices. You can see all three | |
# after running: | |
# | |
# $ sudo evtest | |
# | |
# No device specified, trying to scan all of /dev/input/event* | |
# Available devices: | |
# /dev/input/event0: Sleep Button | |
# /dev/input/event1: Power Button | |
# /dev/input/event2: Power Button | |
# ... | |
# /dev/input/event14: Anker A7726 Keyboard | |
# /dev/input/event15: Anker A7726 Consumer Control | |
# /dev/input/event16: Anker A7726 System Control | |
# | |
# The media keys are part of "Consumer Control" while the normal F keys are | |
# part of "Keyboard". | |
# | |
# Select each and push each key to get the scancode output. This is the example | |
# for the "Back/Esc" key under "Consumer Control" device: | |
# | |
# Event: time 1564823511.343137, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0224 | |
# Event: time 1564823511.343137, type 1 (EV_KEY), code 158 (KEY_BACK), value 1 | |
# Event: time 1564823511.343137, -------------- SYN_REPORT ------------ | |
# Event: time 1564823511.367005, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0224 | |
# Event: time 1564823511.367005, type 1 (EV_KEY), code 158 (KEY_BACK), value 0 | |
# Event: time 1564823511.367005, -------------- SYN_REPORT ------------ | |
# | |
# The scan code is the "value c0224" part. | |
# | |
# Add the scan code to this file with the format: | |
# | |
# KEYBOARD_KEY_c0224=esc | |
# | |
# to change the key function. | |
# | |
# The device match string parts can be found at the top of the evtest outputr: | |
# | |
# Input device ID: bus 0x5 vendor 0x291a product 0x8502 version 0x11b | |
# Input device name: "Anker A7726 Keyboard" | |
# | |
# Be careful when converting this to the udev format because the letters must | |
# be in all caps and exactly 4 hex digits. | |
# | |
# To apply this mapping, use: | |
# | |
# $ sudo systemd-hwdb update && sudo udevadm trigger | |
# | |
# Re-run evtest to check the new mappings for each device: | |
# | |
# $ sudo evtest | |
# | |
# Gnome may not immediately reflect some of the mappings for some reason. So | |
# you may have to restart Gnome to see the changes in the desktop environment. | |
# As long as evtest shows the correct desired key code everything mapped | |
# correctly. | |
# | |
# These links are helpful: | |
# - https://github.com/hakimel/reveal.js/wiki/Linux-udev-keys-binding | |
# - https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes | |
# | |
evdev:input:b0005v291Ap8502* | |
KEYBOARD_KEY_c0224=esc # Original: KEY_BACK | |
KEYBOARD_KEY_c0223=f1 # Original: KEY_HOMEPAGE | |
KEYBOARD_KEY_c0070=f2 # Original: KEY_BRIGHTNESSDOWN | |
KEYBOARD_KEY_c006f=f3 # Original: KEY_BRIGHTNESSUP | |
KEYBOARD_KEY_c0221=f4 # Original: KEY_SEARCH | |
KEYBOARD_KEY_c01ae=f5 # Original: KEY_KEYBOARD | |
KEYBOARD_KEY_c00b6=f6 # Original: KEY_PREVIOUSSONG | |
KEYBOARD_KEY_c00cd=f7 # Original: KEY_PLAYPAUSE | |
KEYBOARD_KEY_c00b5=f8 # Original: KEY_NEXTSONG | |
KEYBOARD_KEY_c00e2=f9 # Original: KEY_MUT | |
KEYBOARD_KEY_c00ea=f10 # Original: KEY_VOLUMEDOWN | |
KEYBOARD_KEY_c00e9=f11 # Original: KEY_VOLUMEUP | |
KEYBOARD_KEY_c0030=f12 # Original: KEY_POWER | |
KEYBOARD_KEY_70029=back # Original: KEY_ESC | |
KEYBOARD_KEY_7003a=homepage # Original: KEY_F1 | |
KEYBOARD_KEY_7003b=brightnessdown # Original: KEY_F2 | |
KEYBOARD_KEY_7003c=brightnessup # Original: KEY_F3 | |
KEYBOARD_KEY_7003d=search # Original: KEY_F4 | |
KEYBOARD_KEY_7003e=keyboard # Original: KEY_F5 | |
KEYBOARD_KEY_7003f=previoussong # Original: KEY_F6 | |
KEYBOARD_KEY_70040=playpause # Original: KEY_F7 | |
KEYBOARD_KEY_70041=nextsong # Original: KEY_F8 | |
KEYBOARD_KEY_70042=mute # Original: KEY_F9 | |
KEYBOARD_KEY_70043=volumedown # Original: KEY_F10 | |
KEYBOARD_KEY_70044=volumeup # Original: KEY_F11 | |
KEYBOARD_KEY_70045=power # Original: KEY_F12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I bought a logitech k380 with this problem. Royal PIA. So I picked up an anker today seeing that it specifically has a "windows" mode that can be set on the keyboard. No good either. I put in your change and now the the function key work like they should.
Now I will try to follow what you've done and create a udev file for the logitech which is a much nicer keyboard.