Guide: Advanced Controller Mappings
-
Go ahead and past the contents of the newly modified
rc.local
. -
/etc/rc.local now :
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event2 \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_#48=lt,ABS_#49=rt \ --evdev-keymap KEY_#302=a,KEY_#301=b,BTN_DEAD=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_TRIGGER=back,KEY_#720=guide,BTN_TOP=start,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 \ & exit 0
-
At this point, I'm starting to suspect poltergeists ;). Let's try reformatting the command to:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/event2 --silent --detach-kernel-driver --force-feedback --deadzone-trigger 15% --deadzone 4000 --mimic-xpad --dpad-as-button --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_#48=lt,ABS_#49=rt --evdev-keymap KEY_#302=a,KEY_#301=b,BTN_DEAD=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_TRIGGER=back,KEY_#720=guide,BTN_TOP=start,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 &
-
Such an idea.
If Sony gamepad connected via bluetooth and I enter the SSH command:sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event2 \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_#48=lt,ABS_#49=rt \ --evdev-keymap KEY_#302=a,KEY_#301=b,BTN_DEAD=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_TRIGGER=back,KEY_#720=guide,BTN_TOP=start,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767
output is this:
Your Xbox/Xbox360 controller should now be available as: /dev/input/js1 /dev/input/event3 Press Ctrl-C to quit
Unless Sony gamepad connected via bluetooth and I enter the SSH command output is this:
pi@retropie:~ $ sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ > --evdev /dev/input/event2 \ > --silent \ > --detach-kernel-driver \ > --force-feedback \ > --deadzone-trigger 15% \ > --deadzone 4000 \ > --mimic-xpad \ > --dpad-as-button \ > --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_#48=lt,ABS_#49=rt \ > --evdev-keymap KEY_#302=a,KEY_#301=b,BTN_DEAD=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_TRIGGER=back,KEY_#720=guide,BTN_TOP=start,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl \ > --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details. -- [ ERROR ] ------------------------------------------------------ /dev/input/event2: No such file or directory
The rc.local It starts with the system, gamepad is not yet connected.
May not be gamepad startup already connected via cable necessary? -
Ah... nice! OK, There's a command to force Bluetooth to load and pair known devices that can be added before the xboxdrv command. From memory I believe it's called 'modprobe' or something like that. I'll be more than happy to help you out with it, but to be honest, I'm starting to fade and should get some sleep. I'll look into it further after a few ZZZs, but feel free to read ahead. I'm curious about this myself and I remember thinking that this could potentially be a problem with Bluetooth as the system starts.
-
It's as if Sony gamepad connected via a cable already at system startup, log on as an X-Box gamepad.
I: Bus=0003 Vendor=045e Product=028e Version=0110 N: Name="Microsoft X-Box 360 pad" P: Phys= S: Sysfs=/devices/virtual/input/input3 U: Uniq= H: Handlers=js1 event3 B: PROP=0 B: EV=20000b B: KEY=7cdb03c0 0 0 0 0 0 0 0 0 0 B: ABS=3f B: FF=1 3f870000 0 0
If Sony gamepad connects to the system startup via Bluetooth, so the X-Box driver not lead.
-
With any luck, forcing Bluetooth to load and pair known devices at startup should correct the problem. The fact that it connects via USB at startup is a good sign.
-
O.K. Thank you so much for your help in solving the problem.
-
Not a problem. I get the benefit of learning from this too. Try adding
rfcomm bind 0 XX:XX:XX:XX:XX:XX 1
in a line just before the xboxdrv command inrc.local
, substituting your controller's Blutooth address for "XX:XX:XX:XX:XX:XX" of course. -
This is probably not the right way, it wanted the script to be run after connecting the PS3 gamepad via bluetooth. They must be written in
rc.local
?
Gamepad itself does not connect If you press the PS button.Idea:
-
1 - Start Retropie
-
2 - Press PS button on gamepad (gamepad connected as PS3)
-
3 - Run script (with similar content) :
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event2 \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_#48=lt,ABS_#49=rt \ --evdev-keymap KEY_#302=a,KEY_#301=b,BTN_DEAD=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_TRIGGER=back,KEY_#720=guide,BTN_TOP=start,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767
- 4 - PS3 gamepad via bluetooth logs on as
MICROSOFT X-BOX 360 PAD
Is it real?
-
-
@BuZz Having this kind of functionality build in to the Retropie setup would be very useful.
-
Your idea should work. Give it a try and see how it goes.
-
@mediamogul said in Guide: Advanced Controller Mappings:
------------------------------------------------------------------------------
The foundation has been laid. Controller's have been fine-tuned. Next, we'll take a look at how to map keyboard keys and mouse movements to a controller's analog sticks and buttons for use in emulators that lack native controller support and how to launch and maintain multiple mappings accordingly.
------------------------------------------------------------------------------
Hi, what's the continuation of the manual? I can hardly wait ... :-) -
It's coming. There are just a few things I want to test to make the multiple mappings as easy as possible.
--spoiler rosebud=sled \
-
@mediamogul Hi! Your guide is very interesting.
I was wondering if it is possible to map the configuration you are describing outside of /etc/rc.local and instead use a .cfg file like one described in the Retropie Wiki . I would like to be able to switch between left-analog and D-Pad easily, and it seams to be a right way to do it. Any clue? Thanks again! -
You can launch a config file along with an xboxdrv instance for any controller. However, if you're referencing the ability to switch between config files with a designated toggle button, I believe that function is only available for actual XBox 360 controllers. I seem to remember trying it, but I might be mistaken. Give it a shot and see.
If it doesn't work, in theory you could create a single map that switches between the two control schemes when a button is pressed. This would mean that the button must remain pressed for it to work, but you could then set that button to remain active once pressed and then to release when pressed again. I'm not able confirm that it would work at the moment, but it would look something like the last two lines here if it did, using the 'Guide' button as the toggle:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/* \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_*=x1,ABS_*=y1,ABS_*=x2,ABS_*=y2,ABS_*=lt,ABS_*=rt,ABS_*=dpad_x,ABS_*=dpad_y \ --evdev-keymap BTN_*=a,BTN_*=b,BTN_*=x,BTN_*=y,BTN_*=lb,BTN_*=rb,BTN_*=tl,BTN_*=tr,BTN_*=guide,BTN_*=back,BTN_*=start \ --buttonmap guide=guide:toggle \ --axismap guide+x1=dpad_x,guide+y1=dpad_y,guide+dpad_x=x1,guide+dpad_y=y1 \ &
-
@mediamogul Thank you Mediamogul for the quick reply.
Actually I have a genuine Xbox 360 controller. And the Toggle Button is working pretty well in order to switch between configurations files. I am just looking for the basic config file, in order to change it to match my needs. In last resort I think that what you are describing might be useful in order to create a basic config file, from scratch. But I need to know how to map it from /etc/rc.local to a xboxdrv cfg file. Do you know any documentation about it ? I did'nt find anything. Thanks again! -
@Jon_Ge Well. I think I got it https://github.com/xboxdrv/xboxdrv/tree/stable/examples I will try that this weekend. Thank you anyway.
-
No problem. I hope it works out.
-
I added a section on key-mapping. This includes:
- Mapping keyboard keys to the controller buttons
- Mapping mouse movement to the analog sticks
- Mapping keyboard keys to the analog sticks
- Launching specific mappings alongside a specific emulator
- Managing global and individual mappings
I used ScummVM as the example, which should also help those suffering through the current control issues found in the native joystick support. I just beat 'Monkey Island 2' the other night using these controls and it was a joy to play.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.