XBOXDRV Guidance Needed
Yeah, I'm taking a step back for a moment... When I last rebooted my system, it indicated it couldn't find a gamelist to one of my systems. I checked, and the file exists but it was empty. So I though "oh crap" and was going to restore a backup. Well, I don't have a recent backup prior to taking on this task. So I've gone back and uninstalled the XBOXDRV temporarily, and removed the additions to the
rc.localfile so I can get a good backup of the stable system before going forward.
For the record here are my identified keys:
Xbox Controller =============== cat /proc/bus/input/devices --------------------------- N: Name="Xbox 360 Wireless Receiver" H: Handlers=js5 event7 ls /dev/input/by-id/ -------------------- usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick Keymap ------ A = BTN_SOUTH B = BTN_EAST X = BTN_NORTH Y = BTN_WEST BACK = BTN_SELECT START = BTN_START GUIDE = BTN_MODE LB = BTN_TL RB = BTN_TR LT = ABS_Z RT = ABS_RZ Left Stick Button = BTN_THUMBL Right Stick Button = BTN_THUMBR Left Stick UP/DOWN = ABS_Y Left Stick LEFT/RIGHT = ABS_X Right Stick UP/DOWN = ABS_RY Right Stick LEFT/RIGHT = ABS_RX D-Pad UP = BTN_TRIGGER_HAPPY3 D-Pad DOWN = BTN_TRIGGER_HAPPY4 D-Pad LEFT = BTN_TRIGGER_HAPPY1 D-Pad RIGHT = BTN_TRIGGER_HAPPY2
Strange that my action buttons (A,B,X,Y) don't exactly match compass directions. The X and Y are reversed. Oh well, that's what it reported.
Give me about 10 minutes and I'll be good to go. I'm re-imaging the SD card now to a good backup, then I'll install the driver again. So do I still have to ENABLE it in the setup scripts?
Strange that my action buttons (A,B,X,Y) don't exactly match compass directions.
Surprisingly, that's common.
Give me about 10 minutes and I'll be good to go.
Take your time.
So do I still have to ENABLE it in the setup scripts?
No, we'll be enabling it when it launches alongside your intended emulator and disabling it as the emulator quits.
Ok, so I've been dissecting this line by line to figure out what's not working. To start, launching the port from ES doesn't work. It just takes me back to ES. If I try to launch the script directly from a terminal window, I can't get it to launch because it has spaces. Whenever I type it out, it says no such file "Street" (the script path is called "Streets of Rage Remake"). So I created a new identical file called "TEST.sh". And tried launching that. Still nothing, saying permission denied. More research ensued, and I discovered I could run it by this:
It scrolls something very briefly, then starts the port without the controller working. I've been slowly adding # comments out of each line to track down where it's failing. I can't make heads or tails out of that, so I decided to just type out the entire command on one line.. starting with:
sudo killall >/dev/null xboxdrv
That results in an error about no xboxdrv running. Ok, so I comment that line out. Next line:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
Results in an error about not being able to attach to the USB device, and recommends I run with the
--detach-kernel-driveroption. Ok, that makes sense, and it's in the full script.
So I then took it a step further, and typed out this entire thing:
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
Basically I took out the
>/dev/nullpart and all the backslashes, as I figured those are only needed in a script file. The end result tells me another error, about the controller device not existing. Now that I look at it, the controller in the script is listed as
©Microsoft. So I need to figure out how to fix that.
Ok.. I fixed the
©Microsoftbit. The problem is definitely in how the script is laid out. Are all the backslashes necessary? I seem to recall in other codes you actually use a semicolon. But that's just crazy talk. I just feel like the only thing it's doing is launching the driver then failing once it tries to mount the device.
Are all the backslashes necessary?
The whole thing is actually one command on one line. The backslashes are just there to break it up visually so that it's easier to read. I'm finishing up a phone call, but I'll be back with you shortly.
LOL.. "mediamogul tech support". :)
I'm actually very close now. I took out the
>dev/nullbits, and now have it mostly working (to a point). So now my script looks like this..
#!/bin/bash sudo killall xboxdrv 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 \ --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_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \ -- \ #"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sorr" ""
By taking out the null stuff, I can now see what's really happening behind the scenes. I also took out the
--silent \line so I can see what the driver is spitting out. When I run run this now (with the actual port launching being commented out) I get a nice dialog saying
Your Xbox/Xbox360 controller should now be available as: /dev/input/js13 /dev/input/event7 Press Ctrl-C to quit, use '--silent' to suppress the event output
The problem though is that it's still not registering as an input in this stupid game! LOL!! One thing I'm thinking about doing is trying that bit I thought of before, moving the /dev/input/js0 out and letting the driver create a new entry for it. Then have it move back after. I'm testing that now.
I'm still here, but hammers keep falling around me like a Warner Brothers cartoon. To quote everyone's favorite Austrian, I'll be back.
Not to worry! I got it! WOO!!!
All the while I was having trouble, I discovered I didn't have the
--ui-buttonmapsettings reinserted. I had them set up initially before I made the reverts and my backup SD. I just forgot to add them back into the script. Now, everything is working.
TO EVERYBODY OUT THERE!!! DO THIS!! XBOXDRV is the only way to make your controllers work inside Streets of Rage Remix so you can ESCAPE out of the game! Plus, it helped me where my controller couldn't be mapped.
My next project is figuring out how to map my Atari Joystick to work inside of the Atari800 emulator. I probably have to do the same thing, but I have no idea where to begin. That emulator doesn't have a keyboard backup mapping that I can see, so I'll have to figure out what joystick it's seeking mapping to, and try to get mine to match. Might just need to do a move command on the /dev/input/js# for it, but I'll worry about that when I get there.
What a load off, this has bugged me for a week. I'm super excited now. So question to @mediamogul .... if I wanted to add a second controller, but keep these assignments, can I just add that as a separate thing in the script? Or do I need to do some fancy foot work to make the driver initialize 2 controllers together? Right now, I'm mapped using my Xbox360 Wireless controller. I ordered, and have arriving on Wednesday, a set of USB plugged Sega 6-button controllers. My plan is to use those when I play, but to have the Xbox working as a backup. I know the game itself is capable of 2 players, with 2 different keyboard mappings. But I don't know where to begin to have 2 controllers running simultaneously.
Man, I hate pine trees. The least little bit of snow and they fall right out of the ground. If you guys don't hear from me in the future, I will have likely met the tree with my name on it.
Not to worry! I got it! WOO!!!
Hah! I've just settled in for some serious troubleshooting, but I'm very glad it's working. Going into this you were a bit worried, but you got it without nearly a word from me about it.
My next project is figuring out how to map my Atari Joystick to work inside of the Atari800 emulator.
Now that you've done one mapping, they get progressively easier and you'll get more and more creative with all the possibilities afforded to you as well. Before long, you'll have complete control over every aspect if you want to take it that far.
if I wanted to add a second controller... some fancy foot work to make the driver initialize 2 controllers together?
Yeah, they will need to run as separate instances. The command you're running now is really just one line, so you could just use a semicolon to add the second command to the same line.
Well, I'm just glad I got it working. I had the buttonmap bits wrong. Initially, I had it set to
etc, where infact I needed to have it as
etc. So you're configuring the long name "evdev" controls, to a short name XBOXDRV one. Then you configure the keymap to be the
shortname=actual control. I was trying to use
long name=actual control. Once I figured that last bit out, everything started working like it should have.
Bingo, bango, bongo! All in all, you moved through every troubleshooting method I could have recommended. Temporarily removing
>dev/null, for example, is a great way to uncover what issues you're having. As complicated as it can get, xboxdvr is pretty verbose about it's errors, which makes solving them pretty easy.
hansolo77 last edited by hansolo77
@mediamogul Not knowing much about Linux (learning more each day!) and various terminal commands, I don't even know what that
>dev/nullcommand does. The
>bit looks like something to redirect output, like in DOS/Command Prompt in Windows when you want to say create a text file of a directory listing (
dir > list.txt). So my theory is saying we're basically displaying any output generated on the devices (null meaning all). I'm probably way off though. :)
I'll give you a chance to troubleshoot something for me... My system runs all emulators and games fine until after I run Streets of Rage Remix. Once I return back to ES and try to run a different game, nothing happens. I get the RunCommand screen, then it returns to ES. If I reboot the system, everything is working again. Here's my runcommand.log:
Parameters: Executing: pushd /opt/retropie/ports/sorr; ./bgdi-330 ./SorR.dat; popd /opt/retropie/ports/sorr /home/pi /home/pi
So something with my modified launch script is getting mucked up. I don't have that
pushdthing in the script at all, so I don't know where that's coming from.
For the records.. this is my "working" launching script:
sudo killall xboxdrv 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_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \ --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 \ -- \ "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sorr" ""
Rather than going round and round on the cause, this might be a great opportunity to try the simpler method I had in mind earlier. It's also a much cleaner approach and shouldn't cause the type of conflicts you're currently experiencing. If you're game, go ahead and restore your launch script to the way it was before and add the following to
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_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \ --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
Then add the following to
sudo killall xboxdrv
When I get some free time to sit down with it, I want to add this simpler and cleaner method to the guide, replacing the steps you had to work through.
Ok let me work through this a moment... so runcommand will actually run through the
onstartscript first.. then if it identifies that the command being launched is
sorrthen it will execute the script to launch the driver.. then it returns to runcommand to launch the game.. then when it finishes, it will run through the
onendscript to make sure the driver has been completely removed.
Sound about right? Seems simple enough to do.
Sound about right?
More or less, yessir.
runcommand-onstart.shalways runs when a port/emulator is launched. The if /else statement we're adding to it then looks for $1 (see below) to be "sorr". If it is, it will run the xboxdrv command. The addition to
runcommand-onend.shjust breaks it all down afterward, leaving you with your base controller settings. Other variables that can be added to the if / else statement for a variety of other situations are:
- $1 - the system (eg: atari2600, nes, snes, megadrive, fba, etc).
- $2 - the emulator (eg: lr-stella, lr-fceumm, lr-picodrive, pifba, etc).
- $3 - the full path to the rom file.
- $4 - the full command line used to launch the emulator.
onstartfile has this in it already:
# the line below is needed to use the joystick selection by name method bash "/opt/retropie/supplementary/joystick-selection/js-onstart.sh" "$@"
would I move that down and put the
ifstatements above it since the bash doesn't have any?
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=sorrWithout some kind of observable interaction, I can't track down the problem.
Paste your full
runcommand-onstart.shfor 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.
if [ "$1" = "sorr" ]
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
IFentry 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).