Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth controller doesn't reconnect after sleep mode #193

Closed
ghost opened this issue Jan 5, 2018 · 12 comments
Closed

Bluetooth controller doesn't reconnect after sleep mode #193

ghost opened this issue Jan 5, 2018 · 12 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jan 5, 2018

As the title says. I think RetroArch and EmulationStation tries a reconnect every few seconds in the background and enables you to awake the controller during a game. Amiberry can't do this.

@HoraceAndTheSpider
Copy link
Contributor

This will b possible with SDL2 but isn’t supported by SDL1.

It’s something i’ll be looking at on the next round of improvements (I.e after the next release)

@Darknior
Copy link

Darknior commented Jan 6, 2018

Thanks, because it is really a big problem when contrôler shut down in game with batterie low :(

@midwan midwan self-assigned this Feb 1, 2018
@midwan
Copy link
Collaborator

midwan commented Feb 1, 2018

The next official release will be the last one that supports SDL1, so we can clean up the code and focus on utilizing SDL2 only.
We can look into this as well at that time (i.e. after the next release, due shortly)

@waal
Copy link

waal commented Oct 17, 2019

Hi,

Sorry if I bump an old topic but is this issue already fixed with the SDL2 build ?

I'm currently waiting to have confirmation that Batocera 5.24 beta on the RPI3 features this version but I'm nearly certain that this is the case.

Once a game is launched, I can't retake control of the emu after my controler, 8bitdo SNES pro or XBOX360, entered sleep mode. I have to kill the emu through SSH or to plug a controler or use a keyboard (which is logical for a computer some would say but well, you know... gamers. :))

Thank you all for your help (and for the great work, anyway).

@Darknior
Copy link

Same for me same controller, if shut down it, and restart, it is lost by Amiberry. I must kill Amiberry in SSH to return to ES :(
I'm on Batocera 5.24 alha.

@midwan
Copy link
Collaborator

midwan commented Oct 17, 2019

@waal
I haven't had a chance to work on this issue yet, and we're currently on code freeze in the dev until the next release. But we'll look into it after that release is out, as part of the next beta.

As this will require some changes in the logic, I wouldn't want to risk introducing new bugs in something that has been tested already. ;)

@mindtripper
Copy link

mindtripper commented May 6, 2020

@midwan
Any news on this?
The issue for me is using the 8bitdo PRO 2 bluetooth controller and watching Amiga demos. Controller shuts down/goes to sleep and I have to restart my Pi to get back in to watch another demo.

I'd be willing to test dev builds if this has been added.

Otherwise Amiberry rocks! Tip of the hat!

Workaround: While waiting for this feature, I have solved it by using jslisten to kill Amiberry process when I press a specific combination of buttons on my 8bitdo PRO 2 controller. As this returns me to EmulationStation. It works even if my controller has been sleeping.

midwan added a commit that referenced this issue May 8, 2020
@midwan
Copy link
Collaborator

midwan commented May 8, 2020

Please try after the latest commit above, and let me know how it works for you?
I've tested it with a couple controllers here:

  • XBox One controller: I could disconnect it, reconnect it and it worked normally
  • PS4 DualShock controller: This controller is a bit of a special case, as it shows up as 2 devices in the system: One is the controller itself, a second one is the Sensors (e.g. gyro). After reconnecting it, it happened to use the sensors as JOY1 instead of the controller device, which of course is not what we want. We'll have to see if there's a better workaround for this one.

My tests were done by having a cable connected to the controller, physically disconnecting it during emulation and re-connecting it, to see how it behaves. It should do the same with Bluetooth connected controllers, but I didn't test that scenario. :)

Additionally, the logfile will now indicate when these events were detected and show a relevant message (if you have the logfile creation enabled, of course).

@mindtripper
Copy link

Followed the instructions on how to compile, but getting errors:

In file included from src/include/sysdeps.h:339,
from src/osdep/amiberry.cpp:21:
src/osdep/target.h:26:39: error: invalid digit "8" in octal constant
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~
src/osdep/target.h:21:21: note: in definition of macro ‘GETBDY’
#define GETBDY(x) ((x) / 1000000 + 2000)
^
src/osdep/target.h:26:22: note: in expansion of macro ‘MAKEBD’
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~~~~~
src/osdep/amiberry.cpp:1152:14: note: in expansion of macro ‘AMIBERRYDATE’
*y = GETBDY(AMIBERRYDATE);
^~~~~~~~~~~~
src/osdep/target.h:26:39: error: invalid digit "8" in octal constant
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~
src/osdep/target.h:22:22: note: in definition of macro ‘GETBDM’
#define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100)
^
src/osdep/target.h:26:22: note: in expansion of macro ‘MAKEBD’
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~~~~~
src/osdep/amiberry.cpp:1153:14: note: in expansion of macro ‘AMIBERRYDATE’
*m = GETBDM(AMIBERRYDATE);
^~~~~~~~~~~~
src/osdep/target.h:26:39: error: invalid digit "8" in octal constant
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~
src/osdep/target.h:22:30: note: in definition of macro ‘GETBDM’
#define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100)
^
src/osdep/target.h:26:22: note: in expansion of macro ‘MAKEBD’
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~~~~~
src/osdep/amiberry.cpp:1153:14: note: in expansion of macro ‘AMIBERRYDATE’
*m = GETBDM(AMIBERRYDATE);
^~~~~~~~~~~~
src/osdep/target.h:26:39: error: invalid digit "8" in octal constant
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~
src/osdep/target.h:23:21: note: in definition of macro ‘GETBDD’
#define GETBDD(x) ((x) % 100)
^
src/osdep/target.h:26:22: note: in expansion of macro ‘MAKEBD’
#define AMIBERRYDATE MAKEBD(2020, 05, 08)
^~~~~~
src/osdep/amiberry.cpp:1154:14: note: in expansion of macro ‘AMIBERRYDATE’
*d = GETBDD(AMIBERRYDATE);
^~~~~~~~~~~~
make: *** [: src/osdep/amiberry.o] Error 1
make: *** Waiting for unfinished jobs....

Compilation was execute on a recently updated RPi4 with Buster executing make -j2 PLATFORM=rpi4

@mindtripper
Copy link

I changed the #define AMIBERRYDATE MAKEBD(2020, 05, 08) to #define AMIBERRYDATE MAKEBD(2020, 05, 07) in src/osdep/target.h and that solved the issue.
08 is not an octal number :)

Probably an easy fix.

Meanwhile I will test with my "custom" build.

@mindtripper
Copy link

Confirmed working with my 8bitdo Pro2 Bluetooth Controller.

Awesome. Thank you and a very happy Friday!

@midwan
Copy link
Collaborator

midwan commented May 8, 2020 via email

@midwan midwan closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants