Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

XBOXDRV Guidance Needed



  • Ok, that didn't work. I can confirm all my other games still work after rebooting, but when I try to launch SORR, it just goes back to the ES screen. It also looks like I lost my runcommand dialog box.



  • How can I test to see if the new changes are working? How do I pass a defined variable into a terminal entry? Something like bash /opt/retropie/configs/all/runcommand-onstart.sh $1=sorr Without some kind of observable interaction, I can't track down the problem.


  • Global Moderator

    @hansolo77

    Paste your full runcommand-onstart.sh for a look. I assumed "sorr" is the name of the system, but since it's a port rather than a system, perhaps it's got a different naming convention.

    Try changing

    if [ "$1" = "sorr" ]
    

    to

    if [ "$4" = "/path/to/executable" ]
    


  • I think I might have it cracked... by using the runcommand.log, I identified potential issues. Using some intelligence, I fixed them. The first issue is that in my post of the working script, for some reason the device listed as --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \. The  part shouldn't be there. So I corrected that. That got me a little further. Then I was getting an error about line 24 or something. I checked, and it was the start of the BASH line. So I swapped the IF entry to the bottom, under the joystick-selection bash. That got things moving. Then I was getting an error about an unexpected END OF FILE. I had taken out the & line you included, because when I compared it to my WORKING script, I didn't have it. I added that line back in, and now things look like they might be ok. As another part of testing, I took out the --silent \ line, so I need to add that back in. More testing coming up, but it looks I might have cracked it. The game loads and exists, and I can play an NES game right afterward (where it was closing out immediately before).



  • 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"?


  • Global Moderator

    @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? :)


  • Global Moderator

    @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!


  • Global Moderator

    @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!


  • Global Moderator

    @Pyjamarama

    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 the evtest 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?


  • Global Moderator

    @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 a sudo 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 the onstart 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 says b=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 into rc.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.


  • Global Moderator

    @hansolo77

    I just have stepped in. Give me a minute to read over what you're doing and we'll see what's going on.


Log in to reply
 

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.