Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
device.hardware: improve handling of surprise disconnection.
This commit adds handling of the LIBUSB_ERROR_NO_DEVICE error during transfer submission. This error was already handled during transfer completion, but since surprise disconnection is (by definition) asynchronous, this it can happen right before submission too. The message is also changed from ambiguous "device lost" (lost where?) to unambiguous "device disconnected". The code in _do_transfer with the exception handler nested three levels deep is some of the most cursed and convoluted logic I have ever written but as far as I can tell it is reasonably appropriate to the task. Sigh. This is still not quite enough to reduce the errors printed for a surprise disconnection to a single line, but we're getting there.
- Loading branch information