Primis' Domain

Vaydeer 9 Key Linux Fix

2024-06-17

Making my Vaydeer 9-Key work in Linux

My previous job was work from home and had a yearly home stipend to purchase things to make our home offices more efficient. Employees could use this for things like a new office chair, headphones, ring lights, plants, etc. Things that you'd find in a real office that aren't managed by IT per-se. One of the things I picked up was a little 9-key keyboard from a company called vaydeer. It's a tiny mechanical keyboard with MX stems and an ESP32 brain. The software provided worked fine for my work macbook and my main Windows PC. You could configure it to hit media keys, combinations (usful for Zoom or teams) and even full chain macros with timings. You don't need the software to run the macros either, they're all stored on the ESP32 after you do the configuration.

A vaydeer 9 key macropad A generic picture of the 9 key. You can pick it up on their website should you feel like having one too.

Linux problems

While the keyboard itself stores the macros and Windows and macOS don't require software to actually be installed for the keyboard to work, it doesn't show up as a normal keyboard either. Due to this it does not work in Linux. It will show up in lsusb as ID 0483:5752 STMicroelectronics USB2.0 HUB but none of the key presses actually register. For a long time this wasn't really an issue, but for the past year my current job (also remote) has us running Ubuntu, and it has been a bit annoying not having my volume, mic mute, and video enable buttons available on my desk. I decided to look into this and it seems I'm not the only one who has these issues either. Thankfully there is a solution.

Listening to hidraw

For some reason, listening to the hidraw file directly activates the keyboard in Linux. This is a weird fix but someone figured it out.

To make the keyboard work, the following script can be used (run as root)

#!/bin/bash

FILES=/dev/hidraw*
for f in $FILES
do
  FILE=${f##*/}
  DEVICE="$(cat /sys/class/hidraw/${FILE}/device/uevent | grep HID_NAME | cut -d '=' -f2)"
  if [ "$DEVICE" == "Vaydeer 9-key Smart Keypad" ]
  then
    printf "%s \t %s\n" $FILE "$DEVICE"
    cat /dev/${FILE} > /dev/null &
  fi
done

I named this file /usr/bin/vaydeer and chmod'd a+x. Running sudo vaydeer in terminal immediately makes the keyboard usable in Linux. Yay!

Linux udev rules

We can go one step further and create a udev rule that runs that script whenever the keyboard is detected by the kernel. It's a simple one line rule that should go in /etc/udev/rules.d I named mine 82-vaydeer.rules. The number is slightly arbitary, the kernel always runs lower numbered rules first though, so keep that in mind.

The file contains the following:

#
# Run the vaydeer hack script to get it working again
#
SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="5752", RUN+="/usr/bin/vaydeer"

That's it, Whenever the vendor:product ID filter from lsusb is matched, run the script we created. Now whenever you plug in the 9-key (or switch your KVM input back to your linux machine) it will automatically work the way it's supposed to, just like it does in Windows and macOS.

🏷 Linux
🏷 Hardware