Return to

Keypads and Linux Gaming


Linux Gaming has taken massive strides in the last year. But the one area that it is severely lacking in is support for keypads (probably could include game pads and gaming mice). I have the Razor Nostromo, had it long before permanently switching to the Linux OS. I have tried everything I can find to get it to work, including third party drivers and software. I looks like Linux natively sees it as a keyboard, and all its keys are mapped for the left side of a keyboard (I can type, somewhat, with it). I have seen a few articles on remapping keyboards but they are far to vague, one would almost need to know how to do it already to understand the articles. My biggest concern is if I should mess up my primary keyboard while following one of these vague articles. As such I am unwilling to try them untill I am 100% certain my main keyboard will not be affected. Because, if it does effect it, I could be disastrous trying to undo the damage without being able to type/find certain letters (can’t type commands, or passwords or edit config files). And even if I should manage to remap its keys, I am going to have to spend a chunk of time, every time I fire up a different game, to remap the keys.

I am hoping there is some fantastic, and super detailed, article/tutorial on creating a script to remap the keys on a particular keyboard (keypad). I then just need to create a script for each game.

But better yet would be some software that works with multiple keyboards and could store multiple profiles. I did look, but the few I found were severely out of date and didn’t work. And a key mapping utility seems like a great way for someone to hide a key logger.

Also would be more inclined to just buy a different keypad that will just work with Linux and games running in wine, that allows for multiple key profiles.



First I am just going to quickly mention the OpenRazor project that does support Nostromo.

I do agree with you that current set-up for remapping keys comes from the previous limited idea. Linux deals with key mapping basically as part of X configuration. Used to be xmodmap and now it is xkb. There is some development in the area and I will try to search and follow up.

Good news for you there are 3 layers possible:
a) Graphical system has its own layer and it is not affected by console settings. (Keywords xkb, xmodmap)
b) Console has its own setup as well (dumpkeys, loadkeys)
c) “Driver” level can be used for filtering scan codes for devices.

The a and b are not really affecting each other so it is pretty save.
The only dangerous one is c, but it is the one you want the most.
Since you are using a pad, it should not be difficult to have mappings specific for the device (worse scenario: using two keyboards)

Quick introduction:

Sorry for the quick response, but I have been gaming on windows since pass-through became a thing :smiley:



To add to this;

Many, many windows people come to Linux expecting that one needs specially optimised drivers for gaming hardware. Well, it mostly doesn’t, simply because there is very little need for it. Linux allows you to do all the crazy stuff even without special drivers, though it is a little harder to find that exact setting for your program.

Not saying drivers are entirely unnecessary, but most of it boils down to simple utility programs that changes settings on a per-application level.

As for your specific problem, I think the main problem is that Linux treats your keypad as a regular keyboard and may or may not have a decent way to rebind keys to individual keyboards.



The OpenRazor project seems promising. I ran across it about a year ago, and I have it installed. But it has terrible documentation. It has an API, and I was thinking fantastic I can build whatever I need. But without any documentation they may as well not have any API at all. I have worked with poorly documented API’s and they are a nightmare, but no documentation is a whole new level that I don’t have the time or energy to deal with.

Now I see that there is a few applications that use OpenRazor. Polychromatic looks to be part of the OpenRazor project, it finds the Nostromo but there is no options to change anything. I also tried RazerGenie again it finds my Nostromo, and even gives me the correct serial number, but again there is nothing there for me to change. For troubleshooting they both point you to OpenRazors troubleshooting page which is part of that terrible documentation. It has a few things to try which I did, I even looked at the logs and nothing there stood out to me.

Like I said OpenRazor looks promising but its about as useful as not having it at all.

Now that article on “Map scancodes to keycodes” I have seen it before. the first hurdle is dealing with some out-of-date, and, in a couple places, incorrect information. Second, is the article needs more information. It looks like you need to use the evdev, in the 60-keyboard.hwdb file, to set the device you are looking to remap keys on. They direct you to use the lsusb command to get some identifying information on your devices, and after looking at the myriad of examples in the 60-keyboard.hwdb file, what lsusb gives me does not seem to be sufficient (note: i also tried lsusb -v the verbose option).

I think editing the 60-keyboard.hwdb file to have multiple profiles for my Nostromo could work, I would just commented out the “profiles” I am not currently using. But I need just a bit more information to pull that off. And it is still a bit clunky, as you have to reload the hardware database index each time you make a change, so an option like the OpenRazor project would be nicer if it worked.



Ok, found more information and maybe someone can help me out with one last thing.

First, I found this article, Linux keymapping with udev hwdb by searching for keyboard.hwdbafter seeing another poorly written article about remapping keys. It is far better at walking one through mapping a keyboard or in this case a keypad. And I it may help with mapping extra keys on gaming keyboards and maybe even gaming mouse.

Here the file I made, for my Razor Nostromo, following the instructions in that article. Note the evdev line is actually comprised of 3 different parts of the devices identifying information.

# This file is to remap keys on the Razor Nostomo.
# Profile name here
# Top Row
 KEYBOARD_KEY_7002b=1                              # Default "tab"
 KEYBOARD_KEY_70014=2                              # Default "q"
 KEYBOARD_KEY_7001a=3                              # Default "w"
 KEYBOARD_KEY_70008=4                              # Default "e"
 KEYBOARD_KEY_70015=5                              # Default "r"
# Middle Row
 KEYBOARD_KEY_70039=6                              # Default "capslock"
 KEYBOARD_KEY_70004=7                              # Default "a"
 KEYBOARD_KEY_70016=8                              # Default "s"
 KEYBOARD_KEY_70007=9                              # Default "d"
 KEYBOARD_KEY_70009=0                              # Default "f"
