xboxdrv works in FE / shell but not emulator
-
pi3, adafruit PS, motionblue image
I was trying to use xboxdrv to take advantage of the feature to force 4-way direction mode with either my SNES30 or XBox controller dpad. I had it working with the SNES30 and then I did "something" and now I can't ever get the emulator to recognize the controller properly (one input may work, or may recognize input but map to wrong thing in emulator).
I have Pi3B, RetroPie, and Using ES to launch emulators. All emulators have same issue. I have simply created a shell script for testing and removed the --silent flag so I can see the output. When I run xboxdrv it starts properly informing me with something like this:
Your Xbox/Xbox360 controller should now be available as:
/dev/input/js4
/dev/input/event6I can see the output properly mapping when I tap buttons. For this test I just mapped the Xbox dpad to du/dd/dl/dr and I can see all the buttons output lines like below correctly.
X1: 0 Y1: 0 X2: 0 Y2: 0 du:0 dd:0 dl:0 dr:0 back:0 guide:0 start:0 TL:0 TR:0 A:0 B:0 X:0 Y:0 LB:0 RB:0 LT: 0 RT: 0
I go into ES and configure the controller, seems great. Works find in ES. When I launch the emulator however it's clear the mapping isn't right. It seems there must be a issue with the retroarch mapping file but ... totally lost.
Here is my script to configure xbox :
--evdev /dev/input/event2 \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --ui-axismap lt=void,rt=void \ --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr &
I've tried removing all my joystick files in retroarch-joypad, uninstalling xboxdrv, and repeating steps and now all I get at emulator level is buttons/controls mapping wrong (for example select works and no others do). If I kill xboxdrv and try to use controllers normally they seem fine.
any hints appreciated.
-
I tried resetting EM back to defaults and re-adding controllers. Again they work great in EM but not in emulators.
So I have the real device on js0, xboxdrv creates the new version on js1. I can tell EM is configuring the new one because the name is slightly different. Seems select is the only button that ever works.
I'm unsure if "udev" is right type when using this (from wiki seems to be) I tried sdl and made no difference.
Using jstest on js0 and js1 they do return different values.
-
Your map appears to be in order and it's executing without error. What emulators are you trying to use with this? If they are RetroArch cores, make sure that the virtualized xboxdrv controller is selected as player one, otherwise RetroArch will want to use your the controller's original mapping by default.
-
I tried stella and mame, both same result. It's unclear to me how to make sure it's selected as player one in retroarch but I see the virtualized name (different than real device) in the lower left at start and I tried using the joystick-selection add-on to name them and force it, still no dice. I
I may just start with latest 4.1 image and build it over again. I see some comments in other threads about latest kernel not working with xboxdrv.
-
@markg said in xboxdrv works in FE / shell but not emulator:
I may just start with latest 4.1 image and build it over again. I see some comments in other threads about latest kernel not working with xboxdrv.
I don't think there's any reason to start over. I believe the kernel incompatibility only applies when using xboxdrv as a driver for an actual Xbox controller. You can set the controller order by going to the "Configuration Editor" in the RetroPie menu of Emulation Station. From there, navigate to "Configure Basic libretro Emulator Options", then "Configure Default Options For All libretro Emulators" and finally "Choose Joypad Order".
-
@mediamogul awesome, thanks so much. Seems the joytstick-selector i compiled/used didn't do what I was expecting at the retroarch level but that did!
I added my 2nd controller which is to be setup differently and it was bound to the handler my first one was which was strange. Is there a way to force that binding, or is it just based on order you turn on the joysticks? (sorry for jumping topics here)
-
@markg said in xboxdrv works in FE / shell but not emulator:
it was bound to the handler my first one was which was strange.
I'm not sure I know what you mean here. Could you elaborate?
-
@mediamogul it seems that the device number (js0 or js1) is determined by the order you start the devices. In the xboxdrv configuration you have to specify the event number that's bound to that. So if I have two xboxdrv processes running, one for each of my controllers (xbox and snes30) If I don't turn them on in right order before that process runs they will bind to the wrong configuration file. I was wondering if there is a way to query the device name to determine if it's running as js0 or js1 and use that in the shell script that launches xboxdrv. I guess I could go to the extreme of using some awk/sed to take output of cat /proc/bus/input/devices and look at device names to determine the right handler.
-
OK, I see what you're saying. Ideally, the best way to bind a config to a controller is it's event entry at
/dev/input/by-id/*
. However, not all controllers report an ID and I take it that's why you're using the event number in your mapping example above. Fortunately, I haven't had to deal with this much myself. I've been lucky in that all of the controllers I have an interest in using for RetroPie report an ID. Albeit "extreme", I do really like the solution you're proposing to query the event number. I'd be very interested to hear how you implement it fully if you choose to do so. -
@mediamogul Ah... Thanks, think this was an RTFM thing. I was going from the recipe page on wiki and the instructions on the event name and I got to thinking "number". Re-reading it now I've changed to use by-id/name and that fixes issue of binding orders to event number that change. Thanks so much!
The four way restrictor is a big difference.... I may try to change the analog stick to work like digital and see if that works even better for a 4-way substitute.
-
Glad to see it's working.
The four way restrictor is a big difference.
I love that feature! You'll never get your best score in 'Pac-Man' without something like it.
-
@mediamogul so I did notice that the bluetooth controller never shows up on /dev/input/by-id ls command - but it does show up if I do cat on /proc/bus/input/devices. Expected?
-
It's not uncommon, Bluetooth or otherwise. I believe it's up to the manufacturer to program in an event ID into the firmware.
-
So this works for finding a controller by event ID dynamically
cat /proc/bus/input/devices |grep -A 10 "SNES"|grep Handlers|cut -d'=' -f2|cut -d' ' -f1
Which I used to find the SNES Controller that doesn't show up with other command, then you can dynamically do assignments with the resulting event number.
I seem to have noticed if I pick my newly named "4-way SNES" controller but have a default SNES controller setup in my retroarch-joypads (one 4 way and one from initial setup) it uses the wrong one. I removed the original one and working fine but makes me wonder about how to use this controller two different ways with retroarch (use in "normal" mode and with xboxdrv) if something in retroarch is looking at this other configuration file.
-
@mediamogul the one issue I still have is what you gave me that fixed things doesn't "stick". So the thing I HAVE to do to get an xboxdrv mapped controller to work is to pick it in the retroarch configuration as joy1 and joy2 and magic, it works. However when I unplug controller or disconnect bluetooth it seems those settings are "lost" and I have to go back in there and manually fix them again (they read "unset"). I kinda assumed these settings were just in a retroarch config file and not going to change. Is there a different place I should put this to make it more permanent? I see there is a enable plug/play option - maybe turn that off since I want to make it static? Thanks for any pointers with your help I'm so close to having this 100%!
-
@markg said in xboxdrv works in FE / shell but not emulator:
Is there a different place I should put this to make it more permanent?
This setting can be hardcoded in
/opt/retropie/configs/all/retroarch.cfg
. The entry you're looking for is:input_player1_joypad_index = "x"
Something else that comes to mind and is completely untested by myself is that this setting could be altered alongside xboxdrv launching, so as to accommodate individual mappings and controllers on-the-fly. Try at your own risk, but something like this might work well:
sed -i 's/input_player1_joypad_index = "*"/input_player1_joypad_index = "1"/g' /opt/retropie/configs/all/retroarch.cfg
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.