Coder Social home page Coder Social logo

Comments (6)

mlsvrts avatar mlsvrts commented on June 23, 2024

Does bytes_to_read indicate that there are 52 bytes available when you read?

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...

from serialport-rs.

Austin-Crabtree avatar Austin-Crabtree commented on June 23, 2024

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.

from serialport-rs.

Austin-Crabtree avatar Austin-Crabtree commented on June 23, 2024

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.

from serialport-rs.

DanielJoyce avatar DanielJoyce commented on June 23, 2024

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

from serialport-rs.

DanielJoyce avatar DanielJoyce commented on June 23, 2024

https://github.com/pyserial/pyserial/blob/31fa4807d73ed4eb9891a88a15817b439c4eea2d/serial/serialposix.py#L570

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.

from serialport-rs.

newcomertv avatar newcomertv commented on June 23, 2024

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?

from serialport-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.