# Bottom Row
# KEYBOARD_KEY_700e1=                              # Default "leftshift"
# KEYBOARD_KEY_7001d=                              # Default "z"
# KEYBOARD_KEY_7001b=                              # Default "x"
 KEYBOARD_KEY_70006=space                          # Default "c"
# Keys by Joystick
# KEYBOARD_KEY_7002c=                              # Default "space"
 KEYBOARD_KEY_700e2=b                              # Default unknown
# Joystick
# KEYBOARD_KEY_70052=                              # Default "up"
# KEYBOARD_KEY_70051=                              # Default "down"
# KEYBOARD_KEY_70050=                              # Default "left"
# KEYBOARD_KEY_7004f=                              # Default "right"
# Scroll Wheel
# KEYBOARD_KEY_90003=                              # Default middle mouse button

However when I run sudo systemd-hwdb update I get this error

/etc/udev/hwdb.d/Razor-Nostromo.hwdb:31: Property expected, ignoring record with no properties

Line 31 is the last line. I originally made the file in gedit, but then I opened it in Geany as I suspected it may have hidden characters after line 31. And in Geany it did have the extra line after line 31, so I deleted it, but after saving the the extra line returns.

I am fairly good at programming but I have never had to worry about blank lines in code. By just looking at the 60-keyboard.hwdb file I knew no blank line were allowed. So how does one force Geany or some other editor to not put a line break (LF) at the end of a file. Or am I misreading that error.



I have to wonder how it is I find the most unusual errors. I used Duckduckgo and searched for Property expected, ignoring record with no properties in quotes ("), and got 3 results, Google gave me 12 results. One of the replies in one of those results had an incoherent mention of a space. Turns out you need a space in front of all of the KEYBOARD_KEY_xxxxx lines.

Just in case anyone wishes to use the code in the above post I did edit it to fix my mistake.

Now to built a GUI to do all this and store multiple profiles. Never done this in Linux, if you got tips I’m all ears.



For GUI programming, I’d go with Python 3 and GTK+ since the majority of distributions have more or less settled on Gnome, and most other DEs have chosen GTK+ as their preferred Desktop toolkit (with the notable exception of KDE).

Please make it open source, that way it can be added to the repositories and might even be a part of the settings dialog one day. :slight_smile:

1 Like


Thanks for the tip. It’s the little things that one doesn’t know that can make a difference.

Oh and definitely open source. I have used a decent number of open source programs over the years, some for 20+ years, and so I figure a good reimbursement is to make things open source.



Sorry, just came here to say FOSS is life!

1 Like


I believe there is a Daemon that switches the mappings, something you might want to look into.

Try to keep it in a linux mindset - layers of simplicity. Daemon, GUI with pam.d support. If you layer it right, each layer will be simple and stable.

Good solution would be appreciated not just for gamers, but editors and other workstation style users.



I fully agree. There is a non-profit organization I help out with tech stuff. And I have had to deal with windows 10 lately. One hurdle in switching them over is a couple special input devices. I would either need a Linux driver or to be able to remap the keys. And then I am wondering if the remotes that are used for Power Point (my deepest apologies for the MS reference) type presentations would work in Linux or not. And then you have other devices like sketch pads, and special controlers that are used for 3D modelling, steering wheels, joysticks, VR controlers and on and on the list goes. Most this stuff will be seen as either a mouse or a keyboard and it looks like remapping the keys for either is fairly straight forward.

I am baffled that something doesn’t already exist. I got the Python side of the code done in about 24 hours, and I haven’t used Python in 7 to 8 years. It finds all the user input devices. Can create the remapping file. And store the device info and any additional remapping profiles in a config file.

Yea then there is GTK. I am at a dead stop figuring it out. I figure I should use the latest versions of Python 3 and GTK 3, so I don’t have to think about migrating for quite some time. But there is almost nothing for information. The “hello world” tutorials get you to the point that opens the a GUI window but after that figuring out how to work with the various elements is like diving into a black hole, everything you thought you knew about how the universe works, is worthless. I have tried twice to post in these forums, and on stack overflow, but I feel the post are far too broad and complex to get any kind of answer. I am beginning to question my programming skills, as some people are figuring out how to use it, what do they know that I don’t?



Yeah, the GTK+ documentation is no MSDN, that’s for sure. Found this, no idea if that helps you:

Since PyGTK is a mapping to the C / C++ interface, perhaps reading how it works in a C language can help:

It’s not ideal (since it’s C) but it’s something. Also, take a look at the C++ documentation:

If you have the time, please, please help with the docs for PyGTK. It’s an area which is sorely missing.



Never had to do much with MSDN, well maybe a bit with C#, can’t remember. I will admit I am a bit spoiled, really matured my programming skills in PHP, but right along side that MySQL and Javascript. But Python and Ruby are fairly well documented, and even the C++ documentation is workable, mostly do to having multiple resources. I even navigated through LUA’s documentation in its early days. I have also worked with tough API’s like Quickbooks, and the early days of SalesForce (much better now). So I am no stranger to working with bad documentation, but this is on an entirely different level.

I currently have the first 2 you mentioned open in my browser windows, as well as And a few others that keep showing up in searches, that I reopen for a bit until I realize why I closed them previously.

A thought occurred to me while typing the above, so there is about 5 hours of research between what is above and what follows.

I am changing my tacked on the problem, to capitalize on my strength. As you can see above I have worked with quite list of programming languages, and that just scratches the surface. I picked up most the languages I know from working with someone elses code. Either adding features to some code, or fixing old or broken code, or migrate code from one language to another. I had to learn languages that I barely knew or had never even used (and sometimes under a severe time crunch). So, in this case, what I did was find some open source projects (good working ones) that use Python 3 and GTK 3, and I found a few and downloaded the code. Now I will work through their code, and see if I can figure out what makes this monster tick.

1 Like