Support us on Patreon to keep GamingOnLinux alive. This ensures all of our main content remains free for everyone. Just good, fresh content! Alternatively, you can donate through PayPal. You can also buy games using our partner links for GOG and Humble Store.
Python key remapping software quit working on upgrade
Page: «2/2
  Go to:
TherinS May 26, 2019
@Patola

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!
TherinS Sep 1, 2019
In a reply from Linux Game Cast, it was suggested that I run the following chmod commands:
Quotesudo chmod 660 /dev/uinput

If that lets you rebind keys, then you can have a look at creating a udev rule to set those permissions for your usergroup only:

edit /etc/udev/rules.d/99-nostromo.rules
Add KERNEL==”uinput”, SUBSYSTEM==”misc”, MODE=”0660″, GROUP=”input”
And then reboot.

If that doesn’t work, you could try applying those permissions to /dev/uhid instead

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.
redneckdrow Sep 1, 2019
There is AutoKey. Its a python 3 port of a python 2 program of the same name that was discontinued.

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).
TherinS Sep 3, 2019
Thank you, Red, for responding and suggesting Autokey. I have heard good things about that program and how handy it can be. However...

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:

QuoteIs there any way to make autokey work only when a secondary keyboard is typed.

I would like to put 2 keyboards on the computer. One keyboard to work normally and the second keyboard to work completely changed by autokey.

Is this possible?
@luziferius
Collaborator
luziferius commented on Jun 1

Currently not. AutoKey uses XRecord to read input and write output.
As far as I know, that API does not provide the original data source, thus distinguishing the source keyboards is not possible.

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.
TherinS Jan 31, 2021
Thread Necromancy!

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!
legluondunet Jan 31, 2021
Quotewith the exception that it must be called with sudo

For me it is directly a valid reason for a no-go!
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 January 2021 at 10:29 am UTC
TherinS Jan 31, 2021
In the process of installing, running, and using key-mapper with 4 different gameboards, I've found that starting the program opens an authentication window which states "Authentication is required to discover and read devices."

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 January 2021 at 10:19 pm UTC
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!
Login / Register


Or login with...
Sign in with Steam Sign in with Google
Social logins require cookies to stay logged in.