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

Disconnecting the Xbox controller raises an exception - possible to handle gracefully and/or pass back to the caller? #24

Open
aaronwoodcox opened this issue Aug 31, 2021 · 0 comments

Comments

@aaronwoodcox
Copy link

Disconnecting the Xbox controller results in the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/aaron/.local/lib/python3.8/site-packages/xbox360controller/controller.py", line 263, in _event_loop
    event = self.get_event()
  File "/home/aaron/.local/lib/python3.8/site-packages/xbox360controller/controller.py", line 272, in get_event
    buf = self._dev_file.read(8)
OSError: [Errno 19] No such device

It would be really great if a disconnect could be handled more gracefully. Is there a way that the exception could be passed along to the caller so that action could be taken? For example, so the calling application could attempt to reconnect to the controller and/or do something to handle the exception gracefully? Is there any existing mechanism to do so? And if not, would it be possible to add one?

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

1 participant