USB controller not recognized after resuming from suspend
-
Hi All, First time poster, long-time lurker. I searched for an answer to this and tried fixing it myself, but with no success so far.
I've got Retropie/Emulation Station installed on Debian 11.
Using an INNEXT USB SNES style controller ( https://www.amazon.com/dp/B01MYUDDCV )
Everything works great, except that after resuming the computer from suspend mode, the controller is no longer recognized until I restart emulation station. I'm running ROMS from a usb thumb drive in case that matters? I don't think it does, but sometimes small details can factor in.
The keyboard and mouse are recognized after resuming from suspend, so I have to enter a key combination to reach the terminal and exit/start emulation station again.
After restarting emulation station the controller works just fine.
I grepped the controller and got the device ID. I created a script that runs after resuming from suspend/wakeup that is supposed to reinitialize the device, along with all available ports. Unfortunately that doesn't seem to work for the controller.
Perhaps there are some verbose logs in Retropie I can enable to find out how this can be fixed?
Also, a related question: I would also like to map some keyboard controls to Retropie as a backup, but I can't seem to find out how to do this.
Please let me know what sort of additional details may be needed and I will provide them.
-
@just-lucas said in USB controller not recognized after resuming from suspend:
Perhaps there are some verbose logs in Retropie I can enable to find out how this can be fixed?
Start EmulationStation with the
--debug
parameter, reproduce the issue (suspend/resume) and then post the log file on pastebin.com. You can find the log file in$HOME/.emulationstation/es_log.txt
.Also, a related question: I would also like to map some keyboard controls to Retropie as a backup, but I can't seem to find out how to do this.
Go you the input configuration and choose to configure the input, then configure your keyboard as if it was a controller.
Please let me know what sort of additional details may be needed and I will provide them.
What RetroPie and EmulationStation version are you using ?
-
@mitu Thanks for the info. I very much appreciate your help.
Retropie version: 4.8.2
EmulationStation: V2.10.3RP
If I had a nickel for every time I've seen something like this with respect to debugging...The controller works just fine when ES runs with debug mode on. Big Surprise huh?! Resuming from suspend works just fine. It still won't work with debugging off of course, just to clarify.
However, none of the games launch and neither will the Retropie settings launch now. What appears to happen is that after attempting to launch a game (tried several known good emulators and games that worked just yesterday) or launch settings, emulation station minimizes to the desktop for a brief moment, then reopens again to where it was last. No error messages in the GUI appear. I noticed the log contains several VSync failures however, which may be the reason why. I remember turning off VSync several days ago, but I cannot get into the settings from the GUI anymore it seems.
Was trying to enter the settings to turn off VSync of course. Is there a config file somewhere I can change that?
For comparison I grabbed the logs without debugging on for what it's worth.
-
@just-lucas said in USB controller not recognized after resuming from suspend:
If I had a nickel for every time I've seen something like this with respect to debugging...The controller works just fine when ES runs with debug mode on. Big Surprise huh?! Resuming from suspend works just fine. It still won't work with debugging off of course, just to clarify.
That's strange, because the
--debug
parameter does nothing to alter how EmulationStation works, it just adds more logging.However, none of the games launch and neither will the Retropie settings launch now.
How are you starting EmulationStation ? It should be from a terminal, otherwise it won't work.
I noticed the log contains several VSync failures however, which may be the reason why. I remember turning off VSync several days ago, but I cannot get into the settings from the GUI anymore it seems.
Your log shows you're running with the Mesa software GL driver, so some functions may not work - what hardware are you using (GPU/CPU) ?
-
emulationstation is always run from a terminal on this unit.
The machine is a 2006 Intel iMac.
-T7200 Core 2 Duo @ 2GHz
-Radeon X1600 128 MB
-4 GB of DDR2I rescued this system from someone who was about to throw it away.
Yes, I realize it's an old PC, but it runs 16 bit-era and previous console emulators perfectly fine. I installed Kega Fusion and a few other emus on it separately to test it and every game I played worked flawlessly. It can't handle N64, PS1 or anything like that, but perfectly fine for Genesis, SNES era and older.
I was able to play on at least a dozen emus on emulationstation without a problem. I had to dial back the resolution a little and turn off VSync, but after that it was fine. There have just been a few quirks along the way (like suddenly VSync errors again like I mentioned), but overall it performs quite well for such a dinosaur.
-
@just-lucas said in USB controller not recognized after resuming from suspend:
The machine is a 2006 Intel iMac.
It should be ok, though some sort of GPU accelerated OpenGL should be available. To diagnose the emulators not properly launching, you may want to enable verbose logging and then check
/dev/shm/runcommand.log
.Not sure why the USB gamepad doesn't get properly detected upon resuming - are the logs you've posted taken during a suspend/resume cycle ? Looking at the logs, the gamepad is detected after ES is minimized (which happens when launching an emulator), so no indication there for the detection problem.
-
@mitu I fixed the games launching issue. On boot I noticed a kernel warning about no firmware for Radeon GPU. Found the appropriate firmware/driver, so that is fixed now.
I mapped the keyboard like you mentioned. Tested wake from sleep again both with debugging on and off, and now the controller doesn't work either way. However it does respond to input from the keyboard when waking from sleep, so that is good.
Yes, I indeed ran this in the terminal:
emulationstation --debug
moved around the menu a few times with the controller, suspended the computer by pressing the power button (to which Debian presents a list of menu options). At this point I have to use the keyboard to arrow down to Suspend, then I press Enter on the keyboard, as the OS doesn't have inputs registered for the controller.
The debug log doesn't appear to have anything useful in there.
I wonder if I can somehow assign some keys in the OS to the controller in Debian? Since the OS seems to take over and Retropie is not longer registering input at the point after I press the power button on the iMac, and the controller doesn't register any input for the OS as it is (but only works with Retropie in focus)...perhaps Retropie does not come back into focus until an input is registered in Debian first, which is then immediately handed off?
Does anyone know a quick way to map the controller keys to the OS?
-
@just-lucas said in USB controller not recognized after resuming from suspend:
..(but only works with Retropie in focus)...perhaps Retropie does not come back into focus until an input is registered in Debian first, which is then immediately handed off?
This is most likely the culprit - if the EmulationStation window is out of focus, it will not process input events. This can be changed by modifying
$HOME/.emulationstation/es_settings.cfg
and adding<bool name="BackgroundJoystickInput" value="true" />
Does anyone know a quick way to map the controller keys to the OS?
You can try one of the programs described in https://wiki.archlinux.org/title/Gamepad#Using_gamepad_to_send_keystrokes.
-
@mitu Makes perfect sense. flipped that value to true in the config and the controller works every time from wakeup.
Thanks so much!
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.