Skip to content

Linux, Razer, and Hardware

Published: at 10:33 AM

I have recently solved this issue, sadly by using Windows, but I would still love any feedback or ideas if you think you have a solution

I have a real humdinger I’m trying to solve.

When I moved over to Pop!_OS (my current Linux distro), I did so knowing that I would have to make some changes, and go outside the box for certain games, tools, etc. I was ready for this. Yet I could not predict this one issue.

Razer Devices

I currently am a Razer woman. I have three devices from them that I use with glee: Naga Trinity mouse, Huntsman Elite keyboard, and the Tartarus v2. All three devices have worked a treat and I’ve happily used them in gaming, dev, etc for a long, long time.

Razer does not support Linux. If I want to get my pretty colors I have to turn to tools like OpenRazer and the apps associated with them. They work brilliantly to handle the visual RGB delight I enjoy with these devices.

When it comes to remapping keys though, I’ve had to resort to some odd workarounds.

Remapping the future

When it comes to my Tartarus, I change my keymappings at a lower level using udev. udev is a device manager for the Linux kernel. Thanks to a fantastic post by PieOrCake1974 on reddit, I was able to figure out how to do this.

As I cannot condone any linking to reddit, I will give a walk through of what I did based on their post. Just know that I am insanely appreciative of PieOrCake1974. They were able to use a blog post from 2017 by yulistic to figure out how to modify their Tartarus keybindings.

My steps

1. Create a tarturus keybinding config.

Considering I play a lot of different games, I created a directory called TartarusConfigs. In there I have a different config named for each game I play. As an example, I have a file called 99-ffxiv.hwdb. The file contains the following code, based off PieOrCake1974’s original configuration:

# Razor Tartarus v2
# FFXIV Profile
# Top row
# Second row
# Third row
# Fourth row
# Thumb button above thumbstick
# Thumbstick
# KEYBOARD_KEY_70052=w
# KEYBOARD_KEY_70051=s
# KEYBOARD_KEY_70050=a
# KEYBOARD_KEY_7004f=d
# Thumb button below thumbstick

Step 2: Load Config

In order to make sure that when I play FFXIV this specific keybinding is loaded for the game I have a file called which contains the following code:


sudo cp ./99-ffxiv.hwdb /etc/udev/hwdb.d/
sudo systemd-hwdb update
sudo udevadm trigger

When this script is called, it updates my keybindings on the Tartarus and I’m good to go.

Razer Naga Trinity Issue

From the moment I moved over to Linux the issue I have had with my Trinity Mouse revolves around the 12 key on the side. For those who are unaware, this mouse is an MMO type mouse with the 1-12 keys for your thumb.

Every single one of those buttons works perfectly except for the 12 key. The 12 key never worked and it confused me.

Today, I decided to investigate. To do this, I had to go back to yulistic’s article.

The Investigation

Step 1: Identify the device in question

In order to figure out which device I am trying to target I used cat /proc/bus/input/devices. From there I was able to find the following:

I: Bus=0003 Vendor=1532 Product=0067 Version=0111
N: Name="Razer Razer Naga Trinity"
P: Phys=usb-0000:00:14.0-9/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.0/0003:1532:0067.0005/input/input30
U: Uniq=00000000001A
H: Handlers=mouse1 event5
B: EV=17
B: KEY=1f0000 0 0 0 0
B: REL=903
B: MSC=10

I: Bus=0003 Vendor=1532 Product=0067 Version=0111
N: Name="Razer Razer Naga Trinity"
P: Phys=usb-0000:00:14.0-9/input2
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.2/0003:1532:0067.0007/input/input31
U: Uniq=00000000001A
H: Handlers=sysrq kbd event6 leds
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffefffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=1532 Product=0067 Version=0111
N: Name="Razer Razer Naga Trinity"
P: Phys=usb-0000:00:14.0-9/input1
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.1/0003:1532:0067.0006/input/input32
U: Uniq=00000000001A
H: Handlers=sysrq kbd event7
B: EV=10001f
B: KEY=33eff 0 0 483ffff17aff32d bfd4444600000000 1 130c730b17c007 ffbf7bfad941dfff febeffdfffefffff fffffffffffefffe
B: REL=1040
B: ABS=100000000
B: MSC=10

Considering the mouse has multiple types of input: mouse buttons, scroll, keypad, this makes a lot of sense. This also revealed that the there are 3 handlers I needed to watch in order to get the scancode and the keycode so that I could remap to my hearts content. The 3 handlers I needed were event5, event6, and event7.

2. Identify the scancode and keycode

To do this, I used evtest which you can get using sudo apt install evtest.

Through trial and error, I was able to find that the keypad on the side of the mouse was handled by using sudo evtest /dev/input/event6.

When I pressed the 1 key on the mouse’s keypad, evtest showed me this:

Event: time 1698921617.965942, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7001e
Event: time 1698921617.965942, type 1 (EV_KEY), code 2 (KEY_1), value 0
Event: time 1698921617.965942, -------------- SYN_REPORT ------------

This tells me the scancode is 7001e. The keycode is 1. This works brilliantly for every single key press. Even the 11 key on the keypad shows what I expect:

Event: time 1698921842.319911, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7002d
Event: time 1698921842.319911, type 1 (EV_KEY), code 12 (KEY_MINUS), value 0
Event: time 1698921842.319911, -------------- SYN_REPORT ------------

If I was just mapping these two keys to something else I could easily set up a config for the Trinity numpad using similar steps from above by creating a file named 99-trinity.hwdb with the following information:

# Razor Naga Trinity
# remaps 1 and 11 on the mouse keybad to b and x respectively.

So now time to figure out what the hell is going on with the 12 on the keypad.

The key information

When I press the 12 on the keypad, there is a delay in the response. It’s not immediate like all the other keys are. I do get this result though:

Event: time 1698922170.247258, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70014
Event: time 1698922170.247258, type 1 (EV_KEY), code 16 (KEY_Q), value 0
Event: time 1698922170.247258, -------------- SYN_REPORT ------------

This is not what I expected at all!

First, why is there a delay? Second, q? Huh? What the hell? So, tested each key, and tried to set it to what I expected to see…an equal. My new config is this:

# Razor Naga Trinity
# Expected behaviour
# Top row
# Second Row
# Third Row
# Forth Row

I loaded the new config and tested it. Every key is exactly what I expect…kind of. The 12 key now shows the correct mapping to equal but there is a delay before it shows. To quote friends of mine :thinking_emoji:.

Event: time 1698922321.646287, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70014
Event: time 1698922321.646287, type 1 (EV_KEY), code 13 (KEY_EQUAL), value 0
Event: time 1698922321.646287, -------------- SYN_REPORT ------------

To figure this out, I got my hands on the beautiful GUI for Linux input_remapper.

Deeper look with visuals instead of terminal.

What this revealed was insane to me. Once I installed and loaded up the remapper I was presented with this:

Input Remapper Device List

Going into the Trinity, I saw there was a “new preset” option and selected it. I was presented with this screen.

Input Remapper Razer Naga Trinity new preset profile

I then went to add a new input and had it record the key I wanted to remap. What it revealed confused the ever living flapjack out of me.

Input Remapper reveals the problem

The reason I am getting a delay is that for some reason that key, when pressed, is trying to press a macro combo. This was only revealed to me because input-remapper is so awesome. You can see that it does see the button as mapped to “equal” as expected. But for some unknown reason there is also a “Button LEFT” which honestly confuses me to no end.

Further testing

With the help of a friend, we tested by looking at event5, event6, and event7 at the same time.

Event5 handles the mouse clicks. Event6 handles the keypad. Event7 is unique and who knows.

When the 12 key is pressed. Event5 shows this:

Event: time 1698927874.501468, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1698927874.501468, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1698927874.501468, -------------- SYN_REPORT ------------

Event6 shows this:

Event: time 1698927874.519475, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70014
Event: time 1698927874.519475, type 1 (EV_KEY), code 13 (KEY_EQUAL), value 0
Event: time 1698927874.519475, -------------- SYN_REPORT ------------

This shows that when pressing the 12 key on the Razer Trinity Naga, it is indeed triggering two buttons. Which makes zero sense to me since I have it set in my config to only be 1 key press of Equal.


Please, help.

If you have any idea what is actually going on here, please reach to me on Mastodon. I’m really confused! evscan didn’t hint at this except for the delay, and this is outside my normal scope of knowledge. Would love to hear from someone who can help guide me!