Fix extension handshake for third party Wii Remotes - #1348
Open
kglazier wants to merge 1 commit into
Open
Conversation
Third party Wii Remotes would connect but never get their extension identified, so the controller stayed unusable and the link eventually died with an HCI supervision timeout (reason 0x08). Two behaviours differ from genuine remotes: 1. In the 0x22 acknowledge handler, buffer[3] holds the report id being acknowledged. Third party remotes also ack the 0x11 player LED/rumble report. 0x11 has no 0x02 bit, so that ack fell through to the branch that treats it as an extension change and reset transferstate back to TRANSFER_EXT1, permanently. Never reset on an LED ack. 2. They send their 0x20 status report on their own while still in TRANSFER_CONNECT, and never send another one in reply to the 0x15 request, so TRANSFER_EXT1 waited forever. Accept the status report in either state, and re-request status if an ack shows up while still waiting in EXT1. Tested on a Wii with two different third party remotes plus an official Classic Controller, on Mario Kart Double Dash and Mario Party. Official remotes are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
I learned how to build Nintendont just to test this new fix, and it worked perfectly with my third-party 2-in-1 Wii Remote! Thank you so much for fixing this! 😁🥳🥳🥳 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third party Wii Remotes connect to the kernel's Bluetooth stack fine, but their extension is never identified, so the controller stays unusable in game and the link eventually dies with an HCI supervision timeout (reason
0x08), reconnects, and repeats. Official remotes are unaffected.I traced this by adding temporary
dbgprintflogging toBT.candlwbt/hci.cand reading/ndebug.logoff the SD card. The handshake stalls inTRANSFER_EXT1and never reachesTRANSFER_GET_IDENT.There are two separate causes.
1. The 0x11 LED ack is misread as an extension change
In the
0x22acknowledge branch,buffer[3]is the report id being acknowledged, and the code tests it with& 0x02. That works for0x12/0x16/0x17, which is what the existing//??message being acknowledged todo lucky all needed messages had 2 bit setcomment is getting at.Third party remotes also acknowledge the
0x11player LED/rumble report thatBTSetControllerState()sends.0x11 & 0x02 == 0, so that ack fell through to theelsebranch, which treats it as the extension being unplugged and resetstransferstateback toTRANSFER_EXT1. From a log:Fix: never take the reset path when the acknowledged report id is
0x11.2. The status report arrives before it is requested
These remotes send their
0x20status report on their own while still inTRANSFER_CONNECT, and do not send another one in response to the0x15request, soTRANSFER_EXT1waits forever. Fix: accept the status report inTRANSFER_CONNECTas well, and if an acknowledgement turns up while still sitting inTRANSFER_EXT1, re-send the0x15request rather than waiting indefinitely.Testing
Built with the toolchain versions in the readme (devkitARM r53, devkitPPC r35, libogc 1.8.23). Tested on a Wii (System Menu 4.3U) with two different third party remotes plus an official Classic Controller, on Mario Kart: Double Dash and Mario Party. Both remotes go from unusable to fully working. An official remote with the same Classic Controller behaves the same before and after, and the changes only add conditions to paths that third party remotes were already falling into.
I do not have a MotionPlus or a Wii U Pro Controller to hand, so those paths are untested beyond the fact that they are not touched.