ndeadly / MissionControl

Use controllers from other consoles natively on your Nintendo Switch via Bluetooth. No dongles or other external hardware neccessary.
GNU General Public License v2.0
2.54k stars 139 forks source link

Xbox elite 2 #343

Open StepanChewbacca opened 3 years ago

StepanChewbacca commented 3 years ago

Switch Firmware Version

12.1.0 (Latest)

Atmosphère Version

0.20.1 (Latest)

Mission Control Version

0.5.1 (Latest)

Issue Description

Hi. I have problems with mission control and xbox fucking elite 2 controller. With the latest update, it now connects, but the input delays are 5-10 seconds. atmosphere of the latest version, firmware too. can you tell me what to do? if anything, I will try to help as much as I can.

Error Report

No response

ndeadly commented 3 years ago

5-10 second input delays are crazy and definitely not normal. I'm not even sure how inputs can be delayed for that long without being dropped from the input buffer. I'm assuming the controller works normally on PC or similar?

Can you run this special debug build with the controller connected and post the log it creates here? The log will be found in sdmc:/bluetooth-mitm.log. You may find you have to copy the log off when the console isn't running, ie through hekate UMS or reading directly from your SD card

MissionControl-0.5.1-dbg-d20c74c.zip

StepanChewbacca commented 3 years ago

bluetooth-mitm.log Problems are only with nintendo switch

kakra commented 3 years ago

This controller model has similar problems on PC (Linux at least). It needs a working ERTM implementation, it doesn't like radio neighbors scanning in discovery mode, and the pairing phase may have gone wrong (probably L2CAP-related). I'm seeing similar issues every now and then with my model and xpadneo.

To me it looks like the controller cannot properly flush its buffers.

ndeadly commented 3 years ago

@kakra have you found any solution or workaround to the problem? This user was speaking with me on reddit prior to opening this issue and seemed to indicate that this issue was persistent with their controller after rebooting, reconnecting etc. Several others have tested the controller on their consoles and confirmed it working flawlessly, so I really don't know what's up in this case.

@StepanChewbacca thanks for the log. Unfortunately nothing really looks out of the ordinary. There are no unhandled commands being spammed or anything :/ Maybe you could try clearing your consoles pairing database (System Settings->Controllers and Sensors->Disconnect Controllers) and re-pairing with the console and see if it makes any difference.

StepanChewbacca commented 3 years ago

@ndeadly nothing has changed

ndeadly commented 3 years ago

Did you end up reinstalling Mission Control from my github releases? I can't guarantee the integrity of the files distributed by any third party sources. I would also try downgrading Atmosphere to 0.19.5 and see if you notice any difference.

StepanChewbacca commented 3 years ago

I put the mission control that you threw at me. The problem remains. I'll try to reinstall the atmosphere now.

StepanChewbacca commented 3 years ago

with atmo 0.19.5 same problem

ndeadly commented 3 years ago

I'm really running out of ideas here. Is there a way to hard reset the controller? Can the battery be removed?

Is it possible to make a video of the issue to get a better idea of the extent of the problem?

kakra commented 3 years ago

have you found any solution or workaround to the problem? This user was speaking with me on reddit prior to opening this issue and seemed to indicate that this issue was persistent with their controller after rebooting, reconnecting etc. Several others have tested the controller on their consoles and confirmed it working flawlessly, so I really don't know what's up in this case.

If the firmware version is identical to others on the controller, or updated fwiw, my best guess is that this indicates issues in the RF environment. Does your log also detect nearby discovery scans? If yes, those may interfere a lot.

Some sort of hard-reset can be "emulated" by connecting the controller using an Xbox dongle to a different machine (or a real Xbox which is also a dongle-connect), then BT-pair to a different machine, then BT-pair back on the Switch - this should've reset its internal state far enough to behave like a first-time pair.

I haven't used my XBE2 controller in a while but I think I remember that mine currently shows the same behavior on Linux BT.

Can the battery be removed?

No (except maybe by opening the case which I'd rather not do).

ndeadly commented 3 years ago

Does your log also detect nearby discovery scans? If yes, those may interfere a lot

@kakra no, unfortunately logging is constrained to the high level functions I can access via mitm. All the interesting internals of the bluetooth stack/driver are inaccesible for logging.

Some sort of hard-reset can be "emulated" by connecting the controller using an Xbox dongle to a different machine (or a real Xbox which is also a dongle-connect), then BT-pair to a different machine, then BT-pair back on the Switch - this should've reset its internal state far enough to behave like a first-time pair.

@StepanChewbacca is the above something you are able to try? Might be completely unrelated, but I know connecting xbox controllers to a PC via USB can also reset some aspect of the internal controller state if controllers are refusing to pair to the Switch. Could also be worth trying.

As kakra mentioned above, it could also be related to RF interference. Maybe you could try moving to another room away from electronic devices etc. Do you have Wifi on the switch enabled? You could also try switching that off if so.

StepanChewbacca commented 3 years ago

https://ru.files.fm/u/uc3kw9cc2 video

StepanChewbacca commented 3 years ago

shutdown wifi does not help. in other rooms the situation is similar. I haven't xbox dongle.

StepanChewbacca commented 3 years ago

I connected to the PC when I checked the version of the gamepad. so that doesn't help either

kakra commented 3 years ago

This has some information and linked bug reports that may be related to it: https://github.com/bluez/bluez/issues/123

@ndeadly Maybe you can read something useful or interesting from it which leads to some new ideas. That report is mostly about the inquiry thing but it also has some info about several seconds of input event lag - and that was most likely not related to inquiries.

kakra commented 3 years ago

With Linux, the situation is currently as follows: Turning on the gamepad instantly connects via Bluetooth - there's no long delay as seen in the video by @StepanChewbacca and there shouldn't be. If it is, that's most probably related to ERTM and L2CAP issues where the gamepad takes a long time negotiating proper options and may even fail sometimes.

Also, currently, in Linux I do not see the 10s lag which I've been able to reproduce earlier. This may be related to bluez updates and kernel updates. All issues could still be observed in the early kernel 5.10 versions and bluez 5.5x versions. So it might be worth looking at what they changed.

But it still has a very bad input lag in the form of very low temporal resolution: Looking at evtest I can see the device generating input events when I continuously circle the joysticks - and I should get results with at least 50 Hz but as you can see, the temporal resolution is more like 5 to 20 Hz:

Event: time 1630690792.730682, -------------- SYN_REPORT ------------
Event: time 1630690792.739562, type 3 (EV_ABS), code 3 (ABS_RX), value -6009
Event: time 1630690792.739562, type 3 (EV_ABS), code 4 (ABS_RY), value 1517
Event: time 1630690792.739562, -------------- SYN_REPORT ------------
Event: time 1630690792.749560, type 3 (EV_ABS), code 3 (ABS_RX), value 2028
Event: time 1630690792.749560, type 3 (EV_ABS), code 4 (ABS_RY), value 1358
Event: time 1630690792.749560, -------------- SYN_REPORT ------------
Event: time 1630690792.780702, type 3 (EV_ABS), code 3 (ABS_RX), value 956
Event: time 1630690792.780702, type 3 (EV_ABS), code 4 (ABS_RY), value 1112
Event: time 1630690792.780702, -------------- SYN_REPORT ------------
Event: time 1630690792.789565, type 3 (EV_ABS), code 3 (ABS_RX), value 584
Event: time 1630690792.789565, type 3 (EV_ABS), code 4 (ABS_RY), value 1089
Event: time 1630690792.789565, -------------- SYN_REPORT ------------
Event: time 1630690792.799512, type 3 (EV_ABS), code 3 (ABS_RX), value 287
Event: time 1630690792.799512, type 3 (EV_ABS), code 4 (ABS_RY), value 1083
Event: time 1630690792.799512, -------------- SYN_REPORT ------------
Event: time 1630690792.809527, type 3 (EV_ABS), code 3 (ABS_RX), value 49
Event: time 1630690792.809527, type 3 (EV_ABS), code 4 (ABS_RY), value 1002
Event: time 1630690792.809527, -------------- SYN_REPORT ------------
Event: time 1630690792.900690, type 3 (EV_ABS), code 3 (ABS_RX), value -770
Event: time 1630690792.900690, type 3 (EV_ABS), code 4 (ABS_RY), value 904
Event: time 1630690792.900690, -------------- SYN_REPORT ------------
Event: time 1630690792.909516, type 3 (EV_ABS), code 3 (ABS_RX), value -776
Event: time 1630690792.909516, -------------- SYN_REPORT ------------
Event: time 1630690792.989576, type 3 (EV_ABS), code 3 (ABS_RX), value -781
Event: time 1630690792.989576, type 3 (EV_ABS), code 4 (ABS_RY), value 884
Event: time 1630690792.989576, -------------- SYN_REPORT ------------
Event: time 1630690797.359635, type 3 (EV_ABS), code 4 (ABS_RY), value 767
Event: time 1630690797.359635, -------------- SYN_REPORT ------------

This resolution is way too low because it means an input lag of 100ms - and that feels like playing drunk.

There's something funky going on with the gamepad.

I'm also attaching two btsnoops, captured in Linux (I don't own a Switch): One is from the connection phase (device already paired), the other is from circling both sticks for a few seconds, then the left, then the right. Maybe you can use that to match it up with the log you received from @StepanChewbacca to infer what might happen: xbe2-btsnoops.zip

In the snoops, you can see that some devices are continuously sending some LE advertising reports:

> HCI Event: LE Meta Event (0x3e) plen 40 #680 [hci0] 13.302475
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scannable undirected - ADV_SCAN_IND (0x02)
        Address type: Random (0x01)
        Address: 62:85:B6:AC:89:0E (Resolvable)
        Data length: 28
        16-bit Service UUIDs (complete): 1 entry
          Google (0xfe9f)
        Service Data (UUID 0xfe9f): 0000000000000000000000000000000000000000
        RSSI: -71 dBm (0xb9)

and that is most likely the problem here. If non-LE advertising or inquiry is done, the lag will go up to 10s and beyond.

ndeadly commented 3 years ago

@kakra thanks for all the info. Sounds like I've got a bit of reading ahead of me.

@StepanChewbacca try this build out and see if anything changes in the controller performance. It will likely cause you some issues with disconnecting/reconnecting at first, but I had confirmation from the guy that helped me get elite controller support running that eventually it stabilises and he was able to use his controller as usual. I will look into this tweak further if you have any success with the lag.

MissionControl-0.5.1-xbox-elite-tsi-ca25362.zip

StepanChewbacca commented 3 years ago

with this build i cant connect to switch I was able to connect for a second. I'll try again.

StepanChewbacca commented 3 years ago

I see the inscription is synchronized. But then after a second the connection stops. Within 10 minutes, I still could not connect.

ndeadly commented 3 years ago

Damn. Yeah, this is the same behaviour I see with my Xbox One controller with this change. I don't know why it works for @DatenThielt

Do you have a spare SD card that you could set up a minimal environment with? It would be interesting to see a clean setup with nothing but atmosphere and mission control would make any difference. I'm not counting on it but I don't have a lot of ideas left.

DatenThielt commented 3 years ago

Yea this is very odd, during my testing it failed to pair fully 3 times but then paired, if I go I to the controller screen it starts to re-pair again but as long as I stay away from that screen it works well here. Using a separate card with a fresh install ofc so would be interesting if you can do that too.

StepanChewbacca commented 3 years ago

I tried to delete everything except the Nintendo folder and reinstall everything. now, unfortunately, I do not have a spare SD card. if I find it somewhere, then I'll try.