Skip to content

For qcom/bufreader#27

Merged
quic-kdybcio merged 3 commits intoqualcomm:mainfrom
quic-bjorande:for-qcom/bufreader
Oct 24, 2025
Merged

For qcom/bufreader#27
quic-kdybcio merged 3 commits intoqualcomm:mainfrom
quic-bjorande:for-qcom/bufreader

Conversation

@quic-bjorande
Copy link
Contributor

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.

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>
@quic-kdybcio
Copy link
Contributor

Gave this a really brief spin on hamoa, printing GPT works 100% of the time on both SPINOR and NVMe, windows 11+qcserial

@quic-kdybcio
Copy link
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>
@quic-kdybcio quic-kdybcio merged commit 7feed05 into qualcomm:main Oct 24, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants