-
Notifications
You must be signed in to change notification settings - Fork 2k
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
duplicate entries for 8bitdo ultimate bluetooth controller on windows #11849
Comments
Are you able to reproduce this with testcontroller using the latest code in main? |
here's the output i get from following the same repro steps in
|
So I got this controller and I'm not seeing the same results. I added a log message when the controller is connected and disconnected: diff --git a/test/testcontroller.c b/test/testcontroller.c
index d7fb62c3d..bc228166c 100644
--- a/test/testcontroller.c
+++ b/test/testcontroller.c
@@ -1019,6 +1019,7 @@ static void HandleGamepadAdded(SDL_JoystickID id, bool verbose)
if (i < 0) {
return;
}
+ SDL_Log("Gamepad %u added\n", id);
SDL_assert(!controllers[i].gamepad);
controllers[i].gamepad = SDL_OpenGamepad(id);
@@ -1090,6 +1091,7 @@ static void HandleGamepadRemoved(SDL_JoystickID id)
if (i < 0) {
return;
}
+ SDL_Log("Gamepad %u removed\n", id);
if (controllers[i].mapping) {
SDL_free(controllers[i].mapping);
I start with the controller unplugged and the dongle unplugged. Then I connect via Bluetooth:
Then I plug in via USB cable:
Then I plug in the dongle and flip the switch to 2.4, while still plugged in via USB:
Note that two raw input devices were added here, but then one is removed. My theory is that the controller resets and has a temporary connection via both USB and 2.4 GHz dongle until it settles on one interface. The final result is as expected though. Interestingly, gamepad 4 was never removed. Now flipping the switch back to Bluetooth while still connected via USB cable:
In this case the Bluetooth controller showed up briefly and then was removed in favor of the USB connection. In my case SDL was able to open the controller and get device settings before it went away, but I could see the timing working out in your case so that it fails the read. So it looks like the only unexpected behavior here is gamepad 4 not going away. I'll investigate that. |
I turned on DEBUG_RAWINPUT and wasn't able to reproduce it. Maybe I just missed the log message in my output above? Here's the raw input debug patch: diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index 5ef4a3021..96921aff2 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/src/joystick/windows/SDL_rawinputjoystick.c
@@ -74,7 +74,7 @@ typedef struct WindowsGamingInputGamepadState WindowsGamingInputGamepadState;
#endif
#endif
-#if 0
+#if 1
#define DEBUG_RAWINPUT
#endif
Here's the relevant logging for that sequence:
|
This is all with the shipping firmware v1.09. If I update to v1.10, I get the following sequence: I start with the controller unplugged and the dongle unplugged. Then I connect via Bluetooth:
Then I plug in via USB cable:
Then I plug in the dongle and flip the switch to 2.4, while still plugged in via USB:
Now flipping the switch back to Bluetooth while still connected via USB cable:
I see the same result as the older firmware, so I'm not seeing the same issue you are. |
Can you apply the patches above and share the testcontroller results you're seeing with the latest SDL main code? I'm going to bump this out of the shipping milestone as it seems to be specific to one controller with an unusual set of repro steps. |
Thank you so much for looking into this!
I won't have access to the windows machine and controller this week. Once I do I'll apply the patch and report back as soon as possible!
That makes perfect sense. I just figured even with the strange repro steps it was worth reporting in case they were exposing a symptom of a deeper issue. |
Yep, definitely. :) |
Finally got back to my windows machine to test this again. Congrats on the SDL3 release! With
But even when the first message is
I'm sometimes able to get into the infinite
logs example output
|
controller in question: https://www.8bitdo.com/ultimate-bluetooth-controller/ using firmware
8BitDo Ultimate BT V1.10
to consistently reproduce this issue i have
an example of how this appears in an application:
following these exact repro steps i have not been able to reproduce the issue on linux, so i searched for windows duplicate controller issues and found #7948
i tried setting
SDL_SetHintWithPriority(SDL_HINT_JOYSTICK_WGI, "0", SDL_HINT_DEFAULT)
(andSDL_SetHint(SDL_HINT_JOYSTICK_WGI, "0"
) but that did not resolve the issue. i then built the test program from #7948 (comment) against https://github.com/libsdl-org/SDL/releases/download/release-2.30.11/SDL2-devel-2.30.11-VC.zip and followed the listed repro steps and got the following output:attempt 1 (no hints)
attempt 2 (no hints)
attempt 3 (
SDL_SetHint(SDL_HINT_JOYSTICK_WGI, "0"
)attempt 4 (hints turning off everything except rawinput) - first joy add happened with USB despite bluetooth connection
The text was updated successfully, but these errors were encountered: