Comments (5)
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.
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.
@EddieParis pySerial timeouts are Transaction timeouts, they don't control response timeout or pre-response pausing.
from python-pybuspirate.
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.
@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)
- Patch needed to work on my system HOT 3
- Doesn't work on Windows 7+ with python 3.5 HOT 1
- __init__() got multiple values for argument 'self' HOT 1
- Add package to PyPI
- pyBusPirate vs pyBusPirateLite HOT 3
- Dependencies for pyBusPirateLite
- DOS EoL Characters
- no setup.py file
- Block indention mismatch in BinaryMode/I2C.py
- Loop in BBmode() won't loop. HOT 7
- Python3 compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-pybuspirate.