Razer keyboard is know to have faulty or hyper-sensitive wheel that sends ghost signals.
We will force the Linux kernel to interpret those exact USB inputs as “nothing” using the hardware database (hwdb).
Install and run evtest:
sudo apt install evtest
sudo evtest
Look for “Razer keyboard”, type the device number and play with the wheel to see the events that are sent. If multiple Razer devices are listed, repeat until you see that the wheel events get logged.
Note the line describing the device id:
Input device ID: bus 0x3 vendor 0x1532 product 0x228 version 0x111
Also note the lines showing the volume events:
Event: time 1782829329.864625, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00e9
Event: time 1782829329.864625, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 1782829329.868606, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00ea
Event: time 1782829329.868606, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
In this example the bus is 3, vendor id: 1532 and product id: 228 (all hex)
Create a custom hardware override file:
sudo vim /etc/udev/hwdb.d/90-disable-razer-volume.hwdb
and put the following text inside:
evdev:input:b0003v1532p0228*
KEYBOARD_KEY_c00e9=reserved
KEYBOARD_KEY_c00ea=reserved
Replace the bus, vendor id and product id with the output from evtest.
Also make sure that there’s no space before evdev, and that there’s exactly 1 space before KEYBOARD_KEY.
Finally force the kernel to update its hardware assignments:
sudo systemd-hwdb update
sudo udevadm trigger
The volume signals are now completely blocked at the device-driver level.