Skip to content

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

@aaronwoodcox

Description

@aaronwoodcox

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions