As keychron is quite a popular brand of mechanical keyboards,
and the information about using https://launcher.keychron.com/ sucessfully on Arch based-distros is a bit cumbersome, as it only sets permission momentarily to access /dev/hidraw*.
Therefore I just wanted to share the info how to setup a udev rule properly, without using plugdev, which seems to be ill advised as stated here.
In short, if you want to configure your keychron keyboard, you’ll need a browser that has WebUSB support (my choice would be ungoogled-chromium-bin). If you’re uncertain if WebUSB isn’t enabled, check permissions via chrome://settings/content/usbDevices. Forks of Firefox don’t support WebUSB, thus you’re stuck to those forks of chrome.
If you’re using a wireless keyboard, in order to configure it properly, you should enable the wired mode of the keyboard and connect it via USB, it won’t work if you’re in wireless model, even if you’re using a keychron link usb reciever to connect the device.
First of all, you’ll need to identify your keyboard via lsusb -d 3434: that should list all keychron devices currently connected via usb. If should report back something like:
Bus 001 Device 002: ID 3434:0a51 Keychron Keychron K5 Max
Bus 001 Device 008: ID 3434:d030 Keychron Keychron Link
We’ll need the vendor ID (3434) as well as the device ID (in this case: 0a51 for my K5 Max).
If you want to update the firmware of the Keychron Link as well, you should also take note of it’s device ID (d030 for mine, there might be different hardware revisions, thus you should better check.)
(you may also retrieve those ID’s via chrome://device-log/ … but those are in decimal notation and we need the hex notation for the udev rules)
Based upon the vendor & device ID’s we could now define a custom udev rule in the /etc/udev/rules.d drop-in configuration folder:
sudo nano /etc/udev/rules.d/50-keychron.rules
and add those entries:
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3434", ATTRS{idProduct}=="0a51", MODE="0660", TAG+="uaccess""
That should allow the required premission for the keyboard to be configured via WebUSB. Unlike the source, where I found that udev rule, it’s not required to set MODE="0666", "0660" is sufficient.
To enable the firmware flashing capabilities, which is usually done via the STM bootloader of the keyboard, which has to be enabled as per instructions of the launcher in DFU mode via connecting it to usb with the escape key pressed down, this last rule should enable the firmware flashing procedure. The idVendor should be 0483 and idProduct df11 and should be universal for all STM devices in DFU mode.
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0660", TAG+="uaccess"
Last but not least If you additionally want to flash the firmware of a Keychron Link reciever, add:
SUBSYSTEM=="usb", ATTRS{idVendor}=="3434", ATTRS{idProduct}=="d030", MODE="0660", TAG+="uaccess"
After the file is written, you should execute
sudo udevadm control --reload-rules as well as
sudo udevadm trigger --subsystem-match=hidraw --action=add and
sudo udevadm trigger --subsystem-match=usb --action=add if you want firmware updating functionality.
To check, simply ls -l /dev/hidraw* if the permissions have been set. The keychron devices should be listed as crw-rw----+ 1 root root via hidraw
Or simply visit https://launcher.keychron.com and once you’ve connected to the HID device, you should be directlly redirected to current keymap overview to make changes.