User Tools

Site Tools


guides:udev-rule

udev rules

Folk practices assume you have a keyboard in /dev/input/by-path/. Bluetooth keyboards may not get put there automatically. Lucky for us, we can create a rule to tell the system to put your keyboard there when connected.

This guide assumes you have successfully connected a keyboard following the setup guide.

Getting keyboard information

Every device has a MAC address: a unique name that can be used to identify it with other devices. We can use the bluetoothctl command to get the MAC addresses of paired bluetooth devices.

bluetoothctl devices Paired

On my machine, the output looks like this

So in this case the MAC address is 20:10:01:DE:30:B8.

Adding the rule

Now we have to tell the computer that when a device with that MAC address connects it should attach it to some file in /dev/input/by-path/. You can find more information about udev rules at https://wiki.archlinux.org/title/Udev#udev_rule_example

Create (or edit) a file called /etc/udev/rules.d/99-input.rules. Using my MAC address above as an example, add a line that creates a filepath for your keyboard's MAC address

ATTRS{uniq}=="20:10:01:de:30:b8", SYMLINK+="input/by-path/keyboard-20:10:01:de:30:b8"

Here I use the naming convention keyboard-[[MAC address]], but it really doesn't matter what you name it. Just try to do something that would be unique.

Checking your work

Disconnect and reconnect your keyboard. There should now be a file in /dev/input/by-path/

Folk will now be able to recognize your bluetooth keyboard after restarting (e.g. sudo systemctl restart folk) 🎉

guides/udev-rule.txt · Last modified: 2024/01/14 20:25 by discord

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki