Menu

Home

Alexandre Hardy

A linux userspace device driver that allows joystick events to be remapped. Several joysticks can be combined into a single controller, and button/axes events can be remapped to new joystick, keyboard or mouse events. Advanced scripting also supported.

For a graphical UI to program the joystick (using this software) please see https://rensg.home.xs4all.nl/rb3d/joymixerUI.html


Project Admins:


Discussion

1 2 3 .. 5 > >> (Page 1 of 5)
  • AsVHEn

    AsVHEn - 2013-11-01

    Hi,
    First of all, thank you for make free software.
    I found your program searching for a way to control my raspberry pi with a pad (SNES USB pad :)). I tried first with joy2key, but it send only ASCII codes without X present (In terminal mode I want to mean)isntead of regular keyboard keys. I need arrows to control a simple menu where to choose XBMC, emulators, X, etc... It's able your program to send "arrows keys" (or maybe it's an imposible, I am severe lack of knowledge on this matter :))?
    Thank you again.

     
    • Alexandre Hardy

      Alexandre Hardy - 2013-11-03

      Yes, you can send arrow keys.

      Have a look at the "kbd" target in config.pdf which is valid for both the "button" and "axis" directives. Also look at the key listing in keys.txt. The key names for the arrow keys are "up", "left", "down" and "right".

       
  • AsVHEn

    AsVHEn - 2013-11-05

    Thanks :D.

     
  • Steve

    Steve - 2015-12-11

    Hi, Could you post an example of mapping an axis to a keyboard button? I have tried alot of combos and nothing seems to work, although this will allow the map file to be loaded:
    axis vendor=0x0079 product=0x0011 src=0 target=kbd plus="0" button="up"

     
    • Alexandre Hardy

      Alexandre Hardy - 2015-12-12

      Hi,

      The validation isn't strong enough to pick up all errors (validation sacrificed for faster development, and this was initially software developed only for my own consumption).

      The documentation does provide some hints though. In the case of mapping axes to the keyboard (or buttons) "plus" and "minus" should be used instead of "button".

      So you probably want to write your mapping like this:
      axis vendor=0x0079 product=0x0011 src=0 target=kbd plus="0" minus="up"

      (One keypress per direction of movement of the axis).

       
      • Nicholas Golob

        Nicholas Golob - 2016-01-25

        Hello Alexandre! First off let me say thanks for your piece of software. I have been using this on retropie to map ports to buttons and as long as I stick to the keyboard everything looks fine. I just used the above example to try and map the analog stick and when I use anything but numbers for the plus= or minus=, I get an expected # error. When I map them to a number then I do not get any action. Also when I run loadmap I get this error
        Failed to grab device: Device or resource busy
        Failed to lock device with vendor=0x054c, product=0x0268. Continuing anyway...
        Is there something that I may be doing wrong here?
        PS, it works with button/keyboard mapping even with that error.

        Thanks in advance and thanks again for the package!

         
        • Alexandre Hardy

          Alexandre Hardy - 2016-01-28

          Failed to grab device: Device or resource busy
          Failed to lock device with vendor=0x054c, product=0x0268. Continuing anyway...

          That usually means that some other software has already grabbed the input device for use. So the joymap software is then unable to receive events for that device. You can try use "lsof" to find out if any process has the joystick devices open. (It could be X windows or some other software).

           
      • Alexandre Hardy

        Alexandre Hardy - 2016-01-28

        So you probably want to write your mapping like this:
        axis vendor=0x0079 product=0x0011 src=0 target=kbd plus="0" minus="up"

        My mistake. Seems I don't support that. I'll try get that fixed soon.

         
        • Alexandre Hardy

          Alexandre Hardy - 2016-01-28

          You can work around that if you use the program function. (write some script).

           
        • Alexandre Hardy

          Alexandre Hardy - 2016-02-20

          This should be working now in joymap-0.3. I've also added a flag "binary" so that you can avoid having multiple events triggered when moving an analog stick. It doesn't have any kind of threshold setting though.

          I've only tested via osxjoymap, I have not managed to get USB HID devices accessible in the VM I'm using, so I have only tested that joymap-0.3 compiles under linux.

          Please test to see if your existing programs work, and whether the new implementation of "plus" and "minus" solves your problem.

           
  • Eric Friebis

    Eric Friebis - 2016-01-27

    Hello Alexandre, i'm having a similar problem. My Joystick using Axis.
    With the command jtest i checked if the joystick working anyway.

    sudo jstest --event /dev/input/js0
    that delivers me something like this:

    Driver version is 2.1.0.
    Joystick (MY-POWER CO.,LTD. USB Joystick) has 7 axes (X, Y, Z, Rz, Hat0X, Hat0Y, (null))
    and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6).
    Testing ... (interrupt to exit)
    Event: type 129, time 4116080, number 0, value 0
    Event: type 129, time 4116080, number 1, value 0
    Event: type 129, time 4116080, number 2, value 0
    Event: type 129, time 4116080, number 3, value 0
    Event: type 129, time 4116080, number 4, value 0
    Event: type 129, time 4116080, number 5, value 0
    Event: type 129, time 4116080, number 6, value 0
    Event: type 129, time 4116080, number 7, value 0
    Event: type 129, time 4116080, number 8, value 0
    Event: type 129, time 4116080, number 9, value 0
    Event: type 129, time 4116080, number 10, value 0
    Event: type 129, time 4116080, number 11, value 0
    Event: type 130, time 4116080, number 0, value 0
    Event: type 130, time 4116080, number 1, value 0
    Event: type 130, time 4116080, number 2, value 0
    Event: type 130, time 4116080, number 3, value 0
    Event: type 130, time 4116080, number 4, value 0
    Event: type 130, time 4116080, number 5, value 0
    Event: type 130, time 4116080, number 6, value -32767
    Event: type 2, time 4119050, number 1, value -32767
    Event: type 2, time 4119340, number 1, value 0
    Event: type 2, time 4119770, number 0, value 32767
    Event: type 2, time 4120070, number 0, value 0
    Event: type 2, time 4120520, number 1, value 32767
    Event: type 2, time 4120740, number 1, value 0
    Event: type 2, time 4121140, number 0, value -32767
    Event: type 2, time 4121340, number 0, value 0
    

    The Event types 2 are the four directions i triggered.

    So i deduced that i will have to use the command "Axis", that "number" musst be my "src=" and value means that i must working with "plus" and "minus".
    i tried it with differnt codestyles, at least i tested it with 1 direction. But it won't work. i getting this errors:

    kodi.map (test 1)

    axis vendor=0x0e8f product=0x0003 src=1 target=kbd plus="up"
    axis vendor=0x0e8f product=0x0003 src=1 target=kbd minus="down"
    axis vendor=0x0e8f product=0x0003 src=0 target=kbd plus="left"
    axis vendor=0x0e8f product=0x0003 src=0 target=kbd minus="right"

    button vendor=0x0e8f product=0x0003 src=6 target=kbd button="enter"
    button vendor=0x0e8f product=0x0003 src=4 target=kbd button="esc"

    Error:

    2:1 Expected a number, got up instead.
    3:1 Expected a number, got down instead.
    4:1 Expected a number, got left instead.
    5:1 Expected a number, got right instead.
    Error in map file, nothing done.
    

    kodi.map (test 2)

    axis vendor=0x0e8f product=0x0003 src=0 target=kbd plus="0" minus="up"

    Error:

    kodi.map
    3:1 Expected a number, got up instead.
    Error in map file, nothing done.
    

    Do you see what i made wrong?

     
    • Steve

      Steve - 2016-01-27

      I got this far as well, if you change the button common name (up) to the key number (up=103 according to keys.txt) it will load the config and Kodi, but on button press it will repeat inifinitely and you will have to quit Kodi and loadmap to get it to stop. I think that is some progress but im not sure where to go from there.

       

      Last edit: Steve 2016-01-27
      • Nicholas Golob

        Nicholas Golob - 2016-01-28

        I tried mapping my axis via

        axis vendor=0x054c product=0x0268 src=0 target=kbd plus="103" minus="108"

        and I am not even getting the stuck key symptoms like you are getting. Do I have the syntax right?

         
      • Alexandre Hardy

        Alexandre Hardy - 2016-01-28

        I got this far as well, if you change the button common name (up) to the key number (up=103
        according to keys.txt) it will load the config and Kodi, but on button press it will repeat
        inifinitely and you will have to quit Kodi and loadmap to get it to stop. I think that is some
        progress but im not sure where to go from there.

        My mistake. Since you entered a number, it wasn't processed like normal keys. So no "release key" sequence was inserted. That is why the key gets stuck.

        You can write a short program as a workaround. (Not very nice, but doable).

        eg.:

        In your mapping specify:
        code "axismap.code"

        And then in axismap.code (same directory where you execute joymap from):
        if (js0.a[0] > 128) {
        press("a");
        delay(1);
        release("a");
        }

        Ideally you should do that in a "thread" to free up the event processing loop. It can get a bit complex if you want to do it perfectly (you would need a trigger variable to record that you want to perform the event, which is only reset once the actions are performed).

         
        • Alexandre Hardy

          Alexandre Hardy - 2016-01-28

          xwing.code (under the wiki) provides a detailed example which tries to be exact about event processing that I execute under Mac OS X. Don't think I've pushed all of those features to Linux joymap yet though.

           
        • Steve

          Steve - 2016-01-28

          Thanks for getting back to us Alexandre! Is there any way you can add this to the joymap application as a fix? I will try this tonight and post my results.

           
          • Alexandre Hardy

            Alexandre Hardy - 2016-01-29

            Hi Steve,

            Yes, I will be able to produce a fix with some time. But please don't expect anything too soon. I have been using Mac OS X at home, and need to find some free time to spin up a Linux VM to test the changes.

             
            • Alexandre Hardy

              Alexandre Hardy - 2016-02-20

              This should be working now in joymap-0.3. I've also added a flag "binary" so that you can avoid having multiple events triggered when moving an analog stick. It doesn't have any kind of threshold setting though.

              I've only tested via osxjoymap, I have not managed to get USB HID devices accessible in the VM I'm using, so I have only tested that joymap-0.3 compiles under linux.

              Please test to see if your existing programs work, and whether the new implementation of "plus" and "minus" solves your problem.

               
    • Alexandre Hardy

      Alexandre Hardy - 2016-01-28

      2:1 Expected a number, got up instead.
      3:1 Expected a number, got down instead.
      4:1 Expected a number, got left instead.
      5:1 Expected a number, got right instead.

      Sorry, seems I messed up. joymap doesn't support that. Only numbers can be used.

      You can work around that if you use the program function. (write some script).

       
  • Eric Friebis

    Eric Friebis - 2016-01-28

    Good news, Steve, Buttons are working, but not the axis, seems like the same problem like Nicholas.

    my actual map file:

    axis vendor=0x0e8f product=0x0003 src=1 target=kbd plus="103" minus="108"
    axis vendor=0x0e8f product=0x0003 src=0 target=kbd plus="105" minus="106"
    button vendor=0x0e8f product=0x0003 src=6 target=kbd button="28"
    button vendor=0x0e8f product=0x0003 src=4 target=kbd button="1"
    

    Message while starting the script:

    Found device Logitech USB Receiver (vendor=0x046d, product=0xc52b)
    Found device Logitech USB Receiver (vendor=0x046d, product=0xc52b)
    Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
    Found device MY-POWER CO.,LTD. USB Joystick (vendor=0x0e8f, product=0x0003)
    4 button assignments.
    Failed to grab device: Device or resource busy
    Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...
    Failed to grab device: Device or resource busy
    Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...
    Failed to grab device: Device or resource busy
    Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...
    2 axes assignments.
    Failed to grab device: Device or resource busy
    Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...
    Failed to grab device: Device or resource busy
    Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...

     
    • Alexandre Hardy

      Alexandre Hardy - 2016-01-29

      I didn't respond correctly the previous time. Here was the intended reply:

      Failed to grab device: Device or resource busy
      Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...
      

      That usually means that some other software has already grabbed the input device for use. So the joymap software is then unable to receive events for that device. You can try use "lsof" to find out if any process has the joystick devices open. (It could be X windows or some other software).

       
  • Alexandre Hardy

    Alexandre Hardy - 2016-01-28

    Failed to grab device: Device or resource busy
    Failed to lock device with vendor=0x0e8f, product=0x0003. Continuing anyway...

    That usually means that some other software has already grabbed the input device for use. So the joymap software is then unable to receive events for that device. You can try use "lsof" to find out if any process has the joystick devices open. (It could be X windows or some other software).

     
  • Anish Desai

    Anish Desai - 2016-05-21

    I downloaded and built joymap-0.3 on the raspberry pi 2 but it does not seem to be working. I used a test map where the D-Pad is mapped to the letters a to d and the buttons to the numbers 1 to 4. It works fine with joymap-0.2 in that I can see letters and numbers printed to the console as I press the appropriate buttons. When I try joymap-0.3, there is nothing.

    If you would like more info then please let me know.

     
    • Alexandre Hardy

      Alexandre Hardy - 2016-05-23

      Thanks Anish. I don't have a system to test linux joymap on anymore. I use emulators with limited hardware functionality.

      Please send me the map, so that I can have a look at the exact program. I will try to reproduce in a simulator in the meantime. It may take a few days to get sufficient time to debug this.

       
      • Anish Desai

        Anish Desai - 2016-05-24

        Thank you for your reply, Alexandre.

        Please find attached the loadmap executable as compiled on the Raspberry Pi 2.

         
1 2 3 .. 5 > >> (Page 1 of 5)

Log in to post a comment.