While you're here, please consider supporting GamingOnLinux on:
Reward Tiers:
Patreon. Plain Donations:
PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Reward Tiers:
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register
- Nexus Mods retire their in-development cross-platform app to focus back on Vortex
- Canonical call for testing their Steam gaming Snap for Arm Linux
- Windows compatibility layer Wine 11 arrives bringing masses of improvements to Linux
- European Commission gathering feedback on the importance of open source
- GOG plan to look a bit closer at Linux through 2026
- > See more over 30 days here
- Weekend Players' Club 2026-01-16
- CatKiller - Welcome back to the GamingOnLinux Forum
- simplyseven - A New Game Screenshots Thread
- JohnLambrechts - Will you buy the new Steam Machine?
- mr-victory - Game recommendation?
- JSVRamirez - See more posts
How to setup OpenMW for modern Morrowind on Linux / SteamOS and Steam Deck
How to install Hollow Knight: Silksong mods on Linux, SteamOS and Steam Deck
New to forums but followed the site for a few years now. I have used the Belkin Nostromo n50 and n52 and the Razer Tartarus on both W and Linux for a number of years, but since I upgraded my box from Ubuntu 16.04 to 18.04 my remapping software does not function as its supposed to. I can tell it is doing some kind of mapping because the n52 has LED lights that I can map to any key and they do indeed blink when I use them, but the keys do not function when remapped to standard US keyboard keys.
I have tested this on a fresh Ubuntu MATE 18.04 install and a live USB 16.04 version on a laptop, thus verified its not just my installation.
The Python program is called Pystromo and has been around since about 2008, but the creator of the program no longer wishes to help with troubleshooting or anything. It seems to me that either something in the newer kernel dealing with input has changed or it could be with Python itself (libraries or some such). The original code was for Python 2, and another person on Github has a repo with (supposedly) Python3 compliant code but it does not work for me with either 16.04 or 18.04, returning some error messages in the terminal about unable to find modules.
I am no coder or programmer so I have no idea what might be the cause nor how to apply a fix. I am asking for help or a kind pointing-out where to ask for help getting this program to function correctly. Here is a link to my Github page https://github.com/TherinS/Pystromo where you can find copies of the original programs and a few blank map files you can use to test with. I will upload some simplified instructions soon to help with installing and using Pystromo, as the instructions included in the tar.gz file jump around alot.
Pystromo should work with ANY USB device as long as it is wired or the "lsusb" command recognizes it because Pystromo uses the USB ID to apply the remapped keys. For example, I found I could remap the buttons on my Razer Mamba wireless mouse, but there is no pass-through for the LED so it can only act as keyboard button presses when moving the mouse around. For any other USB device I think it should work great, maybe even for a USB keypad device (imagine one key bound to CTRL-ALT-T and another to type "sudo apt update" and "return" key, or entering alias names).
I eagerly await your replies or questions....
As a first step, you could try installing the missing python 3 module dependencies with apt, or if that fails, pip. You might also want to try running the script as root if you didn't already. This could be an uinput permissions issue.
The 0.6.1 version returns error like the following:
2018-12-26
changes to pystromo files
----- v61
Map picker Zenity script runs fine untill last lines,
where it loads the selected map file using pystromo-remap.py
The following errors occured with these actions:
Run as is, the following error occurs:
** ERROR ONE **
Traceback (most recent call last):
File "./pystromo-remap.py", line 22, in <module>
from lib import mapping
File "/home/steveum-ssd/software/Pystromo-master/pystromo/lib/mapping.py", line 7, in <module>
from config import _BaseConfig
ImportError: cannot import name '_BaseConfig'
** END OF ERROR ONE **
===== STEPS TAKEN =====
1)put "python" at end of file home/steveum-ssd/.config/caja/scripts before ./pystromo-remap.py
Result= error after 'import ioctl' from import devices
about no module named ioctl
** FULL TEXT OF ERROR **
Traceback (most recent call last):
File "./pystromo-remap.py", line 23, in <module>
from lib import devices
File "/home/steveum-ssd/software/Pystromo-master/pystromo/lib/devices.py", line 10, in <module>
import ioctl
ImportError: No module named ioctl
** END**
2)put "#!/usr/bin/env python3" at beginning of
/home/steveum-ssd/software/Pystromo-master/pystromo/lib/devices.py
Result=same as first error
3)-put "#!/usr/bin/env python3" at beginning of
/home/steveum-ssd/software/Pystromo-master/pystromo/lib/ioctl.py
Result=same as first error
Whizse noted above that the python3 version (0.6.1) apparently has some missing/erroneous code in it, so that may explain why that version fails. Perhaps someone would be willing to poke further and make the 0.6.1 (Python3) version work? That would future proof the program, as Python2 is being slowly phased out.
I am unfamiliar enough with Python that I was unaware modules could be installed like normal packages; I thought the entire Python library was installed by default. To back my assumption, I just now opened Synaptic on this Ubuntu 18.04 box and searched for the package "ioctl"; there were no matching results for that name specifically.
Please let me know what other info you might need to help me with this, but running the program and checking the results for yourself might be the best way, as I cannot reply with what error messages it throws when there are none. I do appreciate your replies though and I wish to continue this exchange.
If that's the case, you might be able to solve it by adding an udev rule (like steam controller users had to do at some point I think).
Try a more recent keymapper like Antimicro:
https://github.com/AntiMicro/antimicro
no more under development but more recent.
Or if you have a Steam controller, use sc-controller:
https://github.com/kozec/sc-controller
Yes, I tried both apt and pip install ioctl, one of the "cannot find" errors the 0.6.1 version displayed and no such package was found in Ubuntu 18.04.
When you talk about permissions, you may be on to something. Do I need to add the user to a udev rules setting somewhere? As stated in the installation script and the 0.6.0.tar.gz package on installing Pystromo (which are both available in my Github link), there is a step that looks like the following:
echo 'uinput' >> /etc/modulesmodprobe uinput
cp $install_path/pystromo/config/52-pystromo-debian.rules /etc/udev/rules.d/
udevadm control --reload-rules
udevadm trigger
If I need to add the user to a group to have udev rules access, what is the command to do that?
When I type $ groups I get this:
adm cdrom sudo dip plugdev games lpadmin sambashare
There is no udev group so what should I add myself to?
@legluondunet:
Yes, I ran
$ sudo ./pystromo-remap.py -m ./custom_maps/n52-KFtest.mapand had no different effect: only the remapping of the keys to light up the LEDs on my Nostromo n52 had any effect. Any other normal keyboard keys resulted in no discernable output.
Antimicro does not support anything but hand held controllers, I have found. No support for Belkin/Razer gameboards.
I do not have a Steam controller, just a Madcatz, XBox 360 and PS4 controllers. Thanks for the suggestion though.
The thing is that I have been using Pystromo to remap the keys on my Nostromo n50, n52, and Razer Tartarus in Ubuntu 12.04, 14.04, and 16.04, plus older versions of PCLinuxOS and Linux Mint and it has worked fine until Ubuntu 18.04 and the latest PCLinuxOS. Again, I verified on my 16.04-to-18.04 upgrade box, a fresh 18.04 Ubuntu MATE install, and a live USB of Ubuntu MATE that the 0.6.0 version does do SOMETHING, but only outputs LED lights changing. I then tried a live USB of Ubuntu MATE 16.04 and it indeed worked exactly like I expected, with all key remapping working just fine. To me that could mean a kernel/Python2 change with the way permissions or input are handled or a location of where the file(s) is supposed to go.
Feel free to visit the Github page I mentioned in my first post and use the easy install script, but check the readme first in case you don't like where I have it install stuff. I will upload some simplified instructions for making .map files for devices in the next couple days.
Thanks and looking forward to replies...
pystromo-remap.py -v -v -v -v -m test.mapUsing output: <lib.devices.OutputDevice object at 0x7fa55b4bf050>
Loading mappings
test.map
Using device: <InputDevice "ultraxkeyboard" on 3 device nodes>
Incoming event: <Event timestamp=1558482457.31721, type='EV_KEY', code='KEY_TAB', value=1>
Outgoing event: <Event timestamp=1558482457.32799, type='EV_KEY', code='KEY_1', value=1>
Incoming event: <Event timestamp=1558482457.397204, type='EV_KEY', code='KEY_TAB', value=0>
Outgoing event: <Event timestamp=1558482457.407962, type='EV_KEY', code='KEY_1', value=0>
grep'ing through the source, it doesn't look like it's using UI_SET_KEYBIT, not sure if that's the problem?
(I still need to upload decent instructions for configuring new devices but until then they can be found with a web search.)
An example of something that does not have a driver loaded by the kernel is the Logitech G13 gameboard. You can see it is recognized by doing "$ lsusb" but there is no driver so it does not respond at all in my tests. There are a couple of projects for that and I can link to them if there is interest.
https://github.com/TherinS/Pystromo
If anyone has some suggestions for getting it to work on 18.04, please reply here. You can easily run this in a live session and test it out. The install script I have on my page makes it easy to install and the documentation I added should help alot in getting it set up. I don't want to have to put a bounty on Bountysource .com to get this working but I will if that is the best bet.
Edit: sorry I don't think that any of the applications linked to OpenRazer is able to perform key remapping, and I'm under impression that it's not actually possible because of lack of support for such a feature in OpenRazer daemon (I may be wrong). :|
Edit(2): @TherinS, ok just see your comment on Github / Polychromatic... forget my post! :whistle:
Thank you for the suggestion to check antimicro with my gameboards, but I found that the n52, Tartarus, and Logitech G13 models were not even detected by antimicro v2.23 and the n50 was partially detected. All 10 keyboard keys on the n50 activated and deactivated as expected in antimicro, along the throttle wheel, but the left and up on the D-pad would remain in an active state when triggered and down and right on the Dpad were not detected at all. There could be a case made for using antimicro with the n50 using only the 10 row keys, so that's a partial win.
Flight sticks may indeed work just fine and I do have an older Logitech one but its in the closet, due to me not having many games that require its use. If antimicro gained support for the Belkin/Razer gameboards I would definitely consider using the program but in its current compatibility it is not right for me.
Lets keep this up though!
I did the first line but the result, even after a reboot, was no change in keybindinds. I then did NOT edit the rules file because I thought it was conditional upon the successful chmod uinput.
I then did "sudo chmod 660 /dev/uhid" and it also resulted in no successful key rebinding, even after a reboot.
Maybe it is a permissions issue that has reared its head between Ubuntu 16.04 and 18.04?
Would you suggest I perform the edit of the .rules file as the center of the quote says anyways?
There is no actual 99-nostromo.rules file, but there is a 52-pystromo-debian.rules file.
It apparently works much like AutoHotkey on Windows, which I haven't used in years, but I remember that it was neat. The scripting was pretty easy, too!
I think I'll give it a try myself. There are at least a dozen ways to remap keys in Linux manually, though none of them are very user-friendly.
Personally, using ancient code is asking for trouble. I can see why you'd like to stick with pystromo though.
Change is awful when you've been using a program for years (or extensions in my case downthemall and flashgot, thankfully I use Pale Moon and Waterfox).
The device I am trying to get Pystromo to work for is a gaming peripheral keyboard from the Razer company. I own the Tartarus and 2 versions of this device which were from the Nostromo line (the n50 and n52) by Belkin before the devices were purchased by Razer. Without key rebinding, the devices merely act like the left half of a standard computer keyboard. Pystromo could also be used for other peripherals such as some game pads and mice.
Autokey is great for changing the function of your main keyboard, but the Tartarus, Orbweaver, and previous generations of these devices are like a secondary keyboard, and have only up to about 30 keys. As stated in a "Issues" thread in the Autokey Github page:
I do not wish to change my main keyboard keys; rather, I need to rebind the keys on the Razer Tartarus I am currently using.
Pystromo:
-is a user-space program (does not require sudo to run).
-currently only has a functional Python2 version
-lacks a gui, but the mapping files are human readable
-can be ran via scripts, terminal, or the right-click script menu
-starts up instantly
-has no discernable input lag
-works great in Ubuntu 16.04 (and derivatives) but ceases to work in 18.04
-is less than 1MB in size, since all the Python libraries are usually already installed
-has alternate key functions. That is, you can program a key to enable a secondary map of the device, with up to 3 different layouts. Maybe it can do more but I've not tried.
-has macro support, supposedly of unlimited length, though I've rarely used macros with the device.
If you have experience with key rebinding one keyboard while a SECOND keyboard is connected and Autokey indeed works for the second keyboard (contrary to what the post from the Autokey Github page says), please let me know and I will eagerly try out Autokey. As it looks now, Autokey does not have the functionality I am desiring.
I found a program that does what I want and I hope someone else will find it useful as well.
It's called key-mapper and, with the exception that it must be called with sudo (unlike Pystromo), works great. I've tried it with my various Belkin/Razer gameboards and only the n50 had issues correctly having all the keys detected. Anyone with a gameboard-like peripheral will likely find it quite useful!
AntimicroX or sc-controller might be programs that work better for controllers but supposedly key-mapper can be used for those as well, though I've not tried it. Maybe this program could be the source of an article, Liam?
I found it here:
https://www.linuxuprising.com/2020/12/remap-keyboard-and-mouse-buttons-on.html
and the Github to download is here:
https://github.com/sezanzeb/key-mapper
Enjoy!
That said, I didn't see they advice to use "sudo" to use this app on their github page.
Where do you read you need sudo for this app?
Last edited by legluondunet on 31 Jan 2021 at 10:29 am UTC
Also, references to the need for sudo can be found here:
https://github.com/sezanzeb/key-mapper/blob/main/readme/usage.md#configuration-files
here:
https://github.com/sezanzeb/key-mapper/issues/18
here:
https://github.com/sezanzeb/key-mapper/issues/19
and here:
https://github.com/sezanzeb/key-mapper/issues/12
Only the first link I posted specifically states the need for sudo as part of the usage instructions and the other three are for issues other users have posted.
I hope you see that I have not blindly posted a suggested program without giving it a go first, but it is good to question unsolicited recommendations, lest there be a glut of "I dunno if this works or not LoL" postings.
*****
EDIT: I did find that after a reboot:
1) You can call and disable the mapping for a device from the command line WITHOUT invoking sudo. Installing key-mapper makes it start on boot, but if you wish to stop/start the service from CLI, you must do so using sudo. If you are ok with it running on boot then no sudo is needed after the initial installation.
2) The device must be plugged in before issuing the command for it to take effect, but there appears to be no harm in calling it a second time if you forget to plug in the device the first time.
3) The only reason to call up the GUI is to create new mappings since it needs sudo to read input devices, but if you understand the .json files well enough to create the mapping without the GUI, you should not even need the GUI at all.
4) I was able to plug in multiple gameboards (n52 and Tartarus) at the same time and call mappings for each device without conflict! Really handy if you have a couple devices plugged in, though I don't see myself using it much.
Last edited by TherinS on 31 Jan 2021 at 10:19 pm UTC