Help with Xboxdrv mapping dragonrise controller
-
Got a little further...had some code issues, but debugged and xboxdrv is running at least now...
#!/bin/sh # sudo killall >> /dev/shm/runcommand.log 2>&1 xboxdrv # sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ sudo killall xboxdrv sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_Y=x1,ABS_X=y1 \ --evdev-keymap BTN_THUMB=a,BTN_TRIGGER=b,BTN_BASE=x,BTN_TOP=y,BTN_THUMB2=lb,BTN_BASE2=rb \ --axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x1=REL_X:10,y1=REL_Y:10 \ --ui-buttonmap b=BTN_TRIGGER,a=BTN_THUMB,start=BTN_BASE5 \ --ui-buttonmap guide=void,x=BTN_BASE,y=BTN_TOP,lb=BTN_THUMB2,rb=BTN_BASE2,tl=void,tr=void,lt=void,rt=void,back=void \ --ui-axismap x2=void \
However, when xboxdrv runs, it says,
Your Xbox/Xbox360 controller should now be available as: /dev/input/js2 /dev/input/event4
But my joysticks are set to js0 event2 and js1 event 3...maybe I have to change it in the configs? Also, trying to see how to set xboxdrv for second player...
-
@betadog808 I experienced the same problem as you - the axes were messed up for Daphne (and for uae4arm too, actually). (Note the
--evdev-absmap ABS_X=y1,ABS_Y=x1 \
where I needed to change the axes around.)There are a couple of things you can do. I'm not sure how many joysticks you are using, but I've got 4 DragonRise controllers, so things could have got very complicated. To avoid complication, this is what I did:
First, I use @meleu's joystick configuration script to ensure my joysticks don't get mixed up.
Second, with my xboxdrv configuration, to differentiate between my joysticks, I use the
by-path
method for determining the joysticks which is by far the best method. You don't need to worry about the event numbers or js numbers possibly changing withby-path
.Third, Daphne has a default key set. From experience, any emulator or libretro core which has a default key set is the easiest to set up with xboxdrv. You don't need to worry too much about joystick axes when you can just "tie" "push left on the joystick" to "key left" (for example). (The real beauty of tying xboxdrv to the keyboard is that I use cocktail mode for my MAME vertical games. This means that "pushing left" on the joystick is effectively the same as the "key up" in my MAME settings. This is just so easy to set up with xboxdrv when you "tie" it to the keyboard and, again, there's no concern about axes.)
Here is my xboxdrv configuration for Daphne with default keyboard settings commented out at the top. See in particular the
--ui-axismap
and the--ui-buttonmap
settings:### DAPHNE - DRAGON's LAIR. This is not a libretro core. To exit the emulator, press "back" + "rt" which is the Escape key. ### The default DAPHNE keyboard controls are: ### ESC Quit the game ### 5 and 6 Insert Coin (coin chutes) ### 1 Player 1 Start (and "FEET" in Cliffhanger) ### 2 Player 2 Start (and "FEET" in Cliffhanger) ### Arrow Keys Directional Movement ### CTRL or Space Bar Button #1 (Primary fire and/or Sword) ### Left ALT Button #2 (Alternate fire, used in Bega's Battle, Cobra Command, etc) ### Left Shift Button #3 (used in a few games like Road Blaster, if memory serves) ### / (keypad) Cadet skill level (Space Ace) ### * (keypad) Captain skill level (Space Ace) ### -(keypad) Space Ace skill level (Space Ace) ### P Pause game (laserdisc player must be playing) ### T Tilt game (just a gimmick, only works in a few games) ### 9 Go into service mode (used in Dragon's Lair 2) ### F2 Go into test mode (similar to service mode, used in Cliff Hanger) ### F3 Reset/reboot game Player1_daphne="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap y=void,lb=void,rb=void,tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_TRIGGER=x,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-buttonmap a=KEY_SPACE,b=KEY_LEFTALT,x=KEY_LEFTSHIFT,back=KEY_UNKNOWN,start=KEY_UNKNOWN,lt=KEY_5,rt=KEY_1 \ --ui-buttonmap back+rt=KEY_ESC,start+back=KEY_P"
I should also say that I have 6 buttons (not 12, like you) so my configuration is probably a little simpler than your configuration will be.
-
Thanks @spud11. I went through your config and found out that THIS line fixed it.
--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN
So...now I'm trying to config the buttons and having issues(ain't nothin' easy!). As seen above I have my BTN_ settings but I'm still unsure how the --ui-buttonmap and --evdev-keymap. Not sure how they interact/work. I do know if I comment out one of them, xboxdrv hangs, so it's mandatory. I went through the man page for it and it's still unclear to me.
I'm trying to figure out how to map my BTN_ to the keyboard and BTN_ to other buttons(X,Y,A,B, etc).
-
@betadog808 I'm glad that helped.
I think of the buttons in this way.
First of all, using either
jstest
orevtest
you determined the "names" of the buttons or at least how RetroPie "sees" them.So, in my case, on my arcade panel, I have 2 rows of 3 buttons each (plus a few ancillary buttons below them). The top row is the most important row and the two 2 leftmost buttons on the top row are always going to be the ones I use most - usually the "fire" button and (let's say) the "jump" button (if, for example, I was playing a platform game).
On my arcade panel, RetroPie sees those 2 buttons as
BTN_THUMB2
andBTN_PINKIE
. (With your DragonRise controller, no doubt RetroPie will "see" them differently).I then needed to allocate these buttons to my hypothetical Xbox Controller. The Xbox Controller has 4 primary buttons -
A
,B
,X
andY
. For me, it was just easier to go in alphabetical order, so that's what I did - the 3 buttons on my top row I allocated toA
,B
andX
and the fourth button (the first button on the second row of my arcade panel) I usually allocate toY
as follows:--evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_TRIGGER=x,
You will see that, in the case of Daphne, I haven't allocated the
Y
to a button. That is because Daphne doesn't use too many buttons so I felt I didn't need it. You will see thatY
has been "voided" as follows:--ui-buttonmap y=void,
Of course, you can allocate the
A
,B
,X
andY
to your DragonRise controller any way you like.From there, it is necessary to allocate the Xbox Controller's buttons to Daphne's keyboard commands. You will see that, with Daphne, the
space
key is the primary fire button. So I mapped buttonA
on my arcade panel (the leftmost button on the top row) tospace
. And, again with Daphne, theleft alt
key is the secondary fire button. So I mapped buttonB
on my arcade panel (the middle button on my top row) to theleft alt
key as follows:--ui-buttonmap a=KEY_SPACE,b=KEY_LEFTALT,
At first, it all seems very strange, but it becomes second nature after a while and you are basically able to re-use your first working xboxdrv configuration for almost every emulator simply changing the keys to match whichever keys the emulator you are using uses and "voiding" out those buttons you don't need for that particular emulator.
The granular control of xboxdrv is remarkable. I have more than 50 configurations setup for various emulators.
I suspect you already realise this, but just remember that because this is linux-based, it is very important to ensure that you know when to capitalise things with xboxdrv.
I hope that this helps to explain the "reasoning".
-
@spud11 thanks man. I was able to figure it out and get it working. In my mind I map the virtual controller with my physical buttons via the keymap function. Then I go to the buttonmap line and map my physical buttons to my keyboard keys.
So, BTN_X= x = KEY_SPACE, for example is how I visualize it and it worked.
-
@betadog808 That's excellent. Well done.
-
Sorry in advance for Picking up an Old thread, but it's most relevant to my issue and the advice here has helped me immensely so far, so I would appreciate some help if either of you old hands might be able to help out with xboxdrv configuration... I have tried to follow forum rules, sorry if I got any of this wrong. Commonmark etc.
Model: Pi 3B+ with Official PSU
RetroPie Version: 4.4.1
Built From: Official Retropie 4.4 image
USB Devices connected: Top Left- Wireless Logitech K830 reciever // Bottom Left: 7 Way (Mains powered) USB extension hub // Top Right: DragonRise Zero Delay Encoder linked to Sanwa JLF // Bottom Right DragonRise Zero Delay Encoder linked to Sanwa JLF
Controller used: 2 Sanwa JLF sticks (which are the controllers in question) // Bluetooth Logitech K830 Keyboard // 2x 8BitDo NES30 bluetooth controllers (one is a FC30)
Error messages received: No Errors, just not sure how to finish setup now the sticks are registering as keyboard but there is no sign of XBox controllers unless I run cat /proc/bus/input/devices from command.
Guide used: (Mention if you followed a guide) I've been looking at EVERYTHING i can find as guides and the manual in order to make sense of this, and now having got the sticks to load as virtual keyboards through xboxdrv I'm pretty sure I'm at the final stages of getting this to work. Just need to get Retroarch now to see the virtual devices that are setup I think? (Some sort of Udev rule?? - I'm not sure if this is automatic with xboxdrv.)
File: /etc/rc.local
Emulator: Retroarch Libretro EmulatorsHow to replicate the problem:
A bit of history on the problem: Using 2xSanwa JLFs connected by usb through Two of the (seemingly classicly annoying) dragonrise generic usb joystick zero delay encoders, and stumbled across the issue of having axis problems turned 90 degrees in non-libretro emulators. so I've been trying for a good week or so battling my head around the issue and following advice I've seen given to others with the same issue, and doing a lot of reading of the xboxdrv manual. Finally I got somewhere! Thanks to this thread (nice one guys!) I was able to fix up the code inside rc.local to get both controllers recognising as Keyboard (in the back end there are two new x-box gamepad setups) and get the Axis problem sorted and seemingly now working fine in emulationstation menu and retropie config menus with the adapted setup from xboxdrv... but the problem is I cant get it to recognise any controller at all INSIDE the emulators.
Here is the code I am using inside the file rc.local (used with xboxdrv):
#Success in getting buttons to map to keyboard presses, but I'm having some problems now getting retroarch to even see the virtual pads for games to recognise correct stick even though RetroPie Menus and configuration back-end runcommand stuff now navigating correctly... sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv -i 0 \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \ --silent \ --detach-kernel-driver \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE4=back,BTN_BASE3=start \ --ui-buttonmap a=KEY_Z,b=KEY_X,x=KEY_C,y=KEY_V,lb=KEY_A,rb=KEY_S,back=KEY_RIGHTSHIFT,start=KEY_ENTER \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv -i 1 \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3:1.0-event-joystick \ --silent \ --detach-kernel-driver \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE4=back,BTN_BASE3=start \ --ui-buttonmap a=KEY_Z,b=KEY_X,x=KEY_C,y=KEY_V,lb=KEY_A,rb=KEY_S,back=KEY_RIGHTSHIFT,start=KEY_ENTER \ & exit 0
and here is the output of cat /proc/bus/input/devices after the instance of xboxdrv has been run on startup.
https://pastebin.com/k1k5jyENBut now with xboxdrv I finally feel at a place where I am in a situation where asking the forums rather than trawling them for already existing answers might actually be justifiable. The problem I have is now that although I have setup the sticks to respond as key button presses, and it all seems to work gravy in RetroPie, I can't see the virtual joysticks to select them anywhere in meleu's joystick selection (This tool has the 'ID by name' turned on currently.) Nor can I see them in the Retroarch input setup. First question: Should I be able to? I figure the only thing really stopping this all working is me not knowing how to get retroarch or joystick selection to see the new controllers? Currently all the buttons are inactive on the arcade keys in retroarch as it is still looking for DragonRise sticks (the only option I have to select from - either DragonRise Generic... #1 or DragonRise Generic... #2)) - I'm sure the virtuals are set up at least to some extent because x-box pads are visible when I run cat /proc/bus/input/devices from command and Retropie controller setup recognises them as KEYBOARD. (please see the pastebin link above.)
As a final note, I'd also be very glad for any advice given they are two identical zero delay encoders and have same name and IDs ...I have a feeling that may hold some issues for me once i get into games even if I can get the xboxdrv controllers to work out as they are... I notice at the moment both sticks come up as 'keyboard' when setting controls in Retropie. EDIT: I've just tested it with amiberry running joystick through 'retropie keyboard as joystick' config and sure enough, both joysticks control the player in this setup :( unfortnunately it looks as if this is going to be another problem - getting the two controllers to be individual. I'm aware you can change device name with xboxdrv but i never got it to work, and even still if i did manage, would that change the name of both controllers? I'm assuming that might be the case as there is only one event listed for both controllers when I list device by name (I guess due to identical device names and codes) for both controllers. I have settled on device-by-path because of some advice i saw given by MediaMogul on a different thread here.
Eeeek, I'm so sorry for the huge post. I wanted to give as much detail as possible here so the brilliant minds here can get their teeth into the sitch! Any help on this would help me keep a full head of hair (for now), and potentially save my marriage! (The amount of time I am spending ha!) Thanks very much :)
-
@nighthurdles said in Help with Xboxdrv mapping dragonrise controller:
I was able to fix up the code inside rc.local to get both controllers recognising as Keyboard (in the back end there are two new x-box gamepad setups) and get the Axis problem sorted and seemingly now working fine in emulationstation menu and retropie config menus with the adapted setup from xboxdrv... but the problem is I cant get it to recognise any controller at all INSIDE the emulators.
There's a lot to digest here, but it appears as though everything is behaving correctly. One recommendation I would add up front is to always direct output to the
/dev/shm/runcommand.log
withsudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1\
That way, any errors that occur during launch will be logged in the same location as everything else. As far as your actual problem is concerned, you say the emulators and cores are not recognizing the virtual controllers. However, your map appears to be overriding the virtual button controls with keyboard input. This isn't actually a problem, as I personally have just about all my maps set up the same way, but what needs to happen is that the emulators/cores have to in-turn be mapped to the same keyboard keys. For example, using your map above that reads:
--ui-buttonmap a=KEY_Z,b=KEY_X,x=KEY_C,y=KEY_V,lb=KEY_A,rb=KEY_S,back=KEY_RIGHTSHIFT,start=KEY_ENTER
Retroarch would need to be set to recognize those same keys in '/opt/retropie/configs/all/retroarch.cfg', which would look like:
input_player1_a = "z" input_player1_b = "x" input_player1_y = "v" input_player1_x = "c"
...etc.
-
I've had your post on my screen for a while, went off to eat and didn't notice your edit. Amiberry is tricky with this type of setup and I haven't fully explored all the options. However, with the unique identifiers you mention above, I have been able to get two virtual controllers to be recognized once selected from the Amiberry input settings.
Edit: Just make sure you aren't key-mapping for this particular use, as it will override the normal button functions of the virtual controllers.
-
You, Sir, are a hero. Thankyou for your super speedy reply and for your suggestions, that sounds like where I'm going wrong in terms of button maps... so you're saying it doesn't matter that the retroarch input setup screens only let me choose between the two dragonrise or no input at all? (...as there are no virtuals showing up here?)
When you talk about the the unique identifiers I mentioned above? Do you mean I should continue with the by-path method and it should work? Or should I try to use the --Device-Name option to rename each as a separate line in each controllers section config after calling the device?
Thanks mate. Without you currently I'd be a mess after the 60+ hours I must have spent on this system setup! I feel like this is almost my final hurdle to having my arcade properly built. Huge props to you, and the community here. Much appreciated. I will check out your helpful suggestions and update you on the sitch. :) -
...To follow up now I've had a crack (apologies for the double post)... unfortunately even though it makes total sense that your idea should work and I understand it - it seems I'm getting/understanding something wrong somewhere and still no dice. I must apologise for requiring so much hand holding. I hope that by having this conversation here it can help more than just me in the future. Thanks again for any help you could offer... Linux systems are a new beast and I've tried my best not to post on here and got pretty far myself on this project, (proud as punch) BUT but I really do appreciate your help on this... I'm getting to grips with the understanding and I've got the logging to work (after breaking the code once putting it in the wrong spot!) I've put that command now at the front of both controller's xboxdrv command lines
runcommand.log shows this:
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. 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. Your Xbox/Xbox360 controller should now be available as: /dev/input/js2 /dev/input/event3 Press Ctrl-C to quit Your Xbox/Xbox360 controller should now be available as: /dev/input/js2 /dev/input/event3 Press Ctrl-C to quit
Now, I noticed a couple of things when I looked at the retroarch configs, firstly - when I went into retroarch GUI first time and setup the key maps for player 1, I noticed some (definitely not all - the ones like up,down,left,right,select,start were definitely there though already and probably should have already worked) but no avail. Nevertheless I went about changing each of the other keymaps using my actual keyboard to make sure they were all the same as the ones I mapped the arcade sticks and buttons to in xboxdrv. Weirdly - After saving autoconfig from the GUI frontend (and seeing confirmation of the autoconfig save dialogue in the bottom left corner) It hadn't seemed to do a thing... So I went into retroarch.cfg with text editor in the backend to double check it had changed... oddly not! It hadnt changed to my new config even though it told me the save had been successful? So this time I changed it by hand to match the desired key setup from my xboxdrv exactly as you showed (plus the other buttons). The contents of that retroarch.cfg is HERE: https://pastebin.com/ZixQdYDs
NOTE: I have not bothered changing player 2 controls here as i figure just get player one working firstDo you think I need to map the xboxdrv's second virtual controller to a different set of keys from the first xboxdrv virtual controller? (so not like z,x,c,v etc as the first one is) Would this be the answer to eventually splitting up the full functionality of two controllers rather than both pointing to the same set of keys?
Finally just incase it helps -
My output of cat /proc/bus/input/devices seems normal (from what I gather) for 2 xbox pads setup inplace of the 2 dragonrise and when setting up controllers for sticks both are still returning as KEYBOARD (i hope/assume this is correct!) :I: Bus=0003 Vendor=0079 Product=0006 Version=0110 N: Name="DragonRise Inc. Generic USB Joystick " P: Phys=usb-3f980000.usb-1.2/input0 S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:0079:0 006.0001/input/input0 U: Uniq= H: Handlers=js0 event0 B: PROP=0 B: EV=1b B: KEY=fff 0 0 0 0 0 0 0 0 0 B: ABS=3002f B: MSC=10 I: Bus=0003 Vendor=0079 Product=0006 Version=0110 N: Name="DragonRise Inc. Generic USB Joystick " P: Phys=usb-3f980000.usb-1.3/input0 S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:0079:0 006.0005/input/input1 U: Uniq= H: Handlers=js1 event1 B: PROP=0 B: EV=1b B: KEY=fff 0 0 0 0 0 0 0 0 0 B: ABS=3002f B: MSC=10 I: Bus=0003 Vendor=046d Product=404c Version=0111 N: Name="Logitech K830" P: Phys=usb-3f980000.usb-1.1.2:1 S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.2/0 003:046D:C52B.0004/0003:046D:404C.0006/input/input2 U: Uniq=404c-1b-12-40-6e H: Handlers=sysrq kbd leds mouse0 event2 B: PROP=0 B: EV=12001f B: KEY=3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 ffff0001 130f93 8b17c007 ffff 7bfa d941dfff febeffdf ffefffff ffffffff fffffffe B: REL=1c3 B: ABS=1 0 B: MSC=10 B: LED=1f I: Bus=0003 Vendor=045e Product=028e Version=0110 N: Name="Microsoft X-Box 360 pad" P: Phys= S: Sysfs=/devices/virtual/input/input4 U: Uniq= H: Handlers=kbd js2 event3 B: PROP=0 B: EV=b B: KEY=70000000 0 0 0 0 0 1680 0 40f000 d0000000 B: ABS=3003c I: Bus=0003 Vendor=045e Product=028e Version=0110 N: Name="Microsoft X-Box 360 pad" P: Phys= S: Sysfs=/devices/virtual/input/input3 U: Uniq= H: Handlers=kbd js3 event4 B: PROP=0 B: EV=b B: KEY=70000000 0 0 0 0 0 1680 0 40f000 d0000000 B: ABS=3003c
Thanks again for your advice so far. Much appreciated!
-
@nighthurdles I haven't got access to my Pi at present, but can make the following comments:
You are not far away now from getting things 100% right.
I'm not sure if you've already done this, but you probably have:
Remember to change the 99-xboxdrv file in /etc/udev/rules.d/ to the following:
SUBSYSTEM=="input", ATTRS{name}=="Player_1", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1" SUBSYSTEM=="input", ATTRS{name}=="Player_2", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
(My reference to "Player_1" and "Player_2" corresponds to my naming convention I mention below.)
I've had a look at your
retroarch.cfg
and compared it with mine. It looks okay to me. You've changed the right inputs as far as I can see eginput_player1_select = "rshift" input_player1_select_btn = "nul" input_player1_select_axis = "nul"
That's good.
Also, when you are in the Retroarch GUI, you may find that you have to save the configuration in 2 different areas (within the joystick "area" and then in the "configuration" area on the initial menu). (Sorry - I'm doing this from memory). In any event, a lot of Retropie users prefer changing retroarch.cfg and other relevant files manually - the way you have ended up doing it. I use notepad++ via SMB/samba.
You are right - ultimately, the second controller will need to be mapped to different keys in Retroarch and
xboxdrv
, so they don't point to the same set of keys.It can be difficult to differentiate multiple controllers in Retroarch when using xboxdrv. The "virtual controllers" won't show up as separate controllers as such - they will still all be named "Dragonrise".
I've got 4 Dragonrise controllers so I wound up with a naming convention. I also use meleu's joystick configurator as well to "fix" the joysticks, but using the
by-path
method is the only way to properly differentiate multiple controllers of the same kind usingxboxdrv
.As a reminder, in my
runcommand-onstart.sh
, I have the following:### Note: Player 1 = Joystick 1 (left hand side) = User 1 (Retroarch) = JS3 = platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick ### Player 2 = Joystick 2 (right hand side) = User 2 (Retroarch) = JS1 = platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick ### Player 3 = Joystick 3 (cocktail left) = User 3 (Retroarch) = JS2 = platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick ### Player 4 = Joystick 4 (cocktail right) = User 4 (Retroarch) = JS4 = platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick
So each of my joysticks in
xboxdrv
configurations has a name eg joystick 1 has ---device-name "Player_1" \
and joystick 2 has--device-name "Player_2" \
etc. It was the only way I could keep track of things. You will see that some of the information is similar to the output you got fromcat /proc/bus/input/devices
but tailored to my system.A full example from my
runcommand-onstart.sh
of my lr-mame2003 configuration for all 4 Dragonrise joysticks is below:Player1_8Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_TRIGGER=x,BTN_THUMB=y,BTN_TOP2=lb,BTN_TOP=rb,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap start+back=KEY_F2,back+start=KEY_F4 \ --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,back=KEY_UNKNOWN,start=KEY_UNKNOWN,back+rt=KEY_SPACE+KEY_ESC,lt=KEY_5+KEY_1,rt=KEY_6+KEY_2 \ --ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/SoundToggle.sh" Player2_8Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \ --device-name "Player_2" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_D:KEY_G,Y1=KEY_R:KEY_F \ --ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6+KEY_2,start=KEY_UNKNOWN,back+start=KEY_SPACE+KEY_ESC" Player3_8Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \ --device-name "Player_3" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_DOWN:KEY_UP,Y1=KEY_RIGHT:KEY_LEFT \ --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,back=KEY_5+KEY_1,start=KEY_6+KEY_2,back+start=KEY_SPACE+KEY_ESC" Player4_8Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \ --device-name "Player_4" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_BASE=lb,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_F:KEY_R,Y1=KEY_G:KEY_D \ --ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6+KEY_2,lb=KEY_UNKNOWN,start=KEY_UNKNOWN,back+start=KEY_SPACE+KEY_ESC"
One last thing to remember with Mame is that you also need to map the keys you are using for Players 1 and 2 within Mame's own GUI. (Press TAB when in an arcade game and go to "general inputs" and map the keys accordingly).
-
Thanks for this bud, it looks like the missing steps as i haven't done any of this! I'll crack on with it and edit here when I know whats going on. If you saw myprevious message about 99-xboxdrv.rules not showing up - no matter - i had to make it i get it. My hat is off to you good sir!! :) I'll let you know how this all goes! Thanks again.
-
@nighthurdles said in Help with Xboxdrv mapping dragonrise controller:
Seems that you reckon I should I have another? 99-xboxdrv.rules? But it's not there :/
You'll have to create it yourself, I don't think it's created by default when installing the
xboxdrv
driver. -
@mitu Yep, I was just about to say that I couldn't recall whether it was already there or I had to create it. Thanks for answering that.
-
Between you guys, you've made my week! With some messing around I feel now I'm getting ever closer to a winning configuration, thankyou so very much. The joysticks are mapping now correctly in games 2player and in retropie backend and seem to select correctly in games now thanks to meleu joystick selection. Unfortunately I'm having a bit of a problem which is stopping me getting much further, it's to do with ownership of the runcommand.log.
I must apologise that the problem thats arisen from the xboxdrv setup deviates from the thread topic slightly, but I haven't been doing anything else but this joystick config with xboxdrv whenever I've been able to get some time in on the project since your advice, and now, although I have ideas, I'm not sure how this has popped up. For some reason since I've added the runcommand logging, runcommand.log is now giving me grief trying to run any games from any system and kicks me back to the retropie menu... I get errors:
runcommand.sh: line 982: /dev/shm/runcommand.log: permission denied
*rm: cannot remove '/dev/shm/runcommand.log':operation not permittedNow... it probably goes without saying that I'm a bit of an amateur here and I've been editing every text file I from command through 'sudo nano' unless it's a file which lets me update it normally through my filezilla client. some obviosuly don't like going back across through filezilla when overwriting or going into certain directories, and through my basic understanding, I figure this is because they are owned by root:root, and I also guess that's how its meant to be. (Please somebody do correct me if i'm being foolish!) Now... the real issue here is I'm seeing the runcommand.log file is owned by root:root and I figure this is actually giving me the problem of the errors above and kicking me back to menu on start of every game? permissions error... so after I googled the runcommand problem i found the command sudo chown -R which said it would revert back to user ownership...
I set about changing the following files:
pi@retropie:~ $ sudo chown -R pi:pi /dev/shm/ pi@retropie:~ $ sudo chown -R pi:pi /dev/shm/runcommand.log pi@retropie:~ $ sudo chown -R pi:pi /opt/retropie/supplementary/runcommand/runcommand.sh pi@retropie:~ $ sudo chown -R pi:pi /dev/shm/runcommand.info
After running these scripts, my games start loading again no probs and I could see that the xboxdrv config was working! Hooray! At this point, It all seem cool - and so I got on with the next task. All was fine until i reset. Now... problem is - when i reset the machine and loaded a game, I was kinda annoyed to see exactly the same errors coming back... looking at the files, some have set themselves back to root:root. (namely runcommand.log) Am I missing something?
IF anyone has any ideas as to what could have happened in my xboxdrv setup, they'd add to the list of golden joystick awards i need to send out! ;) The only thing I've been changing is the xboxdrv config in rc.local and also the runcommand-onend.sh (which is also switching back to root.)Now, I'm not sure what to show you other than the configuration files that I have been changing, the runcommand.log obviously doesnt write an error because permission denied.
My rc.local for xboxdrv config for 2 sanwa sticks (5 pin connector) through dragonrise generic usb joystick inputs (now almost working bar this (I believe to be sudo??) problem!)
#rc.local: sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv -i 0 >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE4=back,BTN_BASE3=start \ --ui-buttonmap back+start=KEY_RIGHTSHIFT+KEY_ENTER,back+rb=KEY_RIGHTSHIFT+KEY_F4,back+lb=KEY_RIGHTSHIFT+KEY_F2 \ --ui-buttonmap a=KEY_Z,b=KEY_X,x=KEY_C,y=KEY_V,lb=KEY_A,rb=KEY_S,back=KEY_RIGHTSHIFT,start=KEY_ENTER \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv -i 1 >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3:1.0-event-joystick \ --device-name "Player_2" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_J:KEY_L,Y1=KEY_I:KEY_K \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE4=back,BTN_BASE3=start \ --ui-buttonmap a=KEY_B,b=KEY_N,x=KEY_M,y=KEY_O,lb=KEY_G,rb=KEY_H,back=KEY_LEFTSHIFT,start=KEY_LEFTCTRL \ & exit 0
My runcommand-onend.sh is exactly the same but has the killall xboxdrv command before reloading the virtual devices back again - (for if/when I need to change emulator controls individually across different cores - this file I gather will map the controls back.) Again please correct me if my understanding of this is flawed. Thank you.
#!/bin/sh sudo killall >> /dev/shm/runcommand.log xboxdrv sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv -i 0 >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE4=back,BTN_BASE3=start \ --ui-buttonmap back+start=KEY_RIGHTSHIFT+KEY_ESC,back+rb=KEY_RIGHTSHIFT+KEY_F4,back+lb=KEY_RIGHTSHIFT+KEY_F2 \ --ui-buttonmap a=KEY_Z,b=KEY_X,x=KEY_C,y=KEY_V,lb=KEY_A,rb=KEY_S,back=KEY_RIGHTSHIFT,start=KEY_ENTER \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv -i 1 >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3:1.0-event-joystick \ --device-name "Player_2" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_J:KEY_L,Y1=KEY_I:KEY_K \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE4=back,BTN_BASE3=start \ --ui-buttonmap a=KEY_B,b=KEY_N,x=KEY_M,y=KEY_O,lb=KEY_G,rb=KEY_H,back=KEY_LEFTSHIFT,start=KEY_LEFTCTRL \ & exit 0
The only other thing left to show is my configs/all/retroarch.cfg which I've dropped to a pastebin here: https://pastebin.com/ZixQdYDs
Thankyou to anybody that may be able to help me figure this out. And to you guys who already helped, golden joysticks! x
-
Try removing
>> /dev/shm/runcommand.log 2>&1
from the xboxdrv launch command inrc.local
. What might be happening is that, sinceruncommand.log
doesn't exist at system launch, it's being created with root privileges by launching xboxdrv as root here. If removing that works, you could then try adding it back and puttingsudo --user=pi touch /dev/shm/runcommand.log
before the xboxdrv launch command. That would create theruncommand.log
file ahead of time with the proper privileges. Keep in mind, if this works, it would only need to be done in therc.local
. -
This absolutely worked no problems to fix the permissions errors as a permanent solution. Thanks very much! The dragonrise controllers work for me now including save/load and exit shortcuts! :) amazing advice thanks guys
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.