RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

[Android] gamepad stops working after loading/closing content

Open ner00 opened this issue 4 years ago • 37 comments

Description

I’m using a generic USB gamepad with OTG connection. The USB gamepad is recognized upon opening RetroArch, I’ve been able to map all the keys properly, the issue is after loading a game or closing the game (content); the gamepad does nothing as if it had been disconnected, not even when returning to the RetroArch menu (the gamepad is still responsive to the OS). The only thing that works is unplugging/plugging back the usb gamepad and pressing any button, then I get the bottom-left notification message about it being detected again and it starts working within the game and RetroArch menus.

I’ve tried saving the autoconfig file too, but it makes no difference at all… works until a game is loaded and I’m back to unplugging/plugging back.

  • This is the config for the gamepad used: https://gist.github.com/ner00/0934c59f65b7de44a5bdfd6a94cf2f49

  • This is the log captured during one session: https://gist.github.com/ner00/b52722b2470275b5c8520b4ba9dfbd38

Expected behavior

Gamepad should not stop working when loading/closing content (ROMs).

Actual behavior

Gamepad stops working after loading/unloading content until being physically unplugged/plugged back.

Steps to reproduce the bug

  1. Open RetroArch, press a button on gamepad, detected!
  2. Navigate just with the gamepad, load content (Genesis Plus GX core);
  3. Content is loaded, gamepad stops working immediately;
  4. Unplug/replug gamepad, it gets recognized in-game and works fine;
  5. After playing a few seconds I press the menu hotkey on the gamepad, select 'Close content';
  6. The game is unloaded, goes back to RetroArch menu and gamepad no longer works again;
  7. Again, I have to unplug/plug back the gamepad for it to work once more.

Bisect Results

Tested multiple versions, as far back as v1.2.2 (Jul 19 2015).

  • v1.2.2 does not have this issue, but the next release does - v1.3.0 (Feb 25 2016).

  • v1.3.0 seems to be where this issue started and also when introduced the new menu design. It could be just a coincidence and the gamepad issue on content load/unload not being related to the material design menu, nevertheless since then all versions have the same issue with a few controllers and the same workaround applies (holding 'confirm' button and pressing D-Pad when loading content).

Version/Commit

  • RetroArch: 1.8.4/f425d8d

Environment information

  • OS: Android v8.1

ner00 avatar Jan 22 '20 23:01 ner00

I don't know if this may be useful in any way: If the content is loaded through touchscreen and as soon as it starts if I press any direction on the D-Pad (and no other buttons), it picks up the controller within the game, otherwise, if I load the content using the B button of the controller it is not picked up afterwards.

ner00 avatar Jan 22 '20 23:01 ner00

