Spamming repeatedly while key is held down...

Asked by Lighttitan

I understand what you were saying in the other question that we closed but I want to elaborate on my question so you can see exactly what I am getting at. Does Pystromo inself have a means of repeating key presses?

I know when you press a key on the Nostromo while using Pystromo that it will repeat the key as you hold the button down. But this is Linux settings that are causing it to do so. Settings that can be found in System -> Preferences -> Keyboard. I need a way to program Pystromo itself to do this repeated key spamming while the button is held down, like the Windows version of the Nostromo programming software could.

The reason I ask this is that in World of Warcraft it differentiates between keys being held down to type messages and keys being held down that are bound to powers. If I hold down the "1" key while typing, it will spam this key in the text I am typing. This is Linux spamming it. However if I hold down the "1" key while not typing, but rather trying to get it to use the power bound to the "1" key, it will not spam it. It won't even cast it until I release the key.

So the problem is that I need Pystromo to press and release the key, pause for about 200 ms and do it again as long as I have the key held down. It can't be the OS doing it.

Ok one other question while I have you here. Does the Pystromo differentiate between the number keys above the letters and the numberpad keys?

For instance KEY_1 is the key above "Q"... if Pystromo can tell that the one on numberpad is different what would it be called?

KEY_NUMPAD1 maybe? I am not sure. Thanks for your fast responses!

Question information

English Edit question
Pystromo Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Lighttitan (dadicus) said :

I found the file so I don't need an answer to that second question, but I still need one to the first question.

Revision history for this message
Raumkraut (raumkraut) said :

If you use Pystromo to remap, say, "e" to repeatedly press "1" every 200ms by using:
KEY_E: KEY_1, 200
Pystromo will send individual KEYUP and KEYDOWN events for the "1" key to Linux every 200ms. As far as Linux is concerned, you are actually pressing and releasing "1" every 200ms, so your desktop settings for key-repeat won't come into it.

You will be able to see this evidenced in the game's chat, or indeed any other text-entry location, in that you will only get a single "1" character every 200ms. You could change the delay to 1000 (1 second) if you want to make it absolutely plain that it's Pystromo doing the repeating!

Revision history for this message
Lighttitan (dadicus) said :

HAHA! That is awesome! It sounds like it can do EVERYTHING I want it too!

Thank you SOOOOOOOOOO much for this program!!!

I am having a problem getting it to work with my Nostromo for some reason. I have the config file setup and have it set to run whenever wine or wow.exe runs and it does load it up, I can see it in my system processes... but for some reason it fails to actually convert my nostromo keys. I have included my config file for your review if you have the time...

I will go through the Readme file again to see if I missed something and try to do all the commands again.


# This file contains demonstration devices and key re-mappings.

## First we must define which devices to 'grab'

# Each [Device:*] section indicates we should grab any input from
# devices which match certain key=value pairs inside that section.
# The string after the colon will be used as the device ID, and should
# be unique. Please keep your device IDs to alpha-numeric characters,
# underscore (_), and minus (-). I may cry if you don't.
# Latterly defined [Device] sections will override previously defined
# [Device] sections with the same ID.
# Valid keys for device-matching are:
# name (string)
# bus (int); see* for valid bus values.
# vendor (int)
# product (int)
# version (int)

# Nostromo n52

## Now we can specify which inputs to remap

# Mappings within this default section apply to all grabbed devices.

# A remapping statement consists of two input:output halves, seperated by a
# colon or equals sign. Whitespace is ignored.
# See for possible values for the in and out-put keys.
# If a remapping is specified more than once, the latter definition will rule.

#The following is Normal shift state keys.
KEY_R:KEY_4, 200
KEY_E:KEY_3, 200
KEY_W:KEY_2, 200
KEY_Q:KEY_1, 200
KEY_F:KEY_8, 200
KEY_D:KEY_7, 200
KEY_S:KEY_6, 200
KEY_Z:KEY_0, 200

#This is the shift state configuration section. It will show red, blue and green configurations.
#This first line above will light the red LED whenever the Capslock key is used.
#This line above will light the green LED whenever the Left Shift key is used.
#The line above will light the blue LED whenever the Left Alt (orange button) is used.

[Map:n52 + LED_NUML]
#The above line with cause all following configurations to only apply when the red LED is light.

KEY_R:KEY_KP4, 200
KEY_E:KEY_KP3, 200
KEY_W:KEY_KP2, 200
KEY_Q:KEY_KP1, 200
KEY_F:KEY_KP8, 200
KEY_D:KEY_KP7, 200
KEY_S:KEY_KP6, 200
KEY_A:KEY_KP5, 200

[Map:n52 + LED_CAPSL]
#The above line with cause all following configurations to only apply when the green LED is light.

KEY_R:KEY_F5, 200
KEY_E:KEY_F4, 200
KEY_W:KEY_F3, 200
KEY_Q:KEY_F2, 200
KEY_D:KEY_F8, 200
KEY_S:KEY_F7, 200
KEY_A:KEY_F6, 200
KEY_C:KEY_F12, 200
KEY_X:KEY_F11, 200
KEY_Z:KEY_F10, 200


I used the vendor and product number from the file you had in the Pystromo config folder. Would the vendor and product number be different for each persons Nostromo? If so, how do I find out what mine is?

The python process in my System processes says "/home/username/.pystromo/trunk/ -m config/"

Let me know if you need any other information.

Revision history for this message
Raumkraut (raumkraut) said :

The vendorId is specific to the vendor (eg. Belkin, Logitech, etc.), and the productId is specific to the model of the device (eg. n52, MX510, etc.). I know that the productId differs between the n50 and n52, and I believe the newer model of n52 - the TE - uses a different productId as well.
The info in is for the classic n52. Are you using the newer n52TE? If so, that could be why it's not picking it up.

You can find out vendor/product IDs by using lsusb at the command line. My n52 is listed as "Belkin Components" (descriptive!). The IDs are listed as two hex-values before the name, in the format: "050d:0815"; the first is the vendor, second product.

Revision history for this message
Lighttitan (dadicus) said :

Mine is the N52... not that n52te one.

This is my belkin:

Bus 002 Device 004: ID 050d:0815 Belkin Components

I am going to give my PC a reboot and play around with it a bit more.

I know I can get your program working for me and it will solve the only and ONLY thing that would make me want to go back to windoze!

I am going to count this question as solved. Thank you SOO much for your help. You are surprisingly fast at getting back with me and VERY helpful!