Weird Controller Problems (yes, again)
-
@hansolo77 I've never used an Xbox controller, but my Raphnet adapter shows up as 4 controllers, regardless of how many controllers are plugged in, because the chip itself is telling Linux it's four controllers. What happens when you unplug the Raphnet adapter entirely (assuming you soldered a USB plug on it)?
-
It detects 6 controllers...
@obsidianspider answered this one above.
- Xbox can't navigate setup scripts or activate a run-command edit mode
- NES controller can navigate setup and run-command
The magic behind using joystick to navigate through dialogs (runcommand and retropie-setup menus) is done by a tool named
joy2key.py
. It is located at/opt/retropie/supplementary/runcommand/joy2key.py
(source code). This tool makes the d-pad strokes act like arrows keystrokes, button 0 act like <enter>, and button 1 act like <tab>. But this tool make it only for the joystick detected by the OS, and normally it is/dev/input/js0
. So, in your case, it seems that you NES controller is the/dev/input/js0
. (actually you can change it to another joystick, but let's leave it for later :) ).Other peculiarity is that each manufacturer sets the button numbers in a different way. Examples of what I have here:
- PlayStation2 joysticks: triangle is 0 (enter), circle is 1 (tab).
- 8Bitdo NES30: A is 0 (enter), B is 1 (tab).
- 8Bitdo Zero: B is 0 (enter), A is 1 (tab).
You can see the button numbers using the
jstest
tool.jstest /dev/input/js0
- Both controllers can exit games, yet neither can access RGUI
IMHO the best way to edit hotkey mappings in retropie is editing the specific controller config files. These files are
/opt/retropie/configs/all/retroarch-joypads/YOUR_CONTROLLER_NAME.cfg
. They are automatically created/updated when you use the emulationstation to configure a joystick, but after its creation you can edit it to fit your needs. If you take a look at various of these files, you will notice that the button numbers differs from various manufacturers.This section of the wiki will help you a lot with this config: https://github.com/retropie/retropie-setup/wiki/RetroArch-Configuration#autoconfigurations
-
Thanks for telling me about that jstest program. I ran it on the js0 device, and it shows up as the Raphnet adapter. The js1 device also shows up as the Raphnet. I don't get the Xbox until js2. This might have to do with the fact that when my system is turned off, the Xbox controller is also off. When I turn the system on, the first thing connected that it detects would be the Raphnet adapter, since it's plugged in. The Xbox controller I then have to "wake up" and then I have to "sync" it with the adapter. So by the time the controller is on and synced, the boot process is nearly complete, and the devices are already identified in Linux.
One thing I tried, was to change the location of the USB plug on the Pi for the devices. I have the Xbox controller plugged into a USB hub in port 0 (top left when looking at the plugs on the Pi) and the Raphnet adapter plugged into port 3 (bottom right). I was hoping it would detect the devices attached in the order they're plugged in, but that didn't seem to help any.
If I unplug the USB to the Raphnet adapter, then the Xbox dongle (correctly) is identified as the only connected controller, and js0 is mapped as the Xbox controller. Doing this also then makes the controller work just fine in the RetroPie-Setup scripts. I even tested, and can confirm I now have access to the run-command editor as well. So with the Raphnet adapter unplugged from the Pi, the Xbox controller works exactly like it's supposed to.
I experimented then with connecting the Raphnet adapter, but leaving the NES pad unplugged. This made no impact. The Pi still boots up identifying the Raphnet adapter as js0 and js1. The Xbox controller then goes back to the original issues of not working inside the Scripts, opening the run-command editor, etc. I then connected a NES pad with the js0 test running, and all of the inputs were then correctly identified.
So, yeah. My problem seems to be that everything is working like it's supposed to, it's just that the Raphnet adapter is being detected during boot up as the first joystick input device, rather than the Xbox dongle.
(actually you can change it to another joystick, but let's leave it for later :) )
I think this is what I need to do. Somehow re-arrange the the input list. Care to enlighten me again? :)
---I really appreciate all your help you guys. This is has been an exciting project for me, and has really helped improve my mood as far as my depression goes. I needed something to keep my mind busy, and this is something easy enough for me to follow, but challenging to the point where I'm using a bit of my brain cells in troubleshooting. I just don't know enough about Linux (I'm learning!) to do a lot of stuff on my own. So thank you bunches!
-
@hansolo77 It sounds like you're running into the same thing that I ran into. Where you want to have one preferred controller be the default (in your case, the Xbox controller), but then fail over and use the other (Raphnet) when that preferred controller isn't connected. I was looking at doing that with an 8bitdo Bluetooth or a USB arcade stick, but it didn't work the way I wanted it to, so for now I'm sticking with the Raphnet only and bought some cheap SNES extension cables instead of some 8bitdo controllers.
-
@hansolo77 said in Weird Controller Problems (yes, again):
(actually you can change it to another joystick, but let's leave it for later :) )
I think this is what I need to do. Somehow re-arrange the the input list. Care to enlighten me again? :)
Well, IMO the current method is a bit tricky, a bit of Linux shell knowledge helps to understand. The main dev said that will do some more work on this subject, but for now let's go with the current method...
The scripts that use the
joy2key.py
(runcommand, retropie_setup and my joystick-selection), try to get the joystick device to be used for menu navigation from a shell variable named__joy2key_dev
, if this variable doesn't have this info, they get the first/dev/input/js*
found. So, all you have to do is set__joy2key_dev
to the device you want.The trick here is:
- discover what is the js-number of the controller you want to use for dialog navigation. According to what you said, the xbox controller is the
/dev/input/js2
. - Put the following line in the
/opt/retropie/configs/all/autostart.sh
before the command that starts emulationstation:
export __joy2key_dev="/dev/input/js2"
- reboot the system.
- discover what is the js-number of the controller you want to use for dialog navigation. According to what you said, the xbox controller is the
-
@obsidianspider said in Weird Controller Problems (yes, again):
@hansolo77 It sounds like you're running into the same thing that I ran into. Where you want to have one preferred controller be the default (in your case, the Xbox controller), but then fail over and use the other (Raphnet) when that preferred controller isn't connected.
Not exactly. I'm not really looking for failover if the Xbox controller isn't connected. I'm actually just looking to use the Xbox controller as primary for all systems except for NES. Those would use the NES pads. But even then, I'd really only use the NES pads for nostalgia and showing off when friends/brother is over. So like 99% of the time, I'd use the Xbox controller. The other 1% of the time, I'd like to use the NES pads, and using the "joystick-selector" addon, I can configure the NES system to use those pads. The problem I'm having though is that the NES pads are being detected first, and therefore are being setup on the system as the primary controllers instead. This inevitably is causing the problem then with not being able to navigate with the Xbox controller inside various scripts for setup, or working inside RetroArch, etc.
@meleu said in Weird Controller Problems (yes, again):
The scripts that use the
joy2key.py
(runcommand, retropie_setup and my joystick-selection), try to get the joystick device to be used for menu navigation from a shell variable named__joy2key_dev
, if this variable doesn't have this info, they get the first/dev/input/js*
found. So, all you have to do is set__joy2key_dev
to the device you want.I see. So the system is looking for a specific variable in that dev file to know which controller to use for the joy2key program. If that file is blank, it uses the first attached controller the OS detects. Seems like another set of simple scripts could easily allow a user to set that up. If there are multiple controllers available, just have it list them and then highlight (maybe even just draw an asterix * next to it) to show which one is currently configured as the primary. Then you just select a different one if you want, and it would write that particular js# to the
autostart.sh
file. I know enough about computers and programming to understand this, fundamentally. Doing the actual programming though, I'd be completely lost. And again, it falls on my lack of Linux knowledge as to what the files are I'm looking to edit, and where to place them, etc.I will give this a go and see what turns up. Obviously, as time goes on, that js# might need changing. But at least with this "practice" I can see how it's working and can easily change it as needed until such support scripts are (if ever) created.
-
@meleu i recently posted having an issue that my 2600-daptor ii is always seen as joystick 0 in linux even when it isnt in es or any emu other than wolf4sdl. I got no response. I would love to know how to make my vision-daptor seen as js0 in linux stuff/ retropie menu stuff, jstest....
-
@hansolo77 i had to use the raphnet fix because of my apple iie keyboard adapter. I have the issue of the wrong adapter always being js0 in the linuxy stuff even though it isnt in other stuff. Im hoping to find a way to get around that. So maybe the fix is the problem. Personally i would deal with this over the northwest scrolling issue from linux.
-
@edmaul69 said in Weird Controller Problems (yes, again):
@meleu i recently posted having an issue that my 2600-daptor ii is always seen as joystick 0 in linux even when it isnt in es or any emu other than wolf4sdl. I got no response.
I didn't see it. Can you post a link to your topic? Did you solve your issue?
I would love to know how to make my vision-daptor seen as js0 in linux stuff/ retropie menu stuff, jstest....
Do you actually mean "make the vision-daptor be the
/dev/input/js0
" or you just wanna be able to navigate through the menus using this controller? -
@meleu navigating the menus isnt a huge deal but because it isnt seen as js0 i cant play wolfenstein or spear of destiny on wolf4sdl
-
@edmaul69 I think that @mediamogul faced a similar problem and talked about it in this thread: https://retropie.org.uk/forum/topic/1757/js0-being-ignored-by-some-emulators
Maybe he can give a hand to you.
( @mediamogul please, forgive me if I'm bothering when I tag you on the topics you are not on.)
-
@meleu said in Weird Controller Problems (yes, again):
The trick here is:
- discover what is the js-number of the controller you want to use for dialog navigation. According to what you said, the xbox controller is the
/dev/input/js2
. - Put the following line in the
/opt/retropie/configs/all/autostart.sh
before the command that starts emulationstation:
export __joy2key_dev="/dev/input/js2"
- reboot the system.
Sorry it took so long, this is the first day I have off to be able to test this. It doesn't seem to be working. I edited that file, there was only one line in it
emulationstation #auto
. So I dropped that a line and put on the 1st line that code. Saved the file, rebooted, and I'm back in ES. I try to launch a game, run-command comes up, I press buttons, and nothing happens. I then tried entering the RetroPie-Setup script menus, and again, no input was registered on the Xbox controller. I did press F4 to get to terminal, and ran the `jstest /dev/input/js2' and confirmed it still detects that as the Xbox controller.Are you sure that is the correct format of the code, and that the `__joy2key_dev' part is right?
- discover what is the js-number of the controller you want to use for dialog navigation. According to what you said, the xbox controller is the
-
@meleu said in Weird Controller Problems (yes, again):
please, forgive me if I'm bothering when I tag you on the topics you are not on.
I am getting rather behind on my cancer research, but my last experiment just ended up causing a lot more cancer and something that I'm now labeling "super cancer", so I could use a break.
because it isnt seen as js0 i cant play wolfenstein or spear of destiny on wolf4sdl
Personally, I key-map for 'Wolfenstein 3D' to solve this same problem and allow for a more flexible control scheme. However, you could also use a case statement, similar to the one MadHorse wrote for selectively launching xboxdrv commands, only have it to where it renames js0 to a temporary name and js* to js0 on game launch.
Although not in a case statement, I have successfully done this myself a few times for various reasons and the command is nothing more complicated than:
mv /dev/inputs/js0 /dev/inputs/temp_name mv /dev/inputs/js* /dev/inputs/js0
You can of course "flip the script" as the kids say to get back where you started.
-
@mediamogul when you say keymap what are you using to do this?
-
I just did a search in WinSCP on the Root file system. "joy2key.py" is found in 2 locations:
- /home/pi/RetroPie-Setup/scriptmodules/supplementary/runcommand/joy2key.py
- /opt/retropie/supplementary/runcommand/joy2key.py
I edited both files to see their contents, and there is no mention of receiving inputs from
__joy2key_dev
. Is it possible this file has been updated and no longer seeks for input from that dev location first? All I know, I added the line to the correct file, and it doesn't work. It makes absolute sense as to what it's supposed to do, it just doesn't do that. -
I'm using xboxdrv. I've found it to be a big help for that game in particular. For example, strafing left normally requires that you input two buttons. To simplify this I mapped 'alt+left' to the left shoulder button. I do the same thing to strafe right for the right shoulder and it really makes maneuvering through the game a lot easier. I also have the exit command mapped to 'select+start' and the menu command mapped to 'select+x' to match up with the familiar RetroArch control scheme.
-
Something else worth mentioning that I'm pretty proud of with my setup for Wolf3D is my mapping for weapon selection. Since the game relies on keys 1-4 for weapon selection, rather than having an option for progressive selection like 'DOOM' or the Quake games, I mapped my own to the 'x' button of my controller using:
--ui-buttonmap x=cycle-key:KEY_1:KEY_2:KEY_3:KEY_4
Now I can cycle through my available weapons with one controller button, rather than having to map four dedicated ones.
I could geek out about this stuff all day. Part of the fun for me is finding a better, more efficient way to control a game.
-
@mediamogul so can i use xboxdrv just for this? I just dont want all my controllers seen as an xbox controller. I have adaptors that use multiple controllers but dont share all the same button numbers. Could make a real mess for me.
-
@hansolo77
The__joy2key_dev
is used only by the scripts which calljoy2key.py
. If you are curious, here are links to the exact line in each file:- runcommand.sh
- helpers.sh (used by
retropie_setup.sh
) - jsfuncs.sh (used by RetroPie-joystick-selection tool)
I'm away from my raspi now, but I'll try to find a solution when I get home. And the first thing I'll try is to put that
export
line at the end of/etc/profile
. :-) -
@edmaul69 said in Weird Controller Problems (yes, again):
so can i use xboxdrv just for this?
Sure, you can use either one of two methods mentioned in the guide for selective launching of xboxdrv. I don't use it for everything myself.
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.