Merged
Conversation
ed2abc6 to
8423612
Compare
Relying on reads always returning sector-sized chunks, doesn't work when the underlying transport in qcserial. In the upcoming changes, the reader is changed to BufRead which exposes this problem. There's nothing in the loop that rely on the reads always returning sector-sized chunks, so drop that part of the logic. Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The Read trait serves us well for the USB backend, but the serial backend doesn't provide incoming messages in packets. This becomes a problem when we're doing <read/> as the response and data can come in the same channel.read(). Switch the trait to BufRead, to allow the implementation to peek at the data and partially consume the channel. Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
8423612 to
f33a91a
Compare
Contributor
|
Gave this a really brief spin on hamoa, printing GPT works 100% of the time on both SPINOR and NVMe, windows 11+qcserial |
Contributor
|
I also managed to give it a shot on an M1 macbook and it seems like things works there too.. cc @koenkooi @lool (other than the 'unimplemented command' splash if I went too fast which turned out to be an XML log message telling me that the device is going to reboot in 0 seconds.. which was definitely a lie, it took much longer) |
The channel does not necessarily provide the incoming messages in the form of packetized messages. This means that the response XML and rawmode data might be read at once. As we switched to a BufRead we can look for the </data> marker and consume only that amount of data instead. Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
f33a91a to
d3b5814
Compare
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.
When the underlying transport is qcserial, the read and rawmode content is not consumed as individual "packets", but instead a continuous stream of bytes. The consumer of incoming messages needs to take this into consideration.
This also cleans up the loop over multiple XML blobs that sometimes was found in the responses.