-
Notifications
You must be signed in to change notification settings - Fork 125
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
Read not reading all the data off a TTY port #97
Comments
Does Do you always get the same number of bytes from the first read request, or does it vary? I'm wondering if the OS driver is doing some sort of buffering here... |
I haven't check the bytes_to_read function I can do that. But the amount of bytes to read is is variable based on the type of message that is being sent. All other messages are requests and don't have a data payload so each other message is the same size about 14 bytes in size. |
I will also say that I checked against my rust application by creating a quick python script using pyserial and was able to read all the data in one read. |
Raspberry PI Uart is 16 bytes. PySerial probably caches internally to another buffer transparently to read by other processes. You're gonna need to read in a loop until there are no more bytes to read, stuffing them into a bigger buffer |
Here, it reads into a buffer in a loop, only returning when the buffer is full, or timeout. You will need to imple the same logic as serialport-rs is pretty low level. |
This seems like a bug not a feature.. I'd expect a serial interface reader to read until the buffer is full or the transmission has timed-out if I can configure buffer size and timeout duration.. Is there a use-case where this is desired behaviour? |
Its a feature since folks may want to buffer, some don't. Since you want to buffer, you need to buffer yourself. |
Using:
when reading off a Beaglebone Black UART connection I am running into an issue when I have a message larger than 52 bytes not being pulled off the TTY buffer in one read, typically takes two reads. I am creating a sufficiently large enough buffer and the read isn't filling the vector. I have tried both
open()
andopen_native()
on the port with no help. I also have narrowed it down to the read being the issue becuase I have put aclear(ClearBuffer::All)
after reading and parsing the data and I can't get the second half of the data anymore.The text was updated successfully, but these errors were encountered: