Linux Joystick Mapper Wiki
Status: Beta
Brought to you by:
alexandrehardy
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
Thank you so much for this driver Mr. Hardy! This script is incredible for mapping to my PS3 Controller into the PiFBA Emulator on RetroPie in my old Raspberry Pi Model B rev.1.2. It works finely with one player, but I want ask you how can I configure the map file for map my keyboard to the two same PS3 Controllers. The provider ID and product ID are the same, only change his Handlers (js0,js1,event0, etc).
I tried adding id=0, id=1 and device=0,device=1 to the map file but not working.
Thank you very much!
Regards from Chile!
I am trying to get this to work with a Hotas Warthog. I am having problems just mapping the axis through... I want to use this tool to combine some saitek rudder pedals with the warthog so I can have one virtual stick I could use in space sims like freespace 2 open. But when I just try to map the axis straitfowardly like:
axis vendor=0x044f product=0x0402 src=0 target=joyaxis axis=0
axis vendor=0x044f product=0x0402 src=1 target=joyaxis axis=1
axis vendor=0x06a3 product=0x0763 src=2 target=joyaxis axis=2
It doesn't work and the curser is in the lower right quadrant, maxed at 32767. Any help or examples would be greatly appreciated.
I am trying to get this to work with a Hotas Warthog. I am having problems just mapping the axis through... I want to use this tool to combine some saitek rudder pedals with the warthog so I can have one virtual stick I could use in space sims like freespace 2 open. But when I just try to map the axis straitfowardly like:
axis vendor=0x044f product=0x0402 src=0 target=joyaxis axis=0
axis vendor=0x044f product=0x0402 src=1 target=joyaxis axis=1
axis vendor=0x06a3 product=0x0763 src=2 target=joyaxis axis=2
It doesn't work and the curser is in the lower right quadrant, maxed at 32767. Any help or examples would be greatly appreciated.
Just wanted to share my post on reddit on how to setup Linux Joystick Mapper with DOSBox on RetroPie 4.7.2 https://www.reddit.com/user/ajscilingo/comments/kmn5nw/configuring_dosbox_to_work_with_linux_joystick/
Hope this helps someone looking to use this project with DOSBox on RetroPie... Edit Still haven't managed to get the HAT working on my controller but maybe someone can add on to this?
Last edit: Anthony S 2020-12-30
Anthony S, regarding the HAT not working. Did you notice anyone having trouble with getting HAT buttons working ? Hope it may assist.
Hi Stephen thanks for that, my gamepad's HAT is also being mapped to axis 16 and 17, and it too has three values -1, 0 and 1. I assumed that the 3 and 4 axis values reported by jstest were correct, but then I added your code and saw in stderr that they were in fact 16 and 17. In any case I didn't need to remap the values I used the following in my map for things to work correctly for me. How come you're re-mapping the values to 0, 128 and 255?
Last edit: Anthony S 2021-01-02
Good to hear.
I mapped the values to 0, 128, 255 to replicate function of other axis. From memory the direct mapping was not working for me.
Hi. Awesome tool.
I am struggling a bit with how to differentiate two identical controllers.
In
/proc/bus/input/devices
:A simple map file looks like this:
The output of loadmap looks like this:
It seems like it always maps only the second controller. Is there a way to specify which one I want to use as source in the map file? Thanks a lot.
Hi!
The original joymap code was actually designed for my own use, and thus has some shortcomings when it comes to duplicate devices. The original design goals:
1. Consistently identify devices in a HOTAS setup (joystick, throttle and rudder pedals) even after reboots and hotplug events.
2. Allow programmability of targets.
That is a very broad statement, and was never written down. But the point was to identify devices by their vendor and product id so that the software tolerates reboots and hotplug events and consistently identifies devices correctly, even if they received different "js?" numbers due to the order in which they are detected.
I never added support for identifying a joystick by the linux device identifier (or
/dev/input/js?
) so today we still have an issue that you cannot tell the software which device to use if there are multiple devices with the same vendor and product identifiers.There are others with the same request, but I am not sure when I will get time to implement that. I have a number of other commitments at the moment which will probably delay support for multiple devices with the same identifiers for some time. If you have programming experience, you are welcome to attempt to add that feature.
I have no objections to anyone creating forks of the project to add whatever they need, and can even advertise what they have done here. Patches are also welcome, although I may be a bit more fussy about what I would like to maintain :-).
Kind regards
Alexandre
Last edit: Alexandre Hardy 2021-02-14
Hi!
joymap-0.5.0 now supports use f the "id" keyword for mapping the joysticks. The Id corresponds to the event device associated with the device. For example, if event6 is listed as a handler for the device in /proc/bus/input/devices, then you can specify id=6 in the mapping file. If you specify the id, then you should not specify the vendor and product id.
joymap-0.5.0 supports plugging in and out of devices, but if you use the id, then you may find a new event kernel device has been allocated to the physical device. But if you leave the devices plugged in (connected) then the mapping should work fine. Also the event devices allocated by the kernel across reboots may differ. That was why the vendor and product system was selected originally (it works great for HOTAS setups).
Hope that helps!
Kind regards
Alexandre