Repository navigation
Conversation
Use millisecond-scale Sahara read timeouts, stop treating the timeout value as a retry budget, recognize libusb0 timeout strings, and fail cleanly on END_TRANSFER instead of continuing as HELLO.
There was a problem hiding this comment.
🟡 Changes recommended
The timeout change can block serial connections for 1,000 seconds, and the unreachable END_TRANSFER branch prevents the recovery reset from being sent.
2 open issues
What changed in this PR
This PR aims to improve EDL connection reliability on Windows by correcting USB timeout handling and distinguishing Sahara END_TRANSFER responses from successful HELLO handshakes.
Changes:
- Increase Sahara read timeouts and recognize late HELLO responses.
- Bound USB timeout retries, recognize both backend timeout messages, and guard libusb1-specific setup.
- Report END_TRANSFER as an error and add a reset-and-exit handler.
| File | Description |
|---|---|
edlclient/Library/sahara.py |
Adjust connection timeouts and handle HELLO and END_TRANSFER responses. |
edlclient/Library/Connection/usblib.py |
Bound timeout retries and make backend handling safer. |
edl.py |
Add END_TRANSFER recovery and error-exit handling. |
Review effort: Balanced
Handle END_TRANSFER by cmd before mode dispatch so cmd_reset runs, and use 1s on serial vs 1000ms on USB for Sahara HELLO reads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows (and with some USB backends), Sahara connect used
timeout=1. Under pyusb that is 1 ms, so the HELLO often missed, then XML/HDLC probes confused the device. USB reads also treated the timeout value in milliseconds as a retry counter (timeout == 10), so callers that passtimeout=1000could hang forever on "Device detected".Changes
END_TRANSFERas an error with a clear reboot/re-enter-EDL message (and handle HELLO that arrives after the firehose probe).usblib: count USB timeout retries separately from the timeout value; accept both libusb1 (timed out) and libusb0-win32 (timeout error) strings.libusb_set_optionon libusb1 backends, and do not clear the backend if that fails.Windows backend selection is left as auto (
backend = None). Related but different: #802 forces the bundled libusb-1.0.dll via libusb1.Tested
END_TRANSFERexits with a clear error instead of continuing as HELLO