Need Direction / Key mapping

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Drake2k

Need Direction / Key mapping

Post by Drake2k »

This is interesting....
For the last few years I've been using Mint. I've never EVER been able to get a game pad that I use for various games and MMO's to work. So I just use windows for gaming.

Well, after trolling around Google I wanted to see if anyone made any progress. Didn't really come up with much.

So today, I put LinuxMint 9 KDE on my laptop. I just wanted to try it out for the hell of it though I normally use Gnome.

I plugged this Ideazon (now Steelseries) Fang into my USB port. I opened up a text editor and low and behold, this little bugger is working. Sure it's not working perfectly but it's working. I was shocked. Still am.

So here's what I'm reaching out to you for. Some of the keys aren't exactly what I want them to be. Example, the 1 key...I have no idea what it's diong. The other number keys work fine. It will even turn up and down the volume on my laptop (laughable).

What I'm looking for is a way to remap some of the keys. I want 1 to be a 1 instead of whatever it is. I want some other buttons to be other letters on the keyboard instead of what they are.

I've heard of tools for this but I don't have a clue what they are if there really are.

Any ideas?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Old Ruler
Level 5
Level 5
Posts: 550
Joined: Sat Jul 18, 2009 12:43 pm
Location: Shropshire, UK.

Re: Need Direction / Key mapping

Post by Old Ruler »

There's Qjoypad which is a QT-based application so it should work well on Mint KDE. There isn't a package available though, so you would need to build it from the source code tarball. There's a link to the file you need to download and a description of its capabilities here:

http://maketecheasier.com/qjoypad-keybo ... 2010/05/03

Building and installing small applications like this is quite easy, but shout if you need help with it. I'd be interested to know how well it works, if you do go ahead and install it.
Drake2k

Re: Need Direction / Key mapping

Post by Drake2k »

Old Ruler wrote:There's Qjoypad which is a QT-based application so it should work well on Mint KDE. There isn't a package available though, so you would need to build it from the source code tarball. There's a link to the file you need to download and a description of its capabilities here:

http://maketecheasier.com/qjoypad-keybo ... 2010/05/03

Building and installing small applications like this is quite easy, but shout if you need help with it. I'd be interested to know how well it works, if you do go ahead and install it.

This is really interesting. I'm downloading it now to try it out on a actually joypad that I have. Though it's not exactly what I'm looking for. What I have is a game pad that basically simulates certain keys on the keyboard on a separate device. It's got no Y/X axis device. There are no keys on this device that aren't already on a keyboard. So what's the point? Simple, it makes big WASD QE keys for easy reach, puts the entire number row at the finger tips of one hand. Space, print screen, silly things like that real close by. The intended use is so that you can use your mouse in one hand, this in the other and dominate games.

Well, I don't dominate anything but I found it to be very helpful for a left handed person such as myself. Have you ever played an MMO or even a first person shooter that uses WASD and a mouse with the mouse in your left hand? Not easy.

Anyway, I'm going to play with this program you gave me. Who knows maybe there's more to the tool that meets the eye and might be exactly what I need. I'll post results later.
Old Ruler
Level 5
Level 5
Posts: 550
Joined: Sat Jul 18, 2009 12:43 pm
Location: Shropshire, UK.

Re: Need Direction / Key mapping

Post by Old Ruler »

I think I got the wrong end of the (joy)stick a bit. :)

Qjoypad may still be able to remap it, but there may be another way, if the device is just producing keystrokes. I presume it must be doing that at some level, but why all the number keys except '1' work is odd.

There's a useful command line tool which should already be installed and it may be able to tell you what, if anything, the buttons are sending to X windows. It's 'xev'.

Run it and a window will appear on the desktop. Make sure it has the focus (by clicking the titlebar) and then press a key on the Fang. You should see, in the terminal, something like the following which it produced for the 'Win' key:

Code: Select all

KeyPress event, serial 34, synthetic NO, window 0x4800001,
    root 0x15a, subw 0x0, time 7286852, (52,-19), root:(116,4),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x4800001,
    root 0x15a, subw 0x0, time 7286908, (52,-19), root:(116,4),
    state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
The keycode shown can then be mapped to produce any other keystroke using xmodmap:

Code: Select all

xmodmap -e "keycode 133 = 1"
Now, if I press the Win key I see figure 1.

xmodmap, like most Linux command line tools, has a lot of capabilities. Reading its man page will help get the best out of it.

Have fun :)
Drake2k

Re: Need Direction / Key mapping

Post by Drake2k »

This is great stuff, thank you so much. I did xev, not exactly sure how to read it. here's what happens when the number 1 key is pressed on the game pad.

Code: Select all

KeyPress event, serial 31, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54153694, (166,-11), root:(170,12),
    state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54153814, (166,-11), root:(170,12),
    state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
Here is what it looks like when number 1 key is pressed on the keyboard.

Code: Select all

KeyPress event, serial 31, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54200788, (165,-14), root:(169,9),
    state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES,
    XLookupString gives 1 bytes: (31) "1"
    XmbLookupString gives 1 bytes: (31) "1"
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54200854, (165,-14), root:(169,9),
    state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES,
    XLookupString gives 1 bytes: (31) "1"
    XFilterEvent returns: False

So it would seem to me that the trick is simply to get these two to match a bit more then they do. I took a look at a key that I know is working just fine. Here is what happens when I press the W key on the game pad.

Code: Select all

KeyPress event, serial 31, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54284158, (168,-10), root:(172,13),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54284262, (168,-10), root:(172,13),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False
And here is what it looks like when it's pressed on the keyboard.

Code: Select all

KeyPress event, serial 31, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54324007, (166,-9), root:(170,14),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x4400001,
    root 0x28f, subw 0x0, time 54324103, (166,-9), root:(170,14),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False
The w keys on the game pad and the keyboard are almost identical with a few exceptions which I can't pretend to understand.


So by these examples you can see that it appears that all I would need to do is remap the keystroke on the gamepad to what I need it to do. My next step is to try xmodmap as was suggested and see if I can do what needs to be done.

If you're looking at this and something clicks like "Hey, wait, you don't need to do all that...all you need to do is this..." feel free to post. Otherwise, I'll be posting what progress I made with the xmodmap and/or the QJoyPad.

Wish me luck because if we get this to work, it will answer SO many unanswered posts that I've come across.
Drake2k

Re: Need Direction / Key mapping

Post by Drake2k »

qjoypad is a dead end.

The keyboard key 1 is using key code number 10 and this is what xmodmap says about that.
xmodmap -pk

Code: Select all

10         0x0031 (1)      0x0021 (exclam) 0x0031 (1)      0x0021 (exclam)
The gamepad key 1 is using key code number 87 ....

Code: Select all

 87         0xff9c (KP_End) 0xffb1 (KP_1)   0xff9c (KP_End) 0xffb1 (KP_1)
so let's try the suggestion above "xmodmap -e "keycode 87 = 1" since it appears to me that keycode 87 doesn't DO anything. I could be wrong but *shrug*

OMG I think it worked. I hope I didn't knock something else out of the system. See look

Keyboard input 1111111

Game pad input 111111

Thank you so very much.

No all I have to do is go through EVER single key on the game pad and make sure it's doing what it needs to be doing but I"m going to wait a moment first and see what others think of this. I want to make sure by re-assigning 87 I didn't mess something else up.

One quick question, is there a way to restore xmodmap to defaults in case I mess it ALL up?

EDIT: Ok, that key 1 did have something assigned to it. It was the 'end' key on the keypad. Hence KP_end. The other 'end' key between the numpad and keyboard works fine. Having assigned the keycode as I did before I essentially made the number pad key 'end' (while num lock is off) enter a 1 instead of going to the end. Ok, I get it that and I can reverse that but this is still a step in the right direction maybe?
Drake2k

Re: Need Direction / Key mapping

Post by Drake2k »

One more thought....

Seems like Linux is acting as though this device is just another keyboard. If the keyboard is looking at a particular file or key mapping file per say... and if Linux thinks this device is just another keyboard plugged into my machine, then it may be possible that this device is using the same key map file that the keyboard is.

Maybe what I need to do, instead of remapping all the keys and messing up my keyboard...Is somehow have TWO different key map configurations and tell Linux to have the keyboard look at the main one then have this device look at the other so when I remap stuff on the device...it's only changing it's own file instead of the keyboard's.


It's as layman's terms as I can get but I know there is someone out there that understands what I'm saying and can tell me if it's the slightest bit possible.
Drake2k

Re: Need Direction / Key mapping

Post by Drake2k »

I'm stumped.
Locked

Return to “Hardware Support”