XBOXDRV Guidance Needed
-
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. -
@mediamogul I did some more work... I guess I skipped the part where you said I should map the keyboard in EmulationStation first. So I did that now. Strange thing is, it still doesn't show up in the
/opt/retropie/configs/all/retroarch/autoconfig
folder as a listed config. So I guess that's where you say I should go in and add it directly to the retroarch.cfg file? Also.. when I run through my test.sh script, I see a blurb at the bottom of my screen (not very long) inside RetroArch saying something like "Device not configured". And it's using my specified device name. So this has me thinking... should I set this up with the driver running, then launch EmulationStation and create a new controller config with that? I feel like this is defeating the purpose, since I might as well just use xpad. Any ideas why RetroArch would be displaying my xboxdrv device as an actual device and not a keyboard?Also, I'm still getting that weird dialog at the end of my script running:
xboxdrv: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = Controller; typename boost::detail::sp_member_access<T>::type = Controller*]: Assertion `px != 0' failed.
-
@mediamogul I think I might have it, at least for Player 1... I'm not sure what I did.. I followed all the steps. It just works now. GRR. I wish I knew what I changed to make it work. I will say, once I finally had it, I had to go back in and change the ABS mapping to X1/etc instead of dpad_x. But aside from that, I don't know what I did. :( Maybe it was rebooting after adding that change to the
/etc/udev/rules.d/99-xboxdrv.rules
. I actually have mine configured asSUBSYSTEM=="input", ATTRS{name}=="Microsoft X-Box 360 pad - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1" SUBSYSTEM=="input", ATTRS{name}=="NES Pad (xboxdrv) - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
When I read the bit at the bottom of it, saying it was dependent on the use of
--mimic-xpad
, I had a feeling I needed to add my OWN device name to the list as well. Maybe that's wrong, can you confirm?In any case, here's my working "prototype":
#!/bin/bash sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event3 \ --detach-kernel-driver \ --device-name "NES Pad (xboxdrv)" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \ --dpad-only \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_UP:KEY_DOWN \ --ui-buttonmap start=KEY_T,back=KEY_E,b=KEY_B,a=KEY_A \ & "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _SYS_ "nes" "/home/pi/RetroPie/roms/nes/Bubble Bobble (USA).zip" sudo killall xboxdrv
Stage 2 will be finding out how to make it work with 2 controllers (and figuring out how to add the player2 keyboard inputs).
Also, I'm still getting that error:
xboxdrv: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = Controller; typename boost::detail::sp_member_access<T>::type = Controller*]: Assertion `px != 0' failed.
-
@hansolo77 said in XBOXDRV Guidance Needed:
I think I might have it
Nice!
Maybe it was rebooting after adding that change to the /etc/udev/rules.d/99-xboxdrv.rules
I'd put money on that being what solved the issue.
I had a feeling I needed to add my OWN device name to the list as well.
Once you customized your device name, it was the right thing to do.
Also, I'm still getting that error
This I'm not sure about, as I've never seen it come up before. Does the error still come up when triggered from
/opt/retropie/configs/all/runcommand-onstart.sh
like your previous 'Streets of Rage Remake' mapping? -
@mediamogul said in XBOXDRV Guidance Needed:
Does the error still come up when triggered from
/opt/retropie/configs/all/runcommand-onstart.sh
like your previous 'Streets of Rage Remake' mapping?Good question. I'll have to check this when I get home tonight. I didn't want to add this config to the
onstart
yet as I still want to get a Player 2 map working as well first. It's not discussed in the RetroPie wiki, so I'll have to look over at the official documentation. A quick glance makes me think I have to run the driver in daemon mode. But if I go further down the list, I see:If you want to use multiple wired controllers you need to start multiple instances of the xboxdrv driver and append the -i argument to select the appropriate controller like this:
$ xboxdrv -i 1
So does that mean, in my script, I basically have it say
xboxdrv -i 1
(and then all the cfg) ending in the&
, and then the next line bexboxdrv -i 2
(and all the 2nd controller mapping) and then the command to launch the game? Will the driver still properly unload itself with 2 instances like that?Also, I noticed that after rebooting, and then remapping the keyboard in ES, it actually changed the button mappings in the
retroarch.cfg
at the top of the file, rather than down at the bottom where I had added the lines you provided (I set it back to the way it was before). So do I simply add those player 2 lines right below where the modified keys for player 1 are listed?Lastly, is there any way that you know of that can make RetroArch not pop up an alert message saying that "so & so controller isn't configured"? Since I created a device name, it shows up like that now every time RetroArch starts. It's not there very long, but it's a little distracting.
Thanks!
-
@hansolo77 said in XBOXDRV Guidance Needed:
A quick glance makes me think I have to run the driver in daemon mode.
I don't believe that applies when using the -evdev functions of xboxdrv. You can just append a second command to the first using a semicolon.
it actually changed the button mappings in the retroarch.cfg at the top of the file, rather than down at the bottom
If you're saying that these entries are listed twice, they shouldn't be. To my recollection, I had to add the player 2 entries, but the player 1 entries should already be there and shouldn't be duplicated.
Lastly, is there any way that you know of that can make RetroArch not pop up an alert message
I believe the entry that controls that is:
# Enable usage of OSD messages. # video_font_enable = true
You'll need to uncomment the second line there and of course change true to false.
Edit: It should be noted that this will eliminate all onscreen text, making visual feedback for features like RetroAchievements nonexistent as well.
-
@mediamogul said in XBOXDRV Guidance Needed:
Edit: It should be noted that this will eliminate all onscreen text, making visual feedback for features like RetroAchievements nonexistent as well.
That's Ok.. I'll just keep it then.
I'm still lost on how to do the the 2-controller thing. Can you give me an example of one you're using?
-
@hansolo77 said in XBOXDRV Guidance Needed:
Can you give me an example of one you're using?
I actually don't automate my mappings. I launch a series of player 1 and player 2 scripts that I keep in the RetroPie menu that are organized by system. I do this because I have several dozen controllers that I might want to make use of at any time and that particular scenario just doesn't lend itself to automation. That being said, I have automated a smaller group of two player controller mappings for friends and family. Using your mapping from above twice as an example, adding a second player can be accomplished by combining two mappings into one command that should look something like:
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 \ & ; \ 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
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.