joaorb64 / joycond-cemuhook

Support for cemuhook's UDP protocol for joycond devices
MIT License
148 stars 18 forks source link

Stuck on a loop where Joycons would connect then disconnects and shows errors #99

Open childgg opened 3 weeks ago

childgg commented 3 weeks ago

This is the error that shows up after it disconnects and then it starts a loop when trying to play Mario Galaxy on Dolphin emulator. Joycons work fine with just joycond without cemuhook. I'm running Fedora 41 Gnome. Thanks in advance for any help.

Device disconnected: Nintendo Switch Combined Joy-Cons
Task exception was never retrieved
future: <Task finished name='Task-934' coro=<SwitchDevice._handle_events() done, defined at /home/user/.local/lib/python3.13/site-packages/joycond_cemuhook/__init__.py:276> exception=ValueError('Invalid file descriptor: -1')>
Traceback (most recent call last):
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 88, in __anext__
    future.set_result(next(self.current_batch))
                      ~~~~^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.13/site-packages/joycond_cemuhook/__init__.py", line 279, in _handle_events
    async for event in self.device.async_read_loop():
    ...<23 lines>...
                    '-')] = clamp(event.value / axis.max, -1, 1) * (-1 if negate else 1)
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 98, in __anext__
    self.device.async_read().add_done_callback(next_batch_ready)
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 42, in async_read
    self._do_when_readable(lambda: self._set_result(future, self.read))
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 18, in _do_when_readable
    loop.add_reader(self.fileno(), ready)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/selector_events.py", line 347, in add_reader
    self._add_reader(fd, callback, *args)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/selector_events.py", line 277, in _add_reader
    key = self._selector.get_map().get(fd)
  File "/usr/lib64/python3.13/selectors.py", line 70, in get
    fd = self._selector._fileobj_lookup(fileobj)
  File "/usr/lib64/python3.13/selectors.py", line 229, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/lib64/python3.13/selectors.py", line 42, in _fileobj_to_fd
    raise ValueError("Invalid file descriptor: {}".format(fd))
ValueError: Invalid file descriptor: -1
Task exception was never retrieved
future: <Task finished name='Task-939' coro=<SwitchDevice._handle_events() done, defined at /home/user/.local/lib/python3.13/site-packages/joycond_cemuhook/__init__.py:276> exception=ValueError('Invalid file descriptor: -1')>
Traceback (most recent call last):
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 88, in __anext__
    future.set_result(next(self.current_batch))
                      ~~~~^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.13/site-packages/joycond_cemuhook/__init__.py", line 279, in _handle_events
    async for event in self.device.async_read_loop():
    ...<23 lines>...
                    '-')] = clamp(event.value / axis.max, -1, 1) * (-1 if negate else 1)
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 98, in __anext__
    self.device.async_read().add_done_callback(next_batch_ready)
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 42, in async_read
    self._do_when_readable(lambda: self._set_result(future, self.read))
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/evdev/eventio_async.py", line 18, in _do_when_readable
    loop.add_reader(self.fileno(), ready)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/selector_events.py", line 347, in add_reader
    self._add_reader(fd, callback, *args)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/selector_events.py", line 277, in _add_reader
    key = self._selector.get_map().get(fd)
  File "/usr/lib64/python3.13/selectors.py", line 70, in get
    fd = self._selector._fileobj_lookup(fileobj)
  File "/usr/lib64/python3.13/selectors.py", line 229, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/lib64/python3.13/selectors.py", line 42, in _fileobj_to_fd
    raise ValueError("Invalid file descriptor: {}".format(fd))
ValueError: Invalid file descriptor: -1