Workaround for users in the same situation (don't ask me why this works at all):

  • To load (run) the content, press and hold the B button, immediately after pressing the B button and while still holding it press repeatedly any D-Pad direction - a notification indicating gamepad detection should pop-up at the bottom.

  • Now, this might have worked for loading the game/content, but the same problem will happens on closing the content (advice, don’t use the close content option). If you must use that option, you will have to use the same trick with something in mind: use any D-Pad direction except left, because if you press left while you’re holding the B button it will just return on top of the ‘Run’ option and will enter the game again. Using another direction (right, up, down) will jump to another menu option an not run the game again.

NOTE: By ‘B’ button I mean the confirmation/action button inside the RetroArch menu, which is by default B.

ner00 avatar Jan 23 '20 00:01 ner00

@twinaphex @Themaister @RobLoach @ToadKing @webgeek1234 I apologize in advance for at, but in light of the workaround above (corroborated by at least another person with different hardware altogether - iPega PG-9017 using Bluetooth) I thought maybe this could help somehow narrow down the source of this issue which I've also seen mentioned a few times. Most of the complaints I've read can only be found in forums though, here in GitHub I could only find 2 old issues matching partially the symptoms:

  • https://github.com/libretro/RetroArch/issues/2827

  • https://github.com/libretro/RetroArch/issues/9790

ner00 avatar Jan 23 '20 21:01 ner00

MX9 TV box (Rockchip RK3229) Android 6.0.1

USB Joystick (Microntek) vendor_id 121 product_id 6

RetroArch 1.8.4

1 - If I launch RetroArch from the TV box menu using the gamepad itself, it won’t work to navigate the menu unless I unplug it, plug it back and press the D-pad (any direction). If I press any other button, the gamepad is not recognized, even if I press the D-pad later. When I start a game, gamepad won’t work unless I repeat the procedure.

2 - If I launch RetroArch using any other device (keyboard or TV remote), once in the menu, if I press the D-pad in the gamepad, it’s recognized (I get the message “Microntek USB Joystick configured in port #0”) and it works to navigate the menu. If I press any other button, the gamepad is not recognized, even if I press the D-pad later. When I start a game, gamepad won’t work unless I unplug it, plug it back and press the D-pad again.

3 - If I launch RetroArch using any other device (keyboard or TV remote) and do not press any button in the gamepad when in the menu (navigate using the other device), when I start a game, gamepad will be recognized if I press the D-pad. If I press any other button, the gamepad is not recognized, even if I press the D-pad later.

Long story short: looks like RetroArch can’t “find” the controller if it’s used in the OS, and the core can’t find it if it’s used in the menu. Unplugging/plugging back the controller makes it work. I can also avoid using the controller in the OS and in RetroArch menu, so it’s still “available” to the core when emulation starts.

I hope this debugging helps to fix the issue.

oldnapalm avatar Feb 18 '20 14:02 oldnapalm

I might have focused this issue down to a HOTKEY ASSIGNMENT BUG.: Having the Select/Coin button assigned as the Hotkey in Retroarch will render that button unresponsive as an in game button i.e to serve as the Coin button. It feels like none of the controls work, but it is just the Coin button.

I can reproduce this for a list of Roms (not all), and across the range of (Arcade) emulators (all available Mame and FBA cores tested in Android).

Roms that I tested and reproduce this Hotkey bug: Pac Man, Cadillacs And Dinosaurs (dino.zip), The Punisher, Centipede (and others).

Roms that I tested and that seem immune to this bug and work across the range of emulators: Galaga, Dig Dug (and others).

Temporary workaround : Assign a different Hotkey . In my case I chose RB (which I don't use within the game itself).

PS: My controller is a Xin-Mo ps3 encoder board with arcade joystick/buttons in DIY Android pinball/arcade machine. Android Device : Beelink X86 mini PC running Android X86.

Cheers,

Chris

bietekwiet avatar May 21 '20 12:05 bietekwiet

@bietekwiet This isn't the same as the issue I opened this with. I have no hotkey assignment, and mine and a couple other people seem to observe a failure from RA to hand-off gamepad to core and back. I cannot say that the issue persists across all cores, because I only tried 3 or 4, but in those I tested it is persistent and there is no coin functionality because it's console emulation. Some of them arrive at the title menu requiring minimum the D-pad to toggle selection (no select/start/coin button involved). Bottom line is, if I use the gamepad to load content, gamepad is not picked up by core; if I use gamepad to close content, gamepad ceases to be picked up by RetroArch.

Anyway, thanks for sharing that information.

ner00 avatar May 21 '20 15:05 ner00

Description

I’m using a generic USB gamepad with OTG connection. The USB gamepad is recognized upon opening RetroArch, I’ve been able to map all the keys properly, the issue is after loading a game or closing the game (content); the gamepad does nothing as if it had been disconnected, not even when returning to the RetroArch menu (the gamepad is still responsive to the OS). The only thing that works is unplugging/plugging back the usb gamepad and pressing any button, then I get the bottom-left notification message about it being detected again and it starts working within the game and RetroArch menus.

I’ve tried saving the autoconfig file too, but it makes no difference at all… works until a game is loaded and I’m back to unplugging/plugging back.

  • This is the config for the gamepad used: https://gist.github.com/ner00/0934c59f65b7de44a5bdfd6a94cf2f49
  • This is the log captured during one session: https://gist.github.com/ner00/b52722b2470275b5c8520b4ba9dfbd38

Expected behavior

Gamepad should not stop working when loading/closing content (ROMs).

Actual behavior

Gamepad stops working after loading/unloading content until being physically unplugged/plugged back.

Steps to reproduce the bug

  1. Open RetroArch, press a button on gamepad, detected!
  2. Navigate just with the gamepad, load content (Genesis Plus GX core);
  3. Content is loaded, gamepad stops working immediately;
  4. Unplug/replug gamepad, it gets recognized in-game and works fine;
  5. After playing a few seconds I press the menu hotkey on the gamepad, select 'Close content';
  6. The game is unloaded, goes back to RetroArch menu and gamepad no longer works again;
  7. Again, I have to unplug/plug back the gamepad for it to work once more.

Bisect Results

Tested multiple versions, as far back as v1.2.2 (Jul 19 2015).

  • v1.2.2 does not have this issue, but the next release does - v1.3.0 (Feb 25 2016).
  • v1.3.0 seems to be where this issue started and also when introduced the new menu design. It could be just a coincidence and the gamepad issue on content load/unload not being related to the material design menu, nevertheless since then all versions have the same issue with a few controllers and the same workaround applies (holding 'confirm' button and pressing D-Pad when loading content).

Version/Commit

  • RetroArch: 1.8.4/f425d8d

Environment information

  • OS: Android v8.1

Hello, I have exactly the same problem, I'm scouring the internet for definitive answers to recognize as a xinput, being our control a directinput happens this. Has anyone figured out how to solve it?

djhyperdrum avatar Feb 03 '21 19:02 djhyperdrum

MX9 TV box (Rockchip RK3229) Android 6.0.1

USB Joystick (Microntek) vendor_id 121 product_id 6

RetroArch 1.8.4

1 - If I launch RetroArch from the TV box menu using the gamepad itself, it won’t work to navigate the menu unless I unplug it, plug it back and press the D-pad (any direction). If I press any other button, the gamepad is not recognized, even if I press the D-pad later. When I start a game, gamepad won’t work unless I repeat the procedure.

2 - If I launch RetroArch using any other device (keyboard or TV remote), once in the menu, if I press the D-pad in the gamepad, it’s recognized (I get the message “Microntek USB Joystick configured in port #0”) and it works to navigate the menu. If I press any other button, the gamepad is not recognized, even if I press the D-pad later. When I start a game, gamepad won’t work unless I unplug it, plug it back and press the D-pad again.

3 - If I launch RetroArch using any other device (keyboard or TV remote) and do not press any button in the gamepad when in the menu (navigate using the other device), when I start a game, gamepad will be recognized if I press the D-pad. If I press any other button, the gamepad is not recognized, even if I press the D-pad later.

Long story short: looks like RetroArch can’t “find” the controller if it’s used in the OS, and the core can’t find it if it’s used in the menu. Unplugging/plugging back the controller makes it work. I can also avoid using the controller in the OS and in RetroArch menu, so it’s still “available” to the core when emulation starts.

I hope this debugging helps to fix the issue.

Hello, I have exactly the same problem, I'm scouring the internet for definitive answers to recognize as a xinput, being our control a directinput happens this. Has anyone figured out how to solve it?

djhyperdrum avatar Feb 03 '21 19:02 djhyperdrum

@djhyperdrum please stop quoting entire posts and repeating the same sentence over and over, it clutters the conversation.

No problems Brown, i about the question?

djhyperdrum avatar Feb 03 '21 21:02 djhyperdrum

Hi Ner00 from Brazil! I have followed yours posts from libretro forums and I have the EXACTLY SAME PROBLEM...your workaround fix some problem to me....wait the definitive solution from developers!

remosilva avatar Feb 07 '21 21:02 remosilva

https://github.com/libretro/RetroArch/issues/5977

"EDIT: In case someone may have an issue, it may be due to having uhidd enabled (I had it enabled for a different project but overlooked it since I never had the need for it anymore). Disabling that seem to fix the issue which does allow me to disconnect and reconnect the gamepad for any cores."

Some information here...

remosilva avatar Feb 07 '21 21:02 remosilva

@remosilva Does it make a difference though? I can't try this at the moment, but I would think not because of the initial statement:

Not even unplugging and plugging the usb controller would allow it to be detected and I would have to exit the application and relaunch it for it to see the controller again.

ner00 avatar Feb 07 '21 21:02 ner00

@remosilva Does it make a difference though? I can't try this at the moment, but I would think not because of the initial statement:

Not even unplugging and plugging the usb controller would allow it to be detected and I would have to exit the application and relaunch it for it to see the controller again.

NO!! Doenst make a difference...only more information as I said...

remosilva avatar Feb 07 '21 21:02 remosilva

NO!! Doenst make a difference...only more information as I said...

So what's the point of mentioning something unrelated? Also, why the all caps?

ner00 avatar Feb 07 '21 21:02 ner00

NO!! Doenst make a difference...only more information as I said...

So what's the point of mentioning something unrelated? Also, why the all caps?

I have quoted this:

"In case someone may have an issue, it may be due to having uhidd enabled (I had it enabled for a different project but overlooked it since I never had the need for it anymore). Disabling that seem to fix the issue which does allow me to disconnect and reconnect the gamepad for any cores."

But you dont payed atention...and keep calm...I'ḿ your friend here....

remosilva avatar Feb 07 '21 21:02 remosilva

I said I couldn't test this myself, and I asked if you had tested this in any way and if it solved the issue, you replied "NO!! Doenst make a difference". Seems to be some communication problem, so I'll ignore the passive-aggressive remarks.

ner00 avatar Feb 07 '21 21:02 ner00

You said:  Does it make a difference though?  I said: NO!! Doenst make a difference...only more information...

You said: So what's the point of mentioning something unrelated? Also, why the all caps? I said: You dont payed atention...and keep calm...I'ḿ your friend here...

So everything is very clear to me. But let's wait for the developers to respond to this problem. Is the best we can do now.

remosilva avatar Feb 07 '21 21:02 remosilva

we're in the same boat, remember?

remosilva avatar Feb 07 '21 22:02 remosilva

#5977

"EDIT: In case someone may have an issue, it may be due to having uhidd enabled (I had it enabled for a different project but overlooked it since I never had the need for it anymore). Disabling that seem to fix the issue which does allow me to disconnect and reconnect the gamepad for any cores."

Some information here...

Could you tell me where to turn this uhidd on or off, whether on Android or Retroarch? where exactly is this function? Because I never called, if it is active it comes like this.

djhyperdrum avatar Feb 07 '21 22:02 djhyperdrum

uuhid, as mentioned in that issue, is FreeBSD-related; it's not applicable to Android nor any of the details of that entire issue for that matter. 5977 also only specifically mentions SDL2 input driver and permanent loss of input, regardless of the input device used, until RetroArch is restarted, which isn't the case in Android.

Disconnecting and reconnecting the device solves the issue without restarting the process, that and using 100% tested/compatible controllers (XB, PS, etc). This issue seems to be a mix between Android variant, controller chip, RetroArch input bug dealing with the former two.

ner00 avatar Feb 07 '21 22:02 ner00

https://github.com/libretro/RetroArch/issues/5977#issuecomment-776149115

soredake avatar Feb 09 '21 18:02 soredake

same here on Android 9, but it happens only with some controllers: https://github.com/MickGyver/DaemonBite-Retro-Controllers-USB

eadmaster avatar Sep 11 '21 11:09 eadmaster

Same problem here using an Arduino controller in Android 9. Unplugging and plugging works, and sometimes the "trick" launching keeping pressed B button and moving D-pad. The device just disappear when launching a core or closing content.

GuerreroNinja avatar Dec 20 '21 14:12 GuerreroNinja

8BitDo 30SN Pro, Bluetooth connection Controller works great on the menu. Stops working after launching the games (tried FBNeo and Mame2003-Plus cores with bunch of games). Turning on and off the controller triggers detection and I see the notification that the controller has been mapped to a port however unlike the OP, it still doesn't work for me after that point. Nothing I've done made my controllers work in-game.

tapir avatar Feb 13 '22 09:02 tapir

This issue is open for too long and I am hoping there is some fix to this.. I am facing the same issue.

SriSivaC avatar Mar 24 '22 15:03 SriSivaC

Hi, if this can help I was facing the same issue with hid-generic controller on Android. Apparently, disabling touch support inside "settings -> user interface" fixed this for me

Edit: Ok, after more tests, just disabling touch support doesn't completely fix this bug. When disabled I doesn't have to unplug / replug device after every load or close content but I still have to do this once when I launch or restart Retroarch with the controller plugged...

lennozgs avatar May 02 '22 10:05 lennozgs

This problems occurs with the 3 button Sega Genesis controller that comes with the U.S. / Canada version of the Sega Genesis MIni. Also with the 8Bitdo M30 2.4g. It has to be something with only certain controllers.

averageloser avatar May 22 '22 23:05 averageloser

Still facing the same problem in RA 1.9.12, Android 9, DaemonBite Arcade Encoder (https://github.com/MickGyver/DaemonBite-Arcade-Encoder) - https://www.daemonbite.com/product/ktrl-arcade-mini/

Any help?

GuerreroNinja avatar Jun 29 '22 21:06 GuerreroNinja

Same thing is happening with me on my Android boxes, smartphones and Google Chromecast with Android tv using 8bitdo Bluetooth controller, Xbox360 or Logitech controllers.

soranblue avatar Sep 04 '22 20:09 soranblue

Running into this same issue with Arcade1Up Simpsons machine that is essentially an ARMv7 Tablet running Android 10. Just sideloaded RetroArch v1.11.0 32-bit for Android and configured 4 generic Joystick/button kits connected to 4 USB encoders (EG Starts) that are auto detected in RetroArch as Dragonrise Port 1, Dragonrise Port 2, Dragonrise Port 3, Dragonrise Port 4.

Confirmed the 4 controllers are all detected when navigating through RetroArch menus, but after loading a game, only 1 controller is detected. When unplugging and re-plugging in the other 3 usb controllers, they are all detected again.

I saw an option in Input Settings called "Android Disconnect Workaround" that I tried enabling, but when enabled, it treats the 4 controllers as 1 input device.

With the surge of people sideloading RetroArch Android on their Arcade1Up Android based machines and installing 3rd party USB joystick/button kits, it would be great to have this finally working after @ner00 reported this issue almost 3 years ago.

See: https://www.youtube.com/watch?v=AvssyROX2V4

mshigekawa avatar Oct 02 '22 23:10 mshigekawa