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://rb3d.nl/rb3d/joymixerUI.html


Project Admins:


Discussion

<< < 1 2 3 4 5 > >> (Page 3 of 5)
  • Colin Dryden

    Colin Dryden - 2016-08-23

    Hi Alexandre,
    Here are the contents of the .map file I am using. The mappings that I am having trouble with are below. Everything else works perfectly.

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

    As for jsinfo, I compiled it and ran it.

    The first few columns reported zeros for all the buttons. I pressed them and they all returned a 1 like normal.

    The next 4 columns displayed zeros as well, but if I moved the joysticks, they went from -32767 to 32767. They returned to zero once the axes were in the neutral position.

    1st - left stick x axis
    2nd - left stick y axis
    3rd - right sitck x axis
    4th - right stick y axis

    The next three columns contained -32767, 32767 and 32767 respectively. They did not change at all. The remaining columns were all zero and nothing changed them.

    Hopefully the issue stick out like a sore thumb for you because I couldn't actually see what the columns represented...

    Thanks

     
    • Alexandre Hardy

      Alexandre Hardy - 2016-08-23

      Hi Colin,

      I am surprised. It sounds like your joysticks are giving absolute 0 when returned to neutral position. I did not expect that. I would have expected it to oscillate a little bit (that is more typical of rheostat based joysticks).

      I'm going to recomment a starting point to work from, and then we can tweak further from there.

      axis vendor=0x054c product=0x0268 src=0 target=kbd plus="right" minus="left" deadzone=1000 flags=trinary
      axis vendor=0x054c product=0x0268 src=1 target=kbd plus="down" minus="up" deadzone=1000 flags=trinary
      

      This will mean that your key presses will not repeat. The key press will happen once and only once when you push the joystick in a particular direction. Let's see if that works.

      Heh. Also found a bug. Not sure why I didn't see it before...

      You can also try this patch, if you are willing:

      $ diff events.c events.c.orig 
      392,395c392,398
      <                 if (release) {
      <                     sequence=axes_remap[axis]->minus;
      <                     for (i=0; (i<MAX_SEQUENCE) && (sequence[i]!=SEQUENCE_DONE); i++) {
      <                         button=sequence[i]&KEYMASK;
      ---
      >                 for (i=0; (i<MAX_SEQUENCE) && (sequence[i]!=SEQUENCE_DONE); i++) {
      >                     button=sequence[i]&KEYMASK;
      >                     if (sequence[i]&RELEASEMASK) value=0;
      >                     else value=1;
      >                     if (release) value=0;
      >                     press_key(button, value);
      >                     if ((axes_remap[axis]->flags&FLAG_AUTO_RELEASE)&&(value==1)) {
      398,412d400
      <                     sequence=axes_remap[axis]->plus;
      <                     for (i=0; (i<MAX_SEQUENCE) && (sequence[i]!=SEQUENCE_DONE); i++) {
      <                         button=sequence[i]&KEYMASK;
      <                         press_key(button, 0);
      <                     }
      <                 } else {
      <                     for (i=0; (i<MAX_SEQUENCE) && (sequence[i]!=SEQUENCE_DONE); i++) {
      <                         button=sequence[i]&KEYMASK;
      <                         if (sequence[i]&RELEASEMASK) value=0;
      <                         else value=1;
      <                         press_key(button, value);
      <                         if ((axes_remap[axis]->flags&FLAG_AUTO_RELEASE)&&(value==1)) {
      <                             press_key(button, 0);
      <                         }
      <                     }
      

      I'll only be able to test that tonight.

       
      • Colin Dryden

        Colin Dryden - 2016-08-24

        Hi Alexandre,

        I tried the modified mapping you suggested, but with that .map file none of the mappings worked (as if the file wasn't loading at all). I assume this is due to some syntax error, so I tried

        axis vendor=0x054c product=0x0268 src=0 target=kbd plus="right" minus="left" flags="trinary"
        axis vendor=0x054c product=0x0268 src=1 target=kbd plus="down" minus="up" flags="trinary"
        

        Note the only difference is the quotes around trinary. This does load the mapping, and the axes do behave differently - they don't get "stuck" as before. That said, they behave contrary to what you described should happen with the trinary flag. If I push the joystick in one direction, it does not press the key once. (e.g. holding down on joystick scrolls down through a menu in dosbox. Release joystick stops the scrolling)

        Normally I'd be happy because this is actually the behaviour I want, but unfortunately there is another problem - only down and right worked. Pressing the axes left and up responds only once, each time the map is loaded. After I press it once, it no longer works.

        FYI, a dead zone of 1000 must be too large for me because the joystick was unresponsive. I lowered it to 100 to eliminate that as a source of error and the joystick responded again. I'm not too concerned with this because a deadzone doesn't seem to be my issue...

        I tried to learn how to apply a diff file, but I gave up when the site I was reading says patch files start with the line "$ diff original.c new.c". Your diff file seems to have that in reverse, and is actually a patch for the new file (to revert it back to the old file). I might be misunderstanding this... I am fairly ignorant when it comes to programming :)

         
        • Alexandre Hardy

          Alexandre Hardy - 2016-08-24

          Hi Colin,

          I tested on a VM, and you should not need quotes around trinary. Maybe you can post the error message so I can see why that reported an error.

          I worked through the problem a bit, and discovered that the osxjoymap implementation is behaving differently to the linuxjoymap implementation. Which is why I had different expectations.

          So here is the reason why (as far as I can make out) your keys get "stuck". The keys are not being released by the axis mapping (as per my patch, which I have redone properly). When the key events accumulate enough, it appears that new key events are excluded. (Test that on a terminal, hold "a", then add "b", then add "c"). This may come down to the exact software reading the key events, but I think in most cases there are some limits as to how this is processed.

          Anyway. Fixed that so that keys are released (too many times actually, but that doesn't seem to harm anything). The new upload is joymap-0.4.1. I have tested with joymaps own virtual joystick, but testing with real hardware would be appreciated.

           
          • Colin Dryden

            Colin Dryden - 2016-08-26

            Hi again,

            I tested out v4.1 and with the trinary flag it works exactly as I want it to. That is, if I hold the axes down, it acts like down is being held on the keyboard, and it releases when the axes is returned to the neutral position. Great work!

            Without the trinary flag, it does still do some peculiar things though... that is, it won't release. I still need to test more to be able to describe the behaviour better, but for the moment the trinary flag solves everything.

             

            Last edit: Colin Dryden 2016-08-26
  • Colin Dryden

    Colin Dryden - 2016-08-11

    Hi again Alexandre,

    I dug more into the files and in man/loadmap.1 it states:

    Additional flags:
    .TP
    -8 
    Convert reported event range from 0-255 to -32767 to 32767
    .TP
    -d 
    Dynamically (during use) compute calibration value so that events are reported in the range -32767 to 32767
    

    Please help me understand. When I load a map, are the joystick values reported to the program in the range of 0-255? Even if the range is actually -32767 to 32767 natively?

    More to the point, if I'm on the right track, how do I use the flags above to convert the range back to -32767 to 32767 as the program expects...?

    I am trying to use this mapper for the PPSSPP emulator on RetroPie. I am using a PS3 controller. The joysticks work fine when I do not load a map. However, the built in mapper for PPSSPP has too many issues, so I use your program. It works perfectly for all buttons, but I cannot get the joystick to respond correctly.

    Since the axes work with no mapper, I simply tried to map the axes to joyaxis, thinking the program would read them as normal:

    axis vendor=0x054c product=0x0268 src=0 target=joyaxis device=0 axis=0
    axis vendor=0x054c product=0x0268 src=1 target=joyaxis device=0 axis=1
    

    The joysticks were unresponsive.

    Next I tried to map them to the built-in keyboard mapping that PPSSPP uses:

    axis vendor=0x054c product=0x0268 src=0 target=kbd plus="k" minus="i"
    axis vendor=0x054c product=0x0268 src=1 target=kbd plus="l" minus="j"
    

    This causes the program to constantly recieve a "k" input, which of course acts as if the axis is stuck in one direction. That's when I tried the binary flags and was also unsuccessful.

    I'm taking one more crack at understanding how your program works with respect to axes. Ideally I just want to "pass" the joyaxis through to the program without any mapping at all. The only mapping needed is the buttons because the axes work when no map is loaded.

     
    • Alexandre Hardy

      Alexandre Hardy - 2016-08-15

      I dug more into the files and in man/loadmap.1 it states:
      Heh, I had forgotten about that. I'll have to remind myself how that works.

      Please help me understand. When I load a map, are the joystick values reported to the program in the range of 0-255? Even if the range is actually -32767 to 32767 natively?

      It is whatever the linux joystick driver reports. And the linux joystick driver supports calibration, so the values are not necessarily device native values.

      As with most of the projects I have made available, this was developed for my own use, and then made available for others to take and extend as they wished. I was sloppy with some of the values, since it worked perfectly for me (still does, even though I'm using it on OSX now).

      Since the axes work with no mapper, I simply tried to map the axes to joyaxis, thinking the program would read them as normal:

      That should work just fine, it should pass the values through. I read the code quickly for PPSSPP. Are you using SDL? If so, then it seems that SDL will be picking up your joysticks in the order that they are found. loadmap cannot replace /dev/js0 with its own device (not without implementing a custom kernel module). That means that the joymap (loadmap) device drivers will be something like /dev/js1. The statement device=0 axis=0 tells joymap to map this axis to the first joystick that joymap manages, which may in fact be /dev/js1. In that case it won't map to PAD 0 in PPSSPP as far as I can tell.

      loadmap will also (while it is running) prevent other programs from seeing any events from the joystick. That would explain why it is unresponsive (because PPSSPP isn't using the joymap joystick, and joymap is preventing PPSSPP from seeing any joystick events on the PS3 controller).

      The solution to that problem is to run reserve_js at bootup, which will ensure that loadmap always gets /dev/js0 (well, it worked for me in the distant past anyway). This should mean that your controller is unresponsive whenever loadmap is not running, but should work otherwise.

      Let me know if that helps. I'll probably work up the motivation to implement thresholds for the axes at some time. But no promises as to when.

      Kind regards
      Alexandre

       
  • James

    James - 2016-10-10

    Hi Alexandre,

    Thanks for writing this software and open sourcing it! I ran into 2 issues and wanted to provide feedback. I have 2 controllers, one wired the other wireless.

    Issue #1: Button mappings are not working for my bluetooth wireless controller (8bitdo SNES30 Gamepad). I've triple-checked that the vendor ID, product ID, and button codes are correct (the button codes were found using jstest). This controller works fine in other games. The d-pad axis mappings work OK so it's just an issue with the buttons.

    Is there any reason why bluetooth controller button mappings wouldn't work with joymap?

    Loadmap output:

    Found device CHICONY USB Keyboard (vendor=0x04f2, product=0x0833)
    Found device CHICONY USB Keyboard (vendor=0x04f2, product=0x0833)
    Found device 8Bitdo SNES30 GamePad (vendor=0x2820, product=0x0009)
    Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
    

    Mapping config:

    axis vendor=0x2820 product=0x0009 src=0 target=mouse axis=0
    axis vendor=0x2820 product=0x0009 src=1 target=mouse axis=1
    button vendor=0x2820 product=0x0009 src=3 target=mouse button=1
    button vendor=0x2820 product=0x0009 src=0 target=mouse button=0
    button vendor=0x2820 product=0x0009 src=4 target=kbd button="esc"
    button vendor=0x2820 product=0x0009 src=6 target=kbd button="q"
    button vendor=0x2820 product=0x0009 src=7 target=kbd button="a"
    button vendor=0x2820 product=0x0009 src=11 target=kbd button="f5"
    button vendor=0x2820 product=0x0009 src=10 target=kbd button="leftalt x REL x REL leftalt"
    

    Issue #2: The axis mappings for the d-pads on both my wired and wireless controllers work fine with joymap-0.2 and joymap-0.3.1 but do not work in joymap-0.4.1. Here's the mapping config I'm using for the wired controller:

    axis vendor=0x0079 product=0x0011 src=0 target=mouse axis=0
    axis vendor=0x0079 product=0x0011 src=1 target=mouse axis=1
    button vendor=0x0079 product=0x0011 src=0 target=mouse button=1
    button vendor=0x0079 product=0x0011 src=1 target=mouse button=0
    button vendor=0x0079 product=0x0011 src=3 target=kbd button="esc"
    [...]
    

    When I try to use joymap-0.4.1, the mouse cursor immediately moves all the way into the bottom right corner of the screen and I'm unable to move it from there. This does not happen with versions 0.2 or 0.3.1. I have not tested 0.4.0.

    Thanks again for the wonderful software, I appreciate it!

     

    Last edit: James 2016-10-10
    • Alexandre Hardy

      Alexandre Hardy - 2016-10-14

      Hi James,

      I changed the mouse code in joymap-0.4.1 to cater for other users, and to make the mapping more powerful. The mouse movement is directly influenced by the range of joystick values for the axes you have specified. By default the mouse code now assumes a range of -32767 to 32767 (it used to assume 0 to 255, and could not be configured in any way).

      There are now new settings for the mouse axis target. You can specify min, max, deadzone and speed to control the mapping from the joystick to the mouse axis. I suggest you use jstest again to determine the range of values returned when moving the joystick around and then plug that into the min and max setting for the axis. You can then start playing with the deadzone and speed, and see if you can make the mouse more controllable.

      As for the buttons on the bluetooth joystick: I'm afraid I don't have any answer there. It is possible that other software grabbed the device for exclusive use, but then the axes wouldn't work either. There is also the remote chance that what you think is a button is actually reported as an axis, but I can't be sure about that either.

      Maybe you could grab the output of jstest and paste that for further scrutiny?

      It might also help to cat /proc/bus/input/devices and see what that says. That may also provide some hints as to what is going on.

      Kind regards
      Alexandre

       
      • James

        James - 2016-10-15
        Post awaiting moderation.
      • James

        James - 2016-10-15

        Thanks for the help Alexandre, I appreciate it. I ran jstest on my wireless controller (the one with the broken button mappings) and got the following output.

        pi@retropie:~ $ sudo jstest /dev/input/js1
        Driver version is 2.1.0.
        Joystick (8Bitdo SNES30 GamePad) has 8 axes (X, Y, Z, Rz, Gas, Brake, Hat0X, Hat0Y)
        and 16 buttons (BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?, ?, ?, ?).
        Testing ... (interrupt to exit)
        Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:-32767  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:-32767  3:-32767  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:-32767  3:-32767  4:-32767  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:-32767  3:-32767  4:-32767  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:-32767  3:-32767  4:-32767  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off Axes:  0:-32767  1:-32767  2:-32767  3:-32767  4:-32767  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off 15:off 
        

        Here's the contents of /proc/bus/input/devices:

        pi@retropie:~ $ cat /proc/bus/input/devices
        I: Bus=0003 Vendor=04f2 Product=0833 Version=0111
        N: Name="CHICONY USB Keyboard"
        P: Phys=usb-3f980000.usb-1.3/input0
        S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:04F2:0833.0002/input/input0
        U: Uniq=
        H: Handlers=sysrq kbd leds event0
        B: PROP=0
        B: EV=120013
        B: KEY=10000 7 ff800000 7ff febeffdf f3cfffff ffffffff fffffffe
        B: MSC=10
        B: LED=7
        
        I: Bus=0003 Vendor=04f2 Product=0833 Version=0111
        N: Name="CHICONY USB Keyboard"
        P: Phys=usb-3f980000.usb-1.3/input1
        S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.1/0003:04F2:0833.0003/input/input1
        U: Uniq=
        H: Handlers=kbd event1
        B: PROP=0
        B: EV=13
        B: KEY=ff0000 0 0 0 0 0 0 0 0 2000000 387a d801d001 1e0000 0 0 0
        B: MSC=10
        
        I: Bus=0003 Vendor=0079 Product=0011 Version=0110
        N: Name="USB Gamepad "
        P: Phys=usb-3f980000.usb-1.2/input0
        S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:0079:0011.0001/input/input2
        U: Uniq=
        H: Handlers=event2 js0
        B: PROP=0
        B: EV=1b
        B: KEY=3ff 0 0 0 0 0 0 0 0 0
        B: ABS=3
        B: MSC=10
        
        I: Bus=0005 Vendor=2820 Product=0009 Version=0100
        N: Name="8Bitdo SNES30 GamePad"
        P: Phys=b8:27:eb:48:29:ce
        S: Sysfs=/devices/platform/soc/3f201000.uart/tty/ttyAMA0/hci0/hci0:11/0005:2820:0009.0006/input/input83
        U: Uniq=e4:17:d8:a1:66:68
        H: Handlers=event3 js1
        B: PROP=0
        B: EV=1b
        B: KEY=ffff0000 0 0 0 0 0 0 0 0 0
        B: ABS=30627
        B: MSC=10
        

        I'll keep trying things and post updates if I make progress. Thanks again.

         
        • Alexandre Hardy

          Alexandre Hardy - 2016-10-15

          Thanks James.

          I notice that with jstest none of the buttons were ever reported as on.

          Now jstest only seems to report 15 buttons, but /proc/bus/input/devices shows that the SNES30 GamePad has 16 buttons, but if I read that correctly, the buttons start at button 16 and end at button 31.

          So you probably need to add 16 to your src field for each button on the SNES30.

          Kind regards
          Alexandre

           
          • James

            James - 2016-10-15

            That worked! Thank you so much Alexandre! Do you have a Paypal or Amazon wishlist? I'd be happy to make a donation. I'm building a system as a gift for my father and it means a lot to me that he'll be able to play his favorite old DOS games again.

            To clarify, the jstest output above is what gets printed when I start the program. I had not yet pressed any buttons, hence everything reported as "off".

            Thanks again!

             
            • Alexandre Hardy

              Alexandre Hardy - 2016-10-15

              Thank you for the kind offer. No donation of any sort is necessary, as I developed this mostly for my own use in my spare time and decided that sharing it would be a good idea since I benefit from so many open source projects.

              Kind regards
              Alexandre

               
  • Dan McGoo

    Dan McGoo - 2016-10-11

    Hello Alexandre,

    I would suggest you to look at the following patch.
    It fixes an issue that I found when trying to map the mouse wheel to joystick buttons.

    Regards,

     
    • Alexandre Hardy

      Alexandre Hardy - 2016-10-14

      Thanks Dan,

      Good catch!

      Kind regards
      Alexandre

       
  • James

    James - 2016-11-02

    Hi Alexandre! I ran into another issue I thought you might have insight on. I'm unable to get the "shift" feature to work. I tried to debug the issue using evtest to dump the target event output but nothing appears for the shifted button mapping. joymap seems to work just fine for non-shifted mappings. Is the "shift" flag still supported? I'm using joymap-0.4.1.

    joymap mapping file:

    axis vendor=0x0079 product=0x0011 src=0 target=joyaxis axis=0 min=0 max=255 deadzone=127
    axis vendor=0x0079 product=0x0011 src=1 target=joyaxis axis=1 min=0 max=255 deadzone=127
    
    button vendor=0x0079 product=0x0011 src=6 target=kbd button="q"
    button vendor=0x0079 product=0x0011 src=4 target=kbd button="t" flags="shift"
    shift vendor=0x0079 product=0x0011 src=8
    

    joymap output:

    pi@retropie:~ $ sudo ~/joymap/joymap-0.4.1/loadmap ./game.map
    1 joysticks.
    joystick0 axes=2 buttons=0.
    Found device CHICONY USB Keyboard (vendor=0x04f2, product=0x0833)
    Found device CHICONY USB Keyboard (vendor=0x04f2, product=0x0833)
    Found device USB Gamepad  (vendor=0x0079, product=0x0011)
    Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
    5 button assignments.
    4 axes assignments.
    

    evtest output:

    pi@retropie:~ $ sudo evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:      CHICONY USB Keyboard
    /dev/input/event1:      CHICONY USB Keyboard
    /dev/input/event2:      USB Gamepad
    /dev/input/event3:      JOYMAP Joystick 0
    /dev/input/event4:      JOYMAP Joystick 1
    /dev/input/event5:      JOYMAP Joystick 2
    /dev/input/event6:      JOYMAP Joystick 3
    /dev/input/event7:      JOYMAP Joystick 4
    /dev/input/event8:      JOYMAP Joystick 5
    /dev/input/event9:      JOYMAP Joystick 6
    /dev/input/event10:     JOYMAP Joystick 7
    /dev/input/event11:     JOYMAP Joystick 8
    /dev/input/event12:     JOYMAP Joystick 9
    /dev/input/event13:     JOYMAP Mouse
    /dev/input/event14:     JOYMAP Keyboard
    /dev/input/event15:     JOYMAP Code Device
    Select the device event number [0-15]: 14
    Input driver version is 1.0.1
    Input device ID: bus 0x6 vendor 0xff product 0x2 version 0x0
    Input device name: "JOYMAP Keyboard"
    Supported events:
      Event type 0 (EV_SYN)
      Event type 1 (EV_KEY)
      [...]
    Testing ... (interrupt to exit)
    Event: time 1478053877.238314, type 1 (EV_KEY), code 16 (KEY_Q), value 1
    Event: time 1478053877.238314, -------------- EV_SYN ------------
    Event: time 1478053877.350398, type 1 (EV_KEY), code 16 (KEY_Q), value 0
    Event: time 1478053877.350398, -------------- EV_SYN ------------
    
    [event output above is from pressing controller button src=6]
    [pressing shift'ed controller button prints no event output]
    

    Thanks again for your time and this wonderful program.
    -James

     

    Last edit: James 2016-11-02
    • Alexandre Hardy

      Alexandre Hardy - 2016-11-06

      Hi James,

      You are correct. The shift functionality is not working. Not sure at which point it broke, probably during some code reworking.

      You can solve this temporarily by adding 288 to your shift button.

      In your case that would be:
      shift vendor=0x0079 product=0x0011 src=296

      I'll be working on a fix (but probably not very quickly even though the fix is trivial), but such a fix will break any mapping where you apply this workaround.

      Kind regards
      Alexandre

       

      Last edit: Alexandre Hardy 2016-11-06
      • Alexandre Hardy

        Alexandre Hardy - 2023-10-03

        Hi James,

        This bug should be fixed in joymap-0.5.0.

        joymap-0.5.0 also adds a few other options;
        * Ability to specify a joystick by event device number instead of vendor and product.
        * Daemonize option, to run the program in the background.
        * Handles removal and insertion of devices at runtime (no need to have the devices plugged in before you start).
        * You can now provide a search path for configuration files in the JOYMAP_PATH environment variable so config files don't have to use absolute paths or be in the same directory where loadmap is executed from.
        * An additional command line option is provided to automatically map axes into the -32767 to 32767 range based on what the linux event subsystem reports the axis range to be.

        Kind regards
        Alexandre

         
  • Joe

    Joe - 2016-11-24

    Running joymap 0.4.2; thank you so much for this.

    Having a difficult time getting it working with an Xbox One controller and xpad on my Raspberry Pi.

    When I run jsinfo, it shows the d-pad as being a04 (X) and a05 (Y) with a range of -32767 to 32767.; button "A" on the controller is b00 and "B" is b01.

    My map file looks like this:

    axis vendor=0x045e product=0x02ea src=4 target=kbd minus="left" plus="right"
    axis vendor=0x045e product=0x02ea src=5 target=kbd minus="up" plus="down"
    
    button vendor=0x045e product=0x02ea src=0 target=kbd button="space"  #a
    button vendor=0x045e product=0x02ea src=1 target=kbd button="m"  #b
    

    It doesn't appear that these settings work when I run joymap though. In fact, the right analog stick (should be a02) appears to be getting used for the X control.

    Any thoughts?

    Not sure if it's relevant but when I run joymap, I get the following:

    0 joysticks.
    Found device SINO WEALTH USB KEYBOARD (vendor0x258a, product=0x0001)
    Found device SINO WEALTH USB KEYBOARD (vendor0x258a, product=0x0001)
    Found device Microsoft X-Box One S pad (vendor=0x045e, product=0x02ea)
    Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
    4 button assignments.
    2 axes assignments.
    
     

    Last edit: Joe 2016-11-24
    • Alexandre Hardy

      Alexandre Hardy - 2016-12-05

      Hi Joe,

      I'm afraid I cannot say why the axes are being mapped differently to what you observe in jsinfo. It may be useful to provide the output of cat /proc/bus/input/devices.

      The D-Pad may not be reported as an axis, but possibly as something else.

      Kind regards
      Alexandre

       
  • Acris

    Acris - 2017-03-05

    Hello , sorry for my english
    I tried to use loadmap with pico-8 on raspberry (recalbox) but axis doesn't work I don't know why
    I killed emulationstation and use putty to launch command.
    pico-8 use sdl2 to use joystick (analogy stick) but to shutdown I need keyboard (CLTR+Q)
    I would like use loadmap to exit and play games.

    Can you tell me why It does'nt work ?

    # cat /proc/bus/input/devices
    I: Bus=0003 Vendor=04d9 Product=2517 Version=0110
    N: Name="HID 04d9:2517"
    P: Phys=usb-3f980000.usb-1.4/input0
    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:04D9:2517.0001/input/input0
    U: Uniq=
    H: Handlers=sysrq kbd leds event0
    B: PROP=0
    B: EV=120013
    B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe
    B: MSC=10
    B: LED=7
    
    I: Bus=0003 Vendor=04d9 Product=2517 Version=0110
    N: Name="HID 04d9:2517"
    P: Phys=usb-3f980000.usb-1.4/input1
    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:04D9:2517.0002/input/input1
    U: Uniq=
    H: Handlers=kbd mouse0 event1
    B: PROP=0
    B: EV=1f
    B: KEY=3f 3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 1f0001 130f93 8b17c000 677bfa d941dfed 9ed680 4400 0 10000002
    B: REL=3c3
    B: ABS=1 0
    B: MSC=10
    
    I: Bus=0005 Vendor=0000 Product=0000 Version=011b
    N: Name="idroid:con"
    P: Phys=b8:27:eb:86:62:ea
    S: Sysfs=/devices/platform/soc/3f201000.uart/tty/ttyAMA0/hci0/hci0:12/0005:0000:0000.0004/input/input42
    U: Uniq=20:73:ab:01:98:76
    H: Handlers=event2 js0
    B: PROP=0
    B: EV=1b
    B: KEY=fff 0 0 0 0 0 0 0 0 0
    B: ABS=100 30027
    B: MSC=10
    

    sdl2-jstest

    Joystick Name:     'idroid:con'
    Joystick Path:     '/dev/input/event2'
    Joystick GUID:     050000006964726f69643a636f6e0000
    Joystick Number:    0
    Number of Axes:     4
    Number of Buttons: 12
    Number of Hats:     1
    Number of Balls:    0
    GameController:
      not a gamepad
    Axis code  0:    0
    Axis code  1:    1
    Axis code  2:    2
    Axis code  3:    5
    Button code  0:   288
    Button code  1:   289
    Button code  2:   290
    Button code  3:   291
    Button code  4:   292
    Button code  5:   293
    Button code  6:   294
    Button code  7:   295
    Button code  8:   296
    Button code  9:   297
    Button code 10:   298
    Button code 11:   299
    Hat code  0:   16
    
    /recalbox/share/system/configs/loadmap/loadmap /recalbox/share/system/configs/loadmap/gamepad.map & SDL_VIDEO_GL_DRIVER=/usr/lib/libGLESv2.so SDL_VIDEO_EGL_DRIVER=/usr/lib/libGLESv2.so /recalbox/share/system/configs/pico8/pico8 -run /recalbox/share/roms/pico8/pico-man.p8.png
    1 joysticks.
    joystick0 axes=1 buttons=0.
    Found device HID 04d9:2517 (vendor=0x04d9, product=0x2517)
    Found device HID 04d9:2517 (vendor=0x04d9, product=0x2517)
    Found device idroid:con (vendor=0x0000, product=0x0000)
    Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
    8 button assignments.
    2 axes assignments.
    

    gamepad.map

    #idroid:con gamepad
    axis vendor=0x0000 product=0x0000 src=0 target=kbd plus=left minus=right device=0
    axis vendor=0x0000 product=0x0000 src=1 target=kbd plus=up minus=down device=0
    button vendor=0x0000 product=0x0000 src=0 target=kbd button="z" device=0
    button vendor=0x0000 product=0x0000 src=0 target=kbd button="x" device=0
    button vendor=0x0000 product=0x0000 src=10 target=kbd button="leftctrl" device=0
    button vendor=0x0000 product=0x0000 src=11 target=kbd button="q" device=0
    
     

    Last edit: Acris 2017-03-08
    • Alexandre Hardy

      Alexandre Hardy - 2017-03-09

      Hi Acris,

      Can you explain what you mean by "but axis doesn't work". Do you mean:
      a) That absolutely nothing happens when you move the axis?
      b) It looks like the keypress gets stuck?
      c) It works once and then never again?

      Have you tried with a different key such as 'a' instead of 'left' or 'right' so that you can see on the terminal what actions are being taken?

      I notice that you have not specified the trinary flag with flags=trinary. You also haven't set the deadzone or min and max values. You probably want to add one or more of these (one at a time is probably best) and test the results to see what happens.

      Kind regards
      Alexandre

       
  • Acris

    Acris - 2017-03-10

    Ho Alexandre,
    sorry for my english.
    a) That absolutely nothing happens when you move the axis : yes

    Have you tried with a different key such as 'a' instead of 'left' or 'right' so that you can see on the terminal what actions are being taken?

    No, i have not because pico-8 use arrow on keyboard but i tried with kbd or mouse , no move.
    I tried with flage=trinary with deadzone and min or max and didn't work.

    axis vendor=0x0000 product=0x0000 src=0 target=kbd plus="right" minus="left" flags="trinary" min=0 max=255 deadzone=127
    
    #idroid:con gamepad
    axis vendor=0x0000 product=0x0000 src=0 target=joyaxis axis=0 flags=trinary min=0 max=255 deadzone=127
    axis vendor=0x0000 product=0x0000 sr;(c=1 target=joyaxis axis=1 flags=trinary min=0 max=255 deadzone=127
    button vendor=0x0000 product=0x0000 src=0 target=kbd button="z" device=0
    button vendor=0x0000 product=0x0000 src=0 target=kbd button="x" device=0
    button vendor=0x0000 product=0x0000 src=10 target=kbd button="leftctrl" device=0
    button vendor=0x0000 product=0x0000 src=11 target=kbd button="q" device=0
    

    buttons work very fine but D-Pad or joystick no move.
    I dont know how to choose axis : target=mouse ? target=joyaxis = target=kbd ? or other ?
    help me :(

     

    Last edit: Acris 2017-03-10
  • mpd

    mpd - 2017-03-14

    Ok ... I decided to give this a try today. I am attempting to use this to allow my PS4 controller to act as a mouse in dosbox games on retropie. I will outline the steps I have taken methodically to see if I am doing anything wrong.

    1. downloaded and installed joymap-0.4.2 to /home/jm4
    2. ran cat/proc/bus/input/devices to get the Vendor and Product ID of ths PS4 controller (which at this point is connected via usb (thought i would start there). The results are as follow :
    I: Bus=0003 Vendor=054c Product=09cc Version=0111
    N: Name="Sony Interactive Entertainment Wireless Controller"
    P: Phys=usb-3f980000.usb-1.5/input3
    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.3/0003:054C:09CC.0004/input/input0
    U: Uniq=
    H: Handlers=js0 event0
    B: PROP=0
    B: EV=1b
    B: KEY=3fff0000 0 0 0 0 0 0 0 0 0
    B: ABS=3003f
    B: MSC=10
    
    I: Bus=0003 Vendor=046d Product=404d Version=0111
    N: Name="Logitech K400 Plus"
    P: Phys=usb-3f980000.usb-1.4:1
    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.2/0003:046D:C52B.0003/0003:046D:404D.0005/input/input1
    U: Uniq=
    H: Handlers=sysrq kbd leds mouse0 event1
    B: PROP=0
    B: EV=12001f
    B: KEY=3007f 0 0 0 0 83ffff 17aff32d bf544446 0 0 ffff0001 130f97 8b17c007 ffff73fa d941dfff febeffdf ffefffff ffffffff fffffffe
    B: REL=1c3
    B: ABS=1 0
    B: MSC=10
    B: LED=1f
    

    As you can see the controller is Vendor : 054c Product:09cc

    The next thing to do was to create a mouse.map file for the controller.

    I ran jstest /dev/input/js0 to get the correct src for the mapping and stored it in \roms\pc\dosbox-map\mouse.map. Here is my mapping ...

    # General Mouse Mapping for DOSBox
    
    # Map Mouse
    axis vendor=0x054c product=0x09cc src=0 target=mouse axis=0
    axis vendor=0x054c product=0x09cc src=1 target=mouse axis=1
    
    # Mouse Buttons
    button vendor=0x054c product=0x09cc src=1 target=mouse button=0
    button vendor=0x054c product=0x09cc src=2 target=mouse button=1
    
    #DPAD to Dirction
    axis vendor=0x054c product=0x09cc src=6 target=kbd plus="right" minus="left" flags="trinary"
    axis vendor=0x054c product=0x09cc src=7 target=kbd plus="down" minus="up" flags="trinary"
    
    # Keyboard Mapping
    button vendor=0x054c product=0x09cc src=0 target=kbd button="esc"
    button vendor=0x054c product=0x09cc src=3 target=kbd button="enter"
    button vendor=0x054c product=0x09cc src=12 target=kbd button="space"
    

    at this point i createst a .sh file to launch my game in dosbox.

    CC.sh :

    !/bin/bash
    sudo /home/jm4/loadmap /home/pi/RetroPie/roms/pc/dosbox-map/mouse.map &
    /opt/retropie/emulators/dosbox/bin/dosbox -conf "/home/pi/RetroPie/roms/pc/CC_conf.conf"
    

    CC_conf.conf :

    THIS IS THE DOSBOX CONFIG : THERE IS A LOT OF CRAP IN HERE BEFORE THE AUTOEXEC
    
    [autoexec]
    # Lines in this section will be run at startup.
    # You can put your MOUNT lines here.
    mount c /home/pi/RetroPie/roms/pc
    c:
    mount d /home/pi/RetroPie/roms/pc/CC_INSTALL/CDROM -t cdrom -usecd 0 -label GDI
    cd c&c
    c&C
    exit
    

    So when command and conquer loads up ... i dont think it sees my controller as a mouse. I am at a loss. The mouse just jets to the bottom right corner of the screen.

    I scoured the config for dosbox. I did find the joystick section and I am wondering if its it somehow overriding the joymap ?

    from CC_conf.conf :

    [joystick]
    # joysticktype: Type of joystick to emulate: auto (default), none,
    #               2axis (supports two joysticks),
    #               4axis (supports one joystick, first joystick used),
    #               4axis_2 (supports one joystick, second joystick used),
    #               fcs (Thrustmaster), ch (CH Flightstick).
    #               none disables joystick emulation.
    #               auto chooses emulation depending on real joystick(s).
    #               (Remember to reset dosbox's mapperfile if you saved it earlier)
    #               Possible values: auto, 2axis, 4axis, 4axis_2, fcs, ch, none.
    #        timed: enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).
    #     autofire: continuously fires as long as you keep the button pressed.
    #       swap34: swap the 3rd and the 4th axis. can be useful for certain joysticks.
    #   buttonwrap: enable button wrapping at the number of emulated buttons.
    
    joysticktype=auto
    timed=true
    autofire=false
    swap34=false
    buttonwrap=false
    

    # Is there a way to test joymap in dosbox without launching the game ?

    Thanks ! I am near my wits end with this.

    The mouse just jets to the bottom right corner of the screen when I move the thumbstick.

     

    Last edit: mpd 2017-03-14
<< < 1 2 3 4 5 > >> (Page 3 of 5)

Log in to post a comment.