-
Notifications
You must be signed in to change notification settings - Fork 9
Move to nusb, fix some bugs, start flash promptly #31
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
Merged
Conversation
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
Most (all?) fh implementations will not restart the device until the host has consumed the log feedback after calling <reset>. Drain the buffer after issuing that packet. Reported-by: Axel Karjalainen <axel@axka.fi> # GH PR 29 Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
The initial message buffer ("welcome logs") may look something like the
log attached below.
One may notice that there's a clear cut-off before the <configure>
packet, but the protocol gives no good way to delimit that, making
every session require waiting for the transport layer (USB) timeout,
signaling "end of data". Try being smart about it by checking for the
last message that usually comes from there.
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: Binary build date: Feb 17 2022 @ 12:09:40" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: Binary build date: Feb 17 2022 @ 12:09:40
" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: Chip serial num: 648502458 (0x26a75cba)" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: Supported Functions (15):" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: program" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: read" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: nop" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: patch" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: configure" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: setbootablestoragedrive" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: erase" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: power" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: firmwarewrite" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: getstorageinfo" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: benchmark" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: emmc" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: ufs" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: fixgpt" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: getsha256digest" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: End of supported functions 15" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: Calling handler for configure" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="INFO: Storage type set to value UFS" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="DEBUG: Calling usb_al_bulk_set_zlp_mode(TRUE), zlp is not set to 0" /></data>
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<response value="ACK" MemoryName="UFS" MinVersionSupported="1" Version="1" MaxPayloadSizeToTargetInBytes="1048576" MaxPayloadSizeToTargetInBytesSupported="1048576" MaxXMLSizeInBytes="4096" DateTime="Feb 17 2022 - 12:09:40" /></data>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
nusb notably doesn't use libusb and should be helpful in trying to overcome macOS's USB ZLP issues. nusb is also purely written in Rust (utilizing OS native interfaces in their specific backends) and has nice integrations with BufReader & async APIs, which we'll hopefully take advantage of in the future. This commit probably? removes support for *BSDs which may? have worked prior, based on just libusb (if other dependencies weren't a blocker), but the rusb backend can be brought back at any time if it's deemed useful. Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Currently there's an attempted OOB read which crashes the program anyway, handle it more reasonably. Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
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.
No description provided.