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

Switch FW 15.0.1 breaks compatibility #108

Open
Anercomp opened this issue Jan 26, 2023 · 18 comments
Open

Switch FW 15.0.1 breaks compatibility #108

Anercomp opened this issue Jan 26, 2023 · 18 comments

Comments

@Anercomp
Copy link

Stuck at connecting to the Switch again.

@blueapple128
Copy link

Cannot reproduce; I'm on Switch FW 15.0.1 (on a completely vanilla Switch) and NXBT works fine.

@TeoMM
Copy link

TeoMM commented Feb 17, 2023

@Brikwerk would you mind confirming this works on 15.0.1? Tested it now for the first time and it doesnt show up in the switch controller menu., yet the bluetooth manager says every other second that it connected and disconnected right after.

Also, are you aware if it works on VMWare?

@blueapple128
Copy link

I have seen the "repeatedly connected and disconnected a second later" behavior frequently, but only when making hack changes on my end such as trying to get it to work on a non-headless VM, or trying to manually change the VM's USB filters, etc. I don't think I've seen it when following the original instructions. I've done some vague, incomplete troubleshooting and I think the reason has something to do with bad drivers or some incompatible(??) apt install at some point in the past.

If you're on a non-Linux machine, try destroying the whole VM and recreating it; does that do anything? If you're on a Linux machine, does it still happen if you try booting off of a live USB?

@TeoMM
Copy link

TeoMM commented Feb 17, 2023

@blueapple128 should i rather install linux on a laptop and try it that way? i've reinstalled ubuntu in VMWare multiple times.
The apt install is also quite vague as i had to install multiple old(er) packages mentioned across this thread for this to work which were not mentioned in the original documentation.
Would you mind taking things on discord chat if it gets rougher?

@blueapple128
Copy link

I have never tried using NXBT with VMware. If you have a spare laptop to install Linux on, then sure, go ahead.

@TeoMM
Copy link

TeoMM commented Feb 17, 2023

managed to get it working on an actual ubuntu install, BUT
same exact problem as #39 #94
@way-huang @WilsontheWolf @blueapple128 @AsinineLucky
Did you manage to get it working?

@blueapple128
Copy link

After pairing once, does reconnect work from the home screen?

@TeoMM
Copy link

TeoMM commented Feb 17, 2023

@blueapple128 nope, doesnt work. I've tried doing that, disconnecting the controller first from the pair menu and then trying to connect from the home menu, restarting the console mid- connection and hoping it'd reconnect. nothing seems to work.

@blueapple128
Copy link

Some questions to clarify what's going on:

  • After connecting for the first time (seeing the new controller show up on the pair menu), can you make inputs before exiting the menu? (And then the controller immediately disconnects after exiting the menu?)
  • From the home menu, what command are you running to reconnect?

@TeoMM
Copy link

TeoMM commented Feb 18, 2023

@blueapple128

  1. Yes, i am able to make inputs, the Switch is making the corresponding sounds when pressing the keys in the webapp.
  2. I lately pressed 'shutdown controller' before leaving the menu so as not to disconnect by itself when leaving the pair menu, and then starting up the app again to pair it AND tried to 'restart controller' (3rd button on webapp) but it won't pair again with the switch from the home menu.

@TeoMM
Copy link

TeoMM commented Feb 25, 2023

@blueapple128 can you confirm Python version? I am using 3.10

@blueapple128
Copy link

1a. Not sure what you mean by "corresponding sounds". Pressing stuff like X/Y/L/R after pairing should all make the same sound and the controller icon should pulse once. Pressing +/- should bring up a help screen (and pressing A/B should exit the pair menu). Does this match what you're seeing?
1b. I am using sudo nxbt test to pair for the first time, not the webapp. Does this work for you? If not, does it output anything interesting?
2a. I have never tried shutting down or restarting the controller from the webapp. Can you go to Settings -> Controllers and Sensors -> Disconnect Controllers (to see how many controllers the Switch thinks are paired to it)? Does this number increase by 1 after pairing?
2b. Can you try reconnecting from the Python API instead of the webapp? Try this:

import nxbt
nx = nxbt.Nxbt()
controller_idx = nx.create_controller(nxbt.PRO_CONTROLLER, reconnect_address=nx.get_switch_addresses())

Does this output anything interesting?
3. I am using Python 3.8.10.

@TeoMM
Copy link

TeoMM commented Feb 25, 2023

@blueapple128
RE:
1a. That's exactly what i'm seing. Any other key(Besides A,B, + and -) make the same clicking sound once when pressed. + and - bring out the help screen, A and B get me out of the pairing screen and result in controller disconnect.
1b. i did the same
2a. it was 2 joycons that i already had connected as my personal ones, and whenever i connect the emulated one it's coming up as the same one, only sometimes a different color.
2b. will do now
3. i switched to this version now to make sure the problem isn't coming from python 3.10

@TeoMM
Copy link

TeoMM commented Feb 25, 2023

[4] Waiting for controller to connect with the Switch...
Connection timeout is 120 seconds for this test script.
Successfully connected.

[5] Attempting to exit the 'Change Grip/Order Menu'...
Controller disconnected after leaving the menu.
Exiting...
Process Process-2:2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 171, in mainloop
    itr.sendall(msg)
OSError: [Errno 107] Transport endpoint is not connected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 106, in run
    self.mainloop(itr, ctrl)
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 177, in mainloop
    itr, ctrl = self.save_connection(e)
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 292, in save_connection
    itr, ctrl = self.connect()
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 383, in connect
    itr, itr_address = s_itr.accept()
  File "/usr/lib/python3.8/socket.py", line 292, in accept
    fd, addr = self._accept()
TypeError: <lambda>() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 113, in run
    self.state["errors"] = traceback.format_exc()
  File "<string>", line 2, in __setitem__
  File "/usr/lib/python3.8/multiprocessing/managers.py", line 835, in _callmethod
    kind, result = conn.recv()
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
    buf = self._recv(4)
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 379, in _recv
    chunk = read(handle, remaining)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/dist-packages/nxbt/controller/server.py", line 117, in run
    self.logger.debug(traceback.format_exc())
  File "/usr/lib/python3.8/traceback.py", line 167, in format_exc
    return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
  File "/usr/lib/python3.8/traceback.py", line 120, in format_exception
    return list(TracebackException(
  File "/usr/lib/python3.8/traceback.py", line 508, in __init__
    self.stack = StackSummary.extract(
  File "/usr/lib/python3.8/traceback.py", line 366, in extract
    f.line
  File "/usr/lib/python3.8/traceback.py", line 288, in line
    self._line = linecache.getline(self.filename, self.lineno).strip()
  File "/usr/lib/python3.8/linecache.py", line 16, in getline
    lines = getlines(filename, module_globals)
  File "/usr/lib/python3.8/linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "/usr/lib/python3.8/linecache.py", line 137, in updatecache
    lines = fp.readlines()
  File "/usr/lib/python3.8/codecs.py", line 319, in decode
    def decode(self, input, final=False):
TypeError: <lambda>() takes 1 positional argument but 2 were given
^CProcess Process-2:
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 27, in poll
    pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/nxbt/nxbt.py", line 235, in _command_manager
    msg = task_queue.get(timeout=5)
  File "/usr/lib/python3.8/multiprocessing/queues.py", line 107, in get
    if not self._poll(timeout):
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 257, in poll
    return self._poll(timeout)
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 424, in _poll
    r = wait([self], timeout)
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 931, in wait
    ready = selector.select(timeout)
  File "/usr/lib/python3.8/selectors.py", line 415, in select
    fd_event_list = self._selector.poll(timeout)
TypeError: <lambda>() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/dist-packages/nxbt/nxbt.py", line 267, in _command_manager
    sys.exit(0)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 318, in _bootstrap
    util._exit_function()
  File "/usr/lib/python3.8/multiprocessing/util.py", line 357, in _exit_function
    p.join()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 149, in join
    res = self._popen.wait(timeout)
  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 47, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 27, in poll
    pid, sts = os.waitpid(self.pid, flag)
    ```

@TeoMM
Copy link

TeoMM commented Feb 25, 2023

lmk if you'd be interested to join a voicecall anytime soon, i'd be really glad if i could get some real-time help on this

@blueapple128
Copy link

blueapple128 commented Feb 27, 2023

2a. What do you mean by "the same one"? Does the number increase from 2 to 3 after pairing?

2b. What is the output of this command?

1b. Unfortunately, as Brikwerk said in issue #39 it may be an OS scheduler or even hardware issue, in which case I wouldn't be able to do anything to help. I'd open a new issue with a different title alongside #39 and #94.

Another set of commands to try:

# Go to the unpairing Switch menu and disconnect everything so the number goes back down to 2
# Go back to the Change Grip/Order screen
# sudo python3

import nxbt
nx = nxbt.Nxbt()
ci = nx.create_controller(nxbt.PRO_CONTROLLER)
nx.wait_for_connection(ci)
nx.get_switch_addresses()  # What does this output?
nx.remove_controller(ci)
nx.get_switch_addresses()  # What does this output?
# Exit the Change Grip/Order screen with the touchscreen or whatever
nx.get_switch_addresses()  # What does this output?
nx.create_controller(nxbt.PRO_CONTROLLER, reconnect_address=nx.get_switch_addresses())  # What does this do?

@blueapple128
Copy link

Just to confirm, the whole process (unpair-connect-reconnect) still works on my end after updating to Switch FW 16.0.0.

@way-huang
Copy link

managed to get it working on an actual ubuntu install, BUT same exact problem as #39 #94 @way-huang @WilsontheWolf @blueapple128 @AsinineLucky Did you manage to get it working?

I use a usb bluetooth adapter, it works fine. It looks like the laptop builtin bluetooth has some peoblems.

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