Guide: Advanced Controller Mappings
-
@mediamogul This guide would be really nice on the wiki, huh? ;-)
-
I originally thought it might be a bit too long and involved for a wiki entry, but maybe it should go there.
-
@mediamogul I think it is a bit too long and involved for a forum topic. LOL! :D
I think it fits nice in the "Advanced Configuration" section.
-
I might try to pair it down to something more manageable at some point and post it as a wiki.
-
Great guide. I'm getting more comfortable with xboxdrv and it should work well.
I'll have two different types of controllers, either one (not both) may be connected. How will xboxdrv and ES handle this? I'm hoping that when the controller mapped to xboxdrv is attached, xboxdrv will run, and ES will see the virtual Xbox controller and use that, and when the other controller is attached, xboxdrv will fail, and ES will see the non-Xbox controller and use that. Is that basically accurate?
-
xboxdrv can't detect when a controller is connected when used in the way this guide details, so the command must be executed after the controller is connected. Even when the configuration command is added to
/etc/rc.local
, your controller must be connected at startup or it will fail. Provided that you've mapped both your xboxdrv controller and the secondary controller you mentioned, Emulation Station should have no problem reading either. -
@mediamogul
Right, I'd have to reboot then immediately change controllers. That was my thought too. -
There are ways to create a daemon that would see when a controller is connected and execute a command like you would need for xboxdrv, but all information I've found on the subject is either conflicting or outdated. If successfully implemented, it could also tell when a controller is disconnected and stop xboxdrv.
-
I'm getting close. I want to map the D-pad to arrow keys, but it's not working. Just for testing, if I run this (how do you display text as code???):
/opt/retropie/supplementary/xboxdrv/bin/xboxdrv
--evdev /dev/input/by-id/usb-0079_USB_Gamepad-event-joystick
--silent
--detach-kernel-driver
--force-feedback
--deadzone-trigger 15%
--deadzone 4000
--mimic-xpad
--evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y
--evdev-keymap BTN_THUMB=a,BTN_THUMB2=b,BTN_BASE3=back,BTN_BASE4=start
--dpad-only
--ui-axismap lt=void,rt=void
--ui-buttonmap tl=void,tr=void,guide=void,x=void,y=void,lb=void,rb=void,back=KEY_ESC,a=KEY_1,b=KEY_2 &Then run "evtest", the D-pad responds as ABS_X and ABS_Y with values -1 to 1. But if I add this to --ui-axismap:
dpad_x=KEY_LEFT:KEY_RIGHT,dpad_y=KEY_UP:KEY_DOWN
it runs with no errors, but now in "evtest" the D-pad causes no response at all. If instead I use:
X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN
The D-pad in "evtest" responds not with arrow keys, but the same ABS_X and ABS_Y. Any ideas?
-
@jrmymllr said in Guide: Advanced Controller Mappings:
how do you display text as code?
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting
Everything looks to be correct. You say you're running evtest a second time, but which controller event are you testing at that point? Is it the original physical controller event, or the new virtual controller event? If it's the prior, that event is rendered inert while xboxdrv is running to avoid conflicts. If it's the latter, xboxdrv creates both a new virtualized joystick event, along with a virtualized keyboard event. If your looking to see if the keyboard is being activated with button presses, you'll want to look at the new keyboard event. However, if it's running without errors as you say, it's probably fine. You may just want to fire up an emulator that supports arrow keys and see what shakes loose.
-
@mediamogul said in Guide: Advanced Controller Mappings:
I originally thought it might be a bit too long and involved for a wiki entry, but maybe it should go there.
Yes please :)
And while where on the topic. This should be built in to the retropie setup. With a gui.
Edit:
Something like this.
Configuration / Tools / Advanced Controller Configuration.
From here you can choose device using
cat /proc/bus/input/devices from a list.Event Location
ls /dev/input/by-id/
Event codes for each button
And so on all in the gui.
-
I am definitely testing the new virtual Xbox event with
evtest
. With no xboxdrv running here's the response direct from the controller (USB NES type controller):Event: time 1475321474.481703, type 3 (EV_ABS), code 1 (ABS_Y), value 255 Event: time 1475321474.481703, -------------- EV_SYN ------------ Event: time 1475321474.593717, type 3 (EV_ABS), code 1 (ABS_Y), value 127 Event: time 1475321474.593717, -------------- EV_SYN ------------ Event: time 1475321475.369820, type 3 (EV_ABS), code 1 (ABS_Y), value 0 Event: time 1475321475.369820, -------------- EV_SYN ------------ Event: time 1475321475.473841, type 3 (EV_ABS), code 1 (ABS_Y), value 127 Event: time 1475321475.473841, -------------- EV_SYN ------------ Event: time 1475321476.417955, type 3 (EV_ABS), code 0 (ABS_X), value 255 Event: time 1475321476.417955, -------------- EV_SYN ------------ Event: time 1475321476.481967, type 3 (EV_ABS), code 0 (ABS_X), value 127 Event: time 1475321476.481967, -------------- EV_SYN ------------ Event: time 1475321477.058044, type 3 (EV_ABS), code 0 (ABS_X), value 0 Event: time 1475321477.058044, -------------- EV_SYN ------------ Event: time 1475321477.122050, type 3 (EV_ABS), code 0 (ABS_X), value 127 Event: time 1475321477.122050, -------------- EV_SYN ------------
Then if I run this:
--evdev /dev/input/by-id/usb-0079_USB_Gamepad-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \ --evdev-keymap BTN_THUMB=a,BTN_THUMB2=b,BTN_BASE3=back,BTN_BASE4=start \ --dpad-only \ --ui-axismap lt=void,rt=void,X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap tl=void,tr=void,guide=void,x=void,y=void,lb=void,rb=void,back=KEY_ESC,a=KEY_1,b=KEY_2 &
the response from
evtest
from the Dpad through the virtual xboxdrv device is:Event: time 1475321774.129436, type 3 (EV_ABS), code 1 (ABS_Y), value -1 Event: time 1475321774.129436, -------------- EV_SYN ------------ Event: time 1475321774.265388, type 3 (EV_ABS), code 1 (ABS_Y), value 0 Event: time 1475321774.265388, -------------- EV_SYN ------------ Event: time 1475321775.169519, type 3 (EV_ABS), code 1 (ABS_Y), value 1 Event: time 1475321775.169519, -------------- EV_SYN ------------ Event: time 1475321775.297536, type 3 (EV_ABS), code 1 (ABS_Y), value 0 Event: time 1475321775.297536, -------------- EV_SYN ------------ Event: time 1475321775.889574, type 3 (EV_ABS), code 0 (ABS_X), value -1 Event: time 1475321775.889574, -------------- EV_SYN ------------ Event: time 1475321775.953608, type 3 (EV_ABS), code 0 (ABS_X), value 0 Event: time 1475321775.953608, -------------- EV_SYN ------------ Event: time 1475321776.401679, type 3 (EV_ABS), code 0 (ABS_X), value 1 Event: time 1475321776.401679, -------------- EV_SYN ------------ Event: time 1475321776.489683, type 3 (EV_ABS), code 0 (ABS_X), value 0 Event: time 1475321776.489683, -------------- EV_SYN ------------
However if I press the other buttons during
evtest
they appear asKEY_ESC
,KEY_1
, etc. as they should. And, those buttons really behave like I'm pressing the associated keyboard buttons in an emulator.I've ensured no other xboxdrv processes are running, and tried rebooting. So, no problem emulating the keyboard with controller buttons. The problem is emulating keyboard presses with the Dpad. Should be simple but I must be missing something!
-
Try adding
--dpad-as-button
and configuring each direction separately in a--ui-buttonmap
line usingdu=KEY_*,dd=KEY_*,dl=KEY_*,dr=KEY_*
entries to see if that makes a difference. -
Success! I previously tried the
--dpad-as-button
but must not have figured out du,dd,etc.Thanks a million!
-
I have now added this guide to the wiki along with @MadHorse's additions. It can be found here. As it doesn't make sense to maintain the same information in two places, I'll leave the first post as is, adding only a notation at the beginning. Of course, anyone can continue to ask questions and trade configurations here if need be.
Thanks guys!
-
@MadHorse said in Guide: Advanced Controller Mappings:
This is awesome. This is a great way to run xboxdrv with different commands depending on emulator or ROM. I finally have everything working the way I want.
-
Hello I am having trouble with my USB arcade sticks not being recognized by my new PI Zero. I plug them in and emulation station doesn't show any gamepad attached.
I built these arcades sticks myself using a PS3/PC ZERO DELAY USB ENCODER PCB as the input device and all of these arcade sticks work with my PI 2 for the last year.
All of my regular gamepad (Microsoft sidewinder and Logitech controllers) seem to work. Is it perhaps an issue with the retro pie image file for the zero not supporting these arcade stick devices? Or is it that this little device doesn't produce enough juice to power these larger controllers?
Is there a possible fix?
-
You can try running
evtest
to see if your arcade stick is registering as an input event. If it does, you can use this guide to map you controller using xboxdrv. At that point the system will just think you're using an XBox 360 controller.My best advice is that you start a new thread detailing your situation separately. This will likely attract a wider array of viewers and may produce a solution more tailored to your specific problem.
-
I've been trying to create a new thread but this forum is badly broken. No matter what I do the forum keeps telling me my post title is too short and refuses to let my post.
-
This post is deleted!
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.