Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Jkeys - simple joystick to keyboard mapping

  1. #1

    Jkeys - simple joystick to keyboard mapping

    Ok here's a little app I setup so I could use my mythbox with a gamepad and some games

    A lot of linux games dont have joystick support so this little app will map you joystick buttons/axis to key presses

    you run a game by going
    Code:
    jkeys example-config.joy armagetronad
    where example-config.joy is a simple xml file with the key mappings like so
    Code:
    <config>
        <joystick id="0">
            <axis number="0" low="Left" high="Right" />
            <axis number="1" low="Down" high="Up" />
            <button number="0" key="Space" />
            <button number="1" key="Return" />
            <button number="2" key="a" />
            <button number="3" key="b" />
            <button number="4" key="c" />
            <button number="5" key="d" />
            <button number="6" key="z" />
            <button number="7" key="x" />
            <button number="9" key="Escape" />
            <button number="10" key="p" />
        </joystick>
    </config>
    It should allow for multi axis any number of buttons and mutliple joysticks etc, although its only been tested with my gamepad

    I pushed this into a google project if any one is interested in helping out, or just trying it http://code.google.com/p/jkeys/

    Code:
    sudo apt-get install python-xlib python-pygame svn
    mkdir ~/jkeys
    cd ~/jkeys
    svn checkout http://jkeys.googlecode.com/svn/trunk/ jkeys-read-only
    Last edited by KillerKiwi; September 7th, 2008 at 10:22 PM.

  2. #2
    Join Date
    Apr 2007
    Location
    Finland
    Beans
    41
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Jkeys - simple joystick to keyboard mapping

    Thanks to you I could play JamLegend with my dance pad

    I downloaded the Jkeys from SVN and installed python-xlib and python-pygame. Then I made a copy of the example-config.joy and edited it to look like this:
    Code:
    <config>
        <joystick id="0">
            <button number="2" key="Return" />
            <button number="0" key="1" />
            <button number="4" key="2" />
            <button number="1" key="3" />
            <button number="5" key="4" />
            <button number="3" key="5" />
        </joystick>
    </config>
    Then can just ran ./jkeys jam-config.joy firefox and navigate to the JamLegend site and start a game. It's very playable with a dance pad, but a lot more difficult than with a keyboard.

  3. #3

    Re: Jkeys - simple joystick to keyboard mapping

    Awesome i'm glad it worked for you.. I should add a readme about the deps I guess...

    I'm playing with adding mouse support now... it done by adding some key codes
    Mouse_Up, Mouse_Down.... Mouse_Click1 (left mouse button), Mouse_Click3 (right mouse button) etc

    Using a dance pad as a mouse would be interesting ... lol

  4. #4
    Join Date
    Aug 2008
    Beans
    10

    Smile Re: Jkeys - simple joystick to keyboard mapping

    I like this program however I am experiencing one slight problem: This program requires a application name to open So i give it a path name ; /home/user/Desktop/et and it runs the program. Say if i have a bash script running a program that requires additional commands prior to running, I experience a script failure.
    bash script example:

    #!/bin/bash
    #this command will kill all artsd applications prior to running et, this is command needed for sound to work correctly.
    killall -9 artsd
    #note this is the directory which i have the game file at
    cd /usr/share/games/enemy-territory
    #et being the application name
    ./et

    Although this is a small speed bump, the program looks lightweight and promising. thanks for this program contribution.

  5. #5
    Join Date
    Feb 2007
    Location
    Berlin, Germany
    Beans
    42
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Jkeys - simple joystick to keyboard mapping

    Quote Originally Posted by KillerKiwi View Post
    I'm playing with adding mouse support now... it done by adding some key codes
    Mouse_Up, Mouse_Down.... Mouse_Click1 (left mouse button), Mouse_Click3 (right mouse button) etc

    Using a dance pad as a mouse would be interesting ... lol
    Hi

    I try to use my DancePad as a mouse too - did your playing around come to a usable result and/or can you explain me how to do it?

    I tried with js2mouse from http://cedric.vincent.perso.free.fr/Projets/ but with a dancepad that works only for the buttons, because the x/y-navigation is done through the Joystick-Axis-Movement which the Dancepad is missing if i see that right.

    So is there a way to use my USB-DancePad as a mouse, and if yes how do i get it running ;?

    ;j

    Update:
    Okay - it worked - i adapted the config-file and saved it as dancepad-as-mouse.joy - it looks like this:
    Code:
    <config>
        <joystick id="0">
            <button number="0" key="Mouse_Left" />
            <button number="1" key="Mouse_Down" />
            <button number="2" key="Mouse_Up" />
            <button number="3" key="Mouse_Right" />
            <button number="8" key="mouse_click1" />
            <button number="9" key="mouse_click3" />
        </joystick>
    </config>
    Then i did a testrun like this:
    Code:
    jkeys dancepad-as-mouse.joy audacity
    And it worked

    To find out the Button-Numbers of your dancepad install the Joystick-Calibrator, run it, bounce around on your DancePad and write down the Numbers:
    Code:
    sudo apt-get install jscalibrator
    jscalibrator
    Is there a way to assign "diagonal" movement to a Button?
    Like key="Mouse_Up_Left" or something like that?

    Congratulations!
    Neat little Program.
    Seems way easier to use to me than js2mouse.

    Happy New Year!
    Last edited by jonobo; December 31st, 2008 at 07:11 PM. Reason: Answered Question myself. Found a new Question ;)
    7.04 Feisty Fawn on Fujitsu-Siemens Amilo Pro V 2035, Intel Celeron M 370 1.5GHz, 768MB RAM, Graphic: VIA VN800 Mobile, Sound Via AC97, ALPS Touchpad (turned off - death to all touchpads ;!), USB-Mouse, Tascam US-122 USB-Recording-Interface.

  6. #6
    Join Date
    Feb 2008
    Location
    Virginia
    Beans
    459
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Jkeys - simple joystick to keyboard mapping

    jscalibrater is full of fail. Installing it will cause joystick-related headaches. I believe jstest and jscal are the good ones.

  7. #7
    Join Date
    Aug 2006
    Location
    Cebu City, Phil
    Beans
    118
    Distro
    Xubuntu 12.04 Precise Pangolin

    Question Re: Jkeys - simple joystick to keyboard mapping

    anyone made this work with stepmania?
    Linux User #435593 | Xubuntu User #9638

  8. #8
    Join Date
    Jan 2010
    Beans
    12

    Re: Jkeys - simple joystick to keyboard mapping

    Thank you very much for this. I bought a real cheap usb controller and this jkeys did the trick! jscal, etc didn't quite get the job done. Jkeys wins.

  9. #9
    Join Date
    Nov 2006
    Beans
    15

    Re: Jkeys - simple joystick to keyboard mapping

    I tried installing this on Fedora 12 x64. I installed python-xlib and pygame (there is no python-pygame in fedora). Then I run it but I get this:

    Code:
    [gpulido@hal9000 jkeys-read-only]$ ./jkeys fakenes.joy fakenes
    Joystick mappings found : 
     - axis 7 direction low mapped to key Up
     - axis 7 direction high mapped to key Down
     - axis 6 direction low mapped to key Left
     - axis 6 direction high mapped to key Right
     - button 1 mapped to key d
     - button 0 mapped to key s
     - button 10 mapped to key Space
     - button 6 mapped to key Return
    Starting application
    ['fakenes']
    Fatal Python error: (pygame parachute) Segmentation Fault
    Aborted (core dumped)
    [gpulido@hal9000 jkeys-read-only]$
    The segmentation fault happens about a second after I press anything on the gamepad. Any ideas? could it be because my linux is 64 bits?

    Thanks!

  10. #10
    Join Date
    Nov 2006
    Beans
    15

    Re: Jkeys - simple joystick to keyboard mapping

    I just found kbstick: http://www.ditch.org/kbstick/ . It's a pretty old program (2003) but it does exactly what I need. It doesn't support mouse (AFAIK) and it needs some tweaks to compile (some includes are missing) but it works really well.

    Regards.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •