Weird Controller Problems (yes, again)
-
I'm soooooo close to having a working system. If anybody here has been following my progress, and helping me out as I go (many thanks to you guys, like @meleu @obsidianspider etc...) you know I'm trying my best here. So now that I have mostly all of my hardware hooked up and installed, it's back to the software side of things. I decided to start completely over from a fresh SD card image taken from the download page. Then I began by rebuilding the kernel to patch the "northwest" issues with the Raphnet adapters. Then I updated from source RetroArch and a few emulator cores (to enable certain achievement fixes and the ability to change controllers "on the fly"). Then I installed the Joystick Selector addon, though I've not configured it yet. So after that, I created a backup image of my SD card. I still have NOT configured the controllers in EmulationStation yet. So this brings up my first issue I had...
EmulationStation apparently already recognized the Xbox360 controller I had plugged in. After booting back up from making the backup image, ES was just "loaded". It wasn't prompting for a controller configuration. The Xbox controller "barely" worked though. The UP button moved the menu LEFT, and the DOWN button moved the menu right. None of the other buttons worked, except for the L3 (stick) button, which acted like pressing START to bring up the ES menu. Once in there though, I couldn't go up or down, and I couldn't select anything. After a bit of trial and error and lots of frustration, I found an option in the RetroPie-Setup scripts to reset the ES controller maps. Doing that prompted for the input again. It detects 6 controllers, which I assume was the 4 possible Xbox controllers from the wireless dongle, and the 2 Raphnet NES controllers (of which I only have 1 plugged in at the moment). I configured only the XBox controller for now.
With only the XBOX controller configured, I went on to test out and see if I could get a game to load. First up was Adventure for the Atari 2600. The game loaded fine. I could use the various pre-mapped controls to move around, though I don't know if any buttons work because there are none in that game. The "hotkey" controls for selecting color/b&w, choosing a difficulty level, and starting the game all work. Also the hotkey to exit a game (START+BACK) worked fine. However, I was not able to initiate the RetroArch GUI. This has been reported already, and I'm still waiting for a fix on that. It used to be BACK+GUIDE. BACK+A (on the controller at least) works to do a RESET.
The next thing I tried to do was run an NES game, but I wanted to change the default emulator to run QuickNES instead of FCEUmm. So I started the process to launch the game, knowing if I pressed a button on the right screen would give me the option to do that. Well... it didn't work. No button pressing of any kind on that screen does anything. I tried multiple times, pressing all buttons, and nothing. Then just for the hell of it, I tried pressing a button on the NES pad on that screen, and it worked! I never configured that controller in ES, so why does it work? I tried to navigate inside ES with the NES pad after that, and it didn't work. So I THEN went through the configuring of the NES pad inside ES. I could then navigate and launch games, and enter the setup scripts for the run-command. Weird.
Something else I noticed... I can't navigate the menus of the RetroPie-Setup scripts with my Xbox controller. But I CAN use the NES pad. So something is VERY strange here.
Also, when RetroArch starts a game, it pops up dialog information at the bottom of the screen, saying what controllers have been connected and in what position. Every time, it says Xbox is in port 0, 3, 4, and 5, with Raphnet's NES in 1 and 2. So if the Raspberry Pi has assigned the Xbox controller as Port 0, why can't I navigate inside the setup scripts with it?
So in conclusion, I'm having some very strange controller problems. Here they are again, in hopes somebody can assist.
- Xbox and NES controllers
- Xbox can't navigate setup scripts or activate a run-command edit mode
- NES controller can navigate setup and run-command
- Both controllers can exit games, yet neither can access RGUI
I have been able to enter RetroArch manually through the RetroPie menu in ES, and have configured the "Toggle Menu" combo to L3+R3. It's listed as an available option in the INPUT menu. So I can enter the RGUI while in game with that, but the NES pads don't have those buttons. Little help?
-
@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
. :-)
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.