GithubHelp home page GithubHelp logo

Comments (5)

audiohacked avatar audiohacked commented on June 13, 2024

I wrote this library over 7 years ago, and only kept it updated as I needed. When I first wrote this, I don't remember if pyserial had timeouts or that they didn't work correctly. Also, pyserial on read or write may send incomplete streams and/or not pause between transmissions. The pyserial timeouts are more for transmission timeouts and not BusPirate wait/sleep/pause type timeouts.

from python-pybuspirate.

EddieParis avatar EddieParis commented on June 13, 2024

Yes, pyserial timeout are transmission (and in our case reception timeouts). I noticed that most of the usage of self.timeout() is to wait a bit before getting answer. This is exactly the purpose of the pySerial timeout. Somtime a simple pause is needed, better use time.sleep() instead of timeout.

Again my point is that the select in timeout does not work on Windows, so I can provide a branch with no more select, you can then merge it if you agree :-)

from python-pybuspirate.

audiohacked avatar audiohacked commented on June 13, 2024

@EddieParis pySerial timeouts are Transaction timeouts, they don't control response timeout or pre-response pausing.

from python-pybuspirate.

EddieParis avatar EddieParis commented on June 13, 2024

I'm surprised this get back to the front :-)
So let me explain one last time.
In the original code, the select is used to wait any event on the process FDs for a maximum of timeout seconds. If an event happens (an incoming character on the serial line for instance) the select exits immediately and then you go and fetch the response which is available since you waited in the select.

This behavior is EXACTLY what's behind pySerial timeouts, so when a timeout is set, if you want to read a character and there is non immediately available it wait for a maximum of timeout seconds.

So using the pySerial timeouts is more clear and have the benefit of compatibility regarding the select issue on the windows platform.

from python-pybuspirate.

audiohacked avatar audiohacked commented on June 13, 2024

@EddieParis Let me explain how the BusPirate works, the serial interface will return whatever junk is in the buffer on the device side. We use select/timeout to ensure the BusPirate has enough time to flush its buffer and push data onto the buffer. If we were dealing with a "Normal" serial port, the pySerial timeouts would work. But as for the BusPirate, it doesn't always return valid data using pySerial timeouts. I know because when I originally tried to use the pySerial Timeouts I wasn't getting valid responses to sent commands.

from python-pybuspirate.

Related Issues (12)

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.