XBOXDRV Guidance Needed
-
Confirmed working!
/opt/retropie/configs/all/runcommand-onstart.sh contents:
# the line below is needed to use the joystick selection by name method bash "/opt/retropie/supplementary/joystick-selection/js-onstart.sh" "$@" if [ "$1" = "sorr" ] then sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \ --detach-kernel-driver \ --silent \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \ --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TR$ --ui-buttonmap x=KEY_X,a=KEY_C,b=KEY_V,lb=KEY_A,Y=KEY_S,rb=KEY_D \ --ui-buttonmap guide=KEY_B,start=KEY_ENTER,back=KEY_ESC \ --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \ -- \ & fi
/opt/retropie/configs/all/runcommand-onend.sh contents:
sudo killall xboxdrv
Seems like loading games take maybe a second longer now though, as the scripts check to see if the command being launched is
sorr
or not, but that's ok. Now I just have to wait for my controllers to arrive so I can do it all over again with them!Ps: Is it possible to hide the bits where it's loading the driver, and then at the end when it says "Shutdown complete"?
-
@hansolo77 said in XBOXDRV Guidance Needed:
Confirmed working!
Great to hear.
Is it possible to hide the bits where it's loading the driver, and then at the end when it says "Shutdown complete"?
Try changing:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
To:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
Then changing:
sudo killall xboxdrv
To:
sudo killall > /dev/null 2>&1 xboxdrv
-
I'm making another SD card backup, then I'll try that. :)
I'd like to keep this thread open for a few more days, as I know I'll have some difficulties getting the Sega controllers working once they arrive. Can you maybe give me a head start on where to begin? I know the basic steps will require me to identify the location in Linux for each controller, and then their individual default mappings (might be the same, just different locations on the /dev/). Remapping isn't hard to do either now that I know how. But how do I go about setting up the script to launch multiple instances of the driver, so I can have 2 players simultaneously? And there's also the requirement of having the Xbox controller working as well. I assume, since we're not restricted to the RetroPad limitations, we can have 2 controllers mapped to player 1 this way? At least in the case where SORR can map to keyboard inputs (I actually have a keyboard attached, and the Xbox controller, so I know that's at least 2 controllers both capable of controlling 1 player). Can this also be used for RetroArch? My ultimate goal, now that I have the opened possibilities is to:
- Have the Xbox controller be setup as my primary controller
- Have my NES pads be available in RetroArch if I ever feel nostalgic, but not need to do any kind of special configuring before hand.. just plug it in, XBD is already configured, and off I go
- Have my SEGA pads also be available in the same way
- Have my ATARI Joysticks also available
- Be able to just plug in and go, and have XBOXDRV already have the assignments ready, without needing to run joystick-selector.
Is this all possible? How about some tips? :)
-
@hansolo77 said in XBOXDRV Guidance Needed:
how do I go about setting up the script to launch multiple instances of the driver
Just place a semicolon after the
&
from your first xboxdrv command, followed by the next xboxdrv command.Can this also be used for RetroArch?
Yessir
Is this all possible? How about some tips?
All of that is possible. You'll just need to create the various if / else statements as you need them and make sure that the desired controllers are plugged in before a game is launched.
-
You and me buddy... we're best friends of the XBOXDRV now. :) I've got tomorrow off, I think I'll try and at least get some gaming in. Maybe try and tackle a bit of NES controllers, but I think I need to hold off before my brain mushes. lol
PS - Those added commands you gave me worked great at hiding all the outputted text. Thanks again!
-
@hansolo77 said in XBOXDRV Guidance Needed:
You and me buddy... we're best friends of the XBOXDRV now.
I'd suggest we get t-shirts printed, but there's no use in making everyone else jealous.
Thanks again!
Not a problem. I'm glad it all worked out.
-
What a great thread!!
@hansolo77 thank you for reporting your progress because a new user will fall into the same pits :)
@mediamogul In my opinion you are the most helpfull member of this community!
-
Wow, thank you for the compliment. Helping out here in the limited areas I'm able to has the added benefit of keeping me in practice for my own issues. In that way, you could argue that it's a purely selfish endeavor. I'm also slowly trying to learn the mother's maiden name of every user here so that I can clean out their bank accounts and disappear without suspicion like Keyser Söze.
On a completely unrelated note, what was the name of your first pet again?
-
Moving forward a little bit... and my first hurdle..
I'm using a Raphnet.net NES to USB adapter (converts 2 standard NES plugs (mounted to an NES case) to USB wire to plug into the Pi internally). Going through the process, the system only identifies it as 1 name, 2 separate events/js#s. When I go to identify the
by-id
, I only have 1 listing for an event-joystick...usb-raphnet.net_nes2usb_1228-event-joystick
. When I go through theevtest
routines, both controllers are reporting the exact same codes. So the only distinguishing difference between the 2 is that they have different event and joystick numbers. Will that cause a problem? How do I map that? Would this be where I input the event number instead (ie;/dev/input/event4
)? Wouldn't that cause a problem if the event #'s change? -
@hansolo77 said in XBOXDRV Guidance Needed:
Wouldn't that cause a problem if the event #'s change?
I've noticed this same problem with some of my multitap adapters. In these situations it does sometimes require the use of the basic event numbers. It all boils down to how the manufacturer implemented their controls and it's a shame there isn't a stricter set of standards.
-
GRR!! Ok, why isn't this working?
#!/bin/bash sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event3 \ --detach-kernel-driver \ --mimic-xpad \ --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \ --dpad-only \ --ui-axismap lt=void,rt=void --ui-buttonmap tl=void,tr-void,guide=void \ --ui-buttonmap x=void,y=void,lb=void,rb=void \ -- \ & "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _SYS_ "nes" "/home/pi/RetroPie/roms/nes/Bubble Bobble (USA).zip" sudo killall xboxdrv
I created this as a
test.sh
and did asudo chmod +x test.sh
. When I run it, all it does it execute the driver, which seems to work.. then it just sits there. I hit CTRL+C to break out, and THEN it launches the game. Then I exit the game and it runs the last line to kill the driver (which says no instance exists). So what am I doing wrong? I just want to make sure I have a working config before I go and try to add it to theonstart
script.Also, I specifically chose
Bubble Bobble
because it's a 2 player game, and I want to get that part figured out as well.Up to this point, I've not altered anything else. I'm just running on a temporary test script.
-
Ok, so I really dumbed it down... trying just the driver bit again..
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event3 \ --detach-kernel-driver \ --mimic-xpad \ --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \ --dpad-only \ -- \
All I get in return is:
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 ] ------------------------------------------------------ Device or resource busy
I've done a manual
sudo killall xboxdrv
after every run, so I dunno what's up. :*( -
Apparently, the command for using the event id is wrong... when I change it back to
--evdev /dev/input/by-id/usb-raphnet.net_nes2usb_1228-event-joystick \
everything starts working (at least one the driver side).
Edit - Correction.. I guess the driver wasn't fully unloading.. I tried running
sudo killall xboxdrv
10 times or so. It never gave me an error about it not running.. but it also never closed it. My GOOGLE friend revealed this nice little command:ps axg | grep xboxdrv
It showed 3 entries currently running. So I did a reboot and tried again. Now I can see the output being logged to the screen when I press buttons. Ok, getting closer I guess.
-
Ok, so I can now get the driver to load, and then the game afterwards, with no errors. So the next setup is mapping the controller to RetroArch inputs. Anybody got any pointers on that? Where would I get the default mappings from? When I look at my retroarch-joypads path, and open up this controller specifically, I see this:
input_device = "raphnet.net nes2usb" input_driver = "udev" input_start_btn = "3" input_exit_emulator_btn = "3" input_up_axis = "-1" input_a_btn = "0" input_b_btn = "1" input_reset_btn = "1" input_down_axis = "+1" input_right_axis = "+0" input_state_slot_increase_axis = "+0" input_select_btn = "2" input_enable_hotkey_btn = "2" input_left_axis = "-0" input_state_slot_decrease_axis = "-0"
So, do I do an xboxdrv
--ui-buttonmap
that saysb=input_b_btn,a=input_a_btn
so it matches what worked for the port? Or do I have to create a generic driver and load it intorc.local
and map it in ES for this particular case? I hope not.. :( -
Ok, so trying various incarnations of
--ui-buttonmap
I finally reached the point where I give up. My latest version, coming from the LibRetro website, says that at least for GUI navigation, the keyboard commands show that ENTER is the same as pressing START. So I have my first entry as:--ui-buttonmap start=KEY_ENTER \
My hopes were that I could at least start the game off the Title Screen, and if so, continue to map the other buttons. But it doesn't work. Nothing really happens. However, with a keyboard attached, I CAN press ENTER on the keyboard, and sure enough it works as if I'm pressing start. So I'm not sure what's going on. One thing I notice, after exiting the game, is my terminal screen has a nice error line:
pi@retropie:~ $ xboxdrv: /usr/include/boost/smart_ptr/shared_ptr.hpp:653 typename boost::sp_member_access<T>23::type boost::shared_ptr<T>::operator->() const [with T = Controller; typename boost::detail::sp_member_access<T>::type = Controller*]: Assertion `px != 0' failed.
@mediamogul You ever seen that before? I'm totally lost.
-
I just have stepped in. Give me a minute to read over what you're doing and we'll see what's going on.
-
OK cool. :) I'm taking a break, eating some dinner. I have to go back to work tomorrow, so If I can't figure this out within about 2 more hours, I'm calling it a day, and we'll just have to work on it through the week.
I suspect the problem is coming from the xpad driver that RetroPie comes with preinstalled. I just can't wrap my head around how to have the NES controller be operatable inside RetroArch without having a pre-configured RetroArch configuration. It should be as simple as assigning the xboxdrv identified buttons to specific mappings in RetroArch, but I'm lost.
Thanks for any help you can maybe provide!
-
So the next setup is mapping the controller to RetroArch inputs. Anybody got any pointers on that?
I hope I'm not misreading the problem, but if you're looking to key-map a controller for use in RetroArch, you should first map a standard keyboard in EmulationStation with the keys you wish to occupy 'up,down,left,right,a,b...etc'. Once that is done, those will be the keys that control player 1 and the gui. If this isn't the case, they can be set manually in
/opt/retropie/configs/all/retroarch.cfg
. I'll share my personal entries, as I also took the time to manually map a player 2 entry for the keyboard and it should make for a good reference.# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, # rather than relying on a default. input_player1_a = "a" input_player1_b = "b" input_player1_y = "y" input_player1_x = "x" input_player1_start = "t" input_player1_select = "e" input_player1_l = "l" input_player1_r = "r" input_player1_left = "left" input_player1_right = "right" input_player1_up = "up" input_player1_down = "down" input_player1_l2 = "d" input_player1_r2 = "f" input_player1_l3 = "c" input_player1_r3 = "v" input_player2_a = "k" input_player2_b = "m" input_player2_y = "o" input_player2_x = "n" input_player2_start = "num9" input_player2_select = "num0" input_player2_l = "p" input_player2_r = "q" input_player2_left = "g" input_player2_right = "h" input_player2_up = "i" input_player2_down = "j" input_player2_l2 = "s" input_player2_r2 = "u" input_player2_l3 = "w" input_player2_r3 = "z" # Two analog sticks (DualShock-esque). # Bound as usual, however, if a real analog axis is bound, # it can be read as a true analog. # Positive X axis is right, Positive Y axis is down. # input_player1_l_x_plus = "right" # input_player1_l_x_minus = "left" # input_player1_l_y_plus = "down" # input_player1_l_y_minus = "up" # input_player1_r_x_plus = "num2" # input_player1_r_x_minus = "num1" # input_player1_r_y_plus = "num4" # input_player1_r_y_minus = "num3" # input_player2_l_x_plus = "h" # input_player2_l_x_minus = "g" # input_player2_l_y_plus = "j" # input_player2_l_y_minus = "i" # input_player2_r_x_plus = "num6" # input_player2_r_x_minus = "num5" # input_player2_r_y_plus = "num8" # input_player2_r_y_minus = "num7"
I'm having to head back out and I'll be gone for most of the night, so I'll also leave you with a player 1 key-mapping that I occasionally use in RetroArch as an example.
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \ --detach-kernel-driver \ --force-feedback \ --dpad-as-button \ --trigger-as-button \ --deadzone-trigger 15% \ --deadzone 4000 \ --device-name "Logitech Rumblepad 2 (xboxdrv)" \ --silent \ --axismap -Y1=Y1,-Y2=Y2 \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4 \ --ui-buttonmap a=KEY_A,b=KEY_B,x=KEY_X,y=KEY_Y,lb=KEY_L,rb=KEY_R,lt=KEY_D,rt=KEY_F,tl=KEY_C,tr=KEY_V,du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT,start=KEY_T,back=KEY_E \ --ui-buttonmap guide=void \ &
Also, I believe you'll need to follow the final step of section 3A (quoted below) of the guide to force RetroArch to see the mapped keys as coming from an actual keyboard.
To fully round out this section on key-mapping, it should be mentioned that in some rare scenarios, the keyboard that xbmc virtualizes may not be recognized as being a keyboard by the software you intend to use it with. In this situation, you can create a udev rule that will authenticate the input as being from an actual keyboard at a system level, allowing it to function anywhere. To add this udev rule, drop to the command line and type:
sudo nano /etc/udev/rules.d/99-xboxdrv.rules Press 'Enter" and type the following: SUBSYSTEM=="input", ATTRS{name}=="Microsoft X-Box 360 pad - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
Now press 'ctrl+o' to save the file, 'Enter' to confirm and 'ctrl+x' to exit. The name "Microsoft X-Box 360 pad - Keyboard Emulation" is dependent on the use of the --mimic-xpad variable used in your xboxdrv command. If you have customized that name using the --device-name variable instead, as seen in the earlier example, it would then be replaced with "My Most Non-Non-Triumphant Controller Name Here - Keyboard Emulation".
-
Wow, that's incredibly helpful. I knew I had to me missing something, and mapping a keyboard config for RetroArch just flew right past me. That should definitely give me a step in the right direction. I'll probably not bother with this any more tonight as well, gotta get back into my sleep rhythm.
The only problem I see now, by going by your maps, is my mapping I would use for the d-pad on the NES. It's using ABS.. So would I just do a simple "axis as button" or can you actually map ABS to AXIS? It looks like that might be how you have it, but I'm not sure. Also, since you're not using it, should I remove the
--mimic-xpad
line and replace it with my own device name? Does that make a difference, or just make it easier?FInally, the problem I was having on my last troubleshooting was that with just 1 buttonmap, I was still getting that wierd error when the script finished. Hopefully, it's just not working because I don't have a true keyboard map in place for RetroArch. Stay in touch, I'll probably need your help again once I try to add the 2nd controller! lol And thanks again!
-
Ok I decided I didn't want to wait, and I'm hitting a snag. I added the lines of the keyboard mapping into the
retroarch.cfg
file, but they still don't work. Looking over it, it has me wondering... doesn't this permanently override the other mappings created by ES and RetroPie? Since I'm specifically identifying "for this button, use this key". Further up on my cfg, there are actual entries for those lines.. and they actually say 'nul'. So I think the reason it's not working now is because I have 2 entries for each line... The first batch is near the top of the cfg file, and the 2nd set is where I pasted them at the bottom of the file.
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.