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

Can't connect to Wii U (with or without Wii mode) #11

Open
ThatsJustCheesy opened this issue Jan 29, 2021 · 15 comments
Open

Can't connect to Wii U (with or without Wii mode) #11

ThatsJustCheesy opened this issue Jan 29, 2021 · 15 comments

Comments

@ThatsJustCheesy
Copy link
Contributor

ThatsJustCheesy commented Jan 29, 2021

Hi, I love that you've updated this! Unfortunately, I'm still having trouble connecting to my Wii U.

I've tried the console in both normal mode and Wii mode, and in both cases wmemulator gets stuck on

listening for connections... (press wii's sync button)

By "stuck," I mean normal mode's sync screen doesn't show anything, and pressing the sync button while in Wii mode doesn't cause a connection to occur.

The emulator machine is a Raspberry Pi Zero W. Here is the bluetoothd log if that helps: bluetoothd_log.txt

Any advice?

@rnconrad
Copy link
Owner

rnconrad commented Jan 30, 2021

I don't have a Wii U to test right now and I'm not aware of the differences (if any) in how it handles connecting. Not sure if this is the issue but just wanted to mention that.

It's not totally clear from the log what is happening. There could be issues setting the Bluetooth device settings. If you could provide hcidump output during emulator startup that might help indicate if that is the case.

Similarly, you can check whether the device settings are properly set up (while the emulator is running) with:

> hciconfig hci0
# first 3 bytes of BD Address should be 00 09 BF
# should also show PSCAN and ISCAN

> hciconfig hci0 name
# should be Nintendo RVL-CNT-01

> hcitool cmd 0x3 0x0039
# last 3 bytes of the output should be 00 8B 9E

> sdptool get 0x10000
# should look like a Wiimote record

I've noticed that sometimes restarting the emulator and syncing again (or restarting the Wii) can help when things get stuck for some reason. Still not sure why this happens, though for me it is pretty rare.

Also, the Wii doesn't check the device class when inquiring for Wiimotes, but it might be possible that the Wii U does. I will push an updated build that sets it in case this is the issue.

@ThatsJustCheesy
Copy link
Contributor Author

ThatsJustCheesy commented Jan 30, 2021

Thank you for your help.

Here is the output of hcidump (I stopped it before terminating the emulator): hcidump_log.txt

The other output looks good to me:

pi@raspberrycake:~/WiimoteEmulator $ hciconfig hci0
hci0:	Type: BR/EDR  Bus: UART
	BD Address: 00:09:BF:BE:79:C2  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING PSCAN ISCAN 
	RX bytes:7113 acl:0 sco:0 events:379 errors:0
	TX bytes:9141 acl:0 sco:0 commands:379 errors:0

pi@raspberrycake:~/WiimoteEmulator $ hciconfig hci0 name
hci0:	Type: BR/EDR  Bus: UART
	BD Address: 00:09:BF:BE:79:C2  ACL MTU: 1021:8  SCO MTU: 64:1
	Name: 'Nintendo RVL-CNT-01'
pi@raspberrycake:~/WiimoteEmulator $ hcitool cmd 0x3 0x0039
< HCI Command: ogf 0x03, ocf 0x0039, plen 0
> HCI Event: 0x0e plen 8
  01 39 0C 00 01 00 8B 9E 
pi@raspberrycake:~/WiimoteEmulator $ sdptool get 0x10000
Service Name: Nintendo RVL-CNT-01
Service Description: Nintendo RVL-CNT-01
Service Provider: Nintendo
Service RecHandle: 0x10000
Service Class ID List:
  "Human Interface Device" (0x1124)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 17
  "HIDP" (0x0011)
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Human Interface Device" (0x1124)
    Version: 0x0100

This was in Wii U mode. I also ran hcidump in Wii mode but the logs were diff-identical.

Both the console and Pi have been power cycled since the last attempt.

@rnconrad
Copy link
Owner

All the output there looks good.

I recently pushed a change which also writes the BT device class to match a Wiimote. This was unimportant when connecting to a Wii but perhaps the Wii U is checking it.

Also, it seems that consistently on first run of the emulator (from device boot) syncing does not work. Stopping and restarting just the emulator after running it once allows a Wii to connect successfully for me. I'm looking into why this is.

@rnconrad
Copy link
Owner

So the previously mentioned issue (emulator not working on first run) is related to the bluez SDP record/server. I will push a fix for this.

One way to rule out whether the Wii U connection issue is SDP related is to see if there is any indication in hcidump that the console is connecting at all. If it is, there will be output like this:

HCI Event: Connect Request (0x04) plen 10
...
HCI Event: Disconn Complete (0x05) plen 4

I'm not sure if your previous hcidump includes trying to sync with the console or not. If there is no connection request after trying to sync, then the Wii U is not trying to connect to the emulator at all and the problem must be something else.

@ThatsJustCheesy
Copy link
Contributor Author

ThatsJustCheesy commented Jan 30, 2021

I did indeed initiate a sync on the console while hcidump and the emulator were running. I've double-checked the Pi's Bluetooth software works at all, and it does, at least for OBEX.

I technically have an old Wii that I could try this with (just a few years of dust buildup, what could go wrong?!), so if we run up against a wall then I'll explore that some more.

EDIT: By the way, on what hardware and distro are you running the emulator?

@rnconrad
Copy link
Owner

Interesting. So it could either be that the device class is important on Wii U (if you haven't tried the latest emulator yet?) or something else. I will look into this. If you are able to verify that your setup works with a Wii instead that could help determine that it is a Wii U specific issue.

I have tested on Raspberry Pi 2/3 with Raspberry PI OS Lite. Also, I have built against bluez 4.101 and 5.50 (iirc, whichever Bluetooth package is provided by the distro).

@ThatsJustCheesy
Copy link
Contributor Author

I've just tried on Wii U with the device class patches, no luck. I'll dig up the Wii and give that a shot.

@ThatsJustCheesy
Copy link
Contributor Author

Well, it works with the normal Wii!! So there must be something different about the Wii U's pairing process…

@rnconrad
Copy link
Owner

rnconrad commented Feb 6, 2021

Thanks for confirming. I will see if I can figure out what is preventing the Wii U from pairing.

@GaryOderNichts
Copy link

The Wii U won't pair to a Wii Remote if it has Secure Simple Pairing enabled.
See https://github.com/GaryOderNichts/bluubomb/blob/master/adapter.c#L363 for a possible fix.
This at least makes wmmitm work.

@ThatsJustCheesy
Copy link
Contributor Author

ThatsJustCheesy commented May 16, 2021

@GaryOderNichts Thanks you so much for the tip! This is as far as I've got with your adapter.c:

Screen Shot 2021-05-16 at 2 45 22 PM

When this happens, the Wii U console also freezes, requiring a hard power cycle. Do you have any ideas as to why?

Edit: And maybe I'm just not understanding how wmmitm is used, but I could never get anything past "connecting to host… can't connect: Connection refused"

@GaryOderNichts
Copy link

That's as far as I've got into using the emulator as well. I guess there are some further adjustments needed.

The adapter.c is from an exploit I've been working where this was all I needed.

@rnconrad
Copy link
Owner

Thanks @GaryOderNichts for figuring out the Wii U connection issue! I will merge a PR for that if anyone is willing or else I can update it the next time I get a chance.

To make wmmitm work, you may need to connect with the normal wmemulator first to gain the console's trust, then connect directly using the Wiimote's address as the first argument and the console's as the second.

I just noticed from your screenshot that the emulator's memory error response is wrong so I pushed a quick fix for that. Not sure if that's what the problem is as I still don't have a Wii U to test on yet.

rnconrad added a commit that referenced this issue Jun 6, 2021
@rnconrad
Copy link
Owner

rnconrad commented Jun 6, 2021

I finally was able to test on a Wii U. It seems that the emulator was incorrectly sending empty reports when there was nothing to send. The Wii tolerated this it seems but the Wii U crashes when it receives an empty report. Now that this is fixed it seems like connecting to Wii U mostly works.

@Invictaz
Copy link

Fantastic news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants