I have a project using `@serialport/bindings-cpp` that works without issues on MacOS and Linux, but on windows every read fails with ``` [Error: Reading from COM port (ReadFile): Unknown error code 1784] ``` The device I'm talking to has a binary protocol, and all exchanges begin with a single character write to the device, a single character response from the device, and then further, longer exchanges. The single character read always fails. This is because `ReadThread` does a single character read using `ReadFileEx`, and then, unconditionally reads "the rest of the data" using `ReadFile`. But in the case of a single character read there is no "rest of the data". This pull request fixes it by checking for no more data before issuing the `ReadFile`. I don't know how to write a test that would fail without the fix. Co-authored-by: markw65 <git@myosotissp.com> |
||
|---|---|---|
| .github | ||
| bin | ||
| lib | ||
| src | ||
| test | ||
| .eslintrc.js | ||
| .gitignore | ||
| .node-version | ||
| .npmignore | ||
| .releaserc | ||
| binding.gyp | ||
| CODE_OF_CONDUCT.md | ||
| codecov.yml | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| SECURITY.md | ||
| tsconfig-build.json | ||
| tsconfig.json | ||
@serialport/bindings-cpp
Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
Go to https://serialport.io/ to learn more, find guides and api documentation.
Quick Links
- 📚 Guides
- API Docs
@serialport/bindings-cpp- 🐛 Help and Bugs All serialport issues are pointed to the main serialport repo.
Bindings
The Bindings provide a low level interface to work with your serialport. It is possible to use them alone but it's usually easier to use them with an interface.
@serialport/bindings-cppbindings for Linux, Mac and Windows@serialport/binding-interfaceas an interface to use if you're making your own bindings@serialport/binding-mockfor a mock binding package for testing
Developing
Developing node serialport projects
- Clone this repo
git clone git@github.com:serialport/bindings-cpp.git - Run
npm installto setup local package dependencies (run this any time you depend on a package local to this repo) - Run
npm testto ensure everything is working properly - If you have a serial loopback device (TX to RX) you can run run
TEST_PORT=/path/to/port npm testfor a more comprehensive test suite. (Defaults to 115200 baud customize with the TEST_BAUD env.) You can use an arduino with thetest/arduino-echosketch.
Developing Docs
See https://github.com/serialport/website
License
SerialPort packages are all MIT licensed and all it's dependencies are MIT licensed.
Code of Conduct
SerialPort follows the Nodebots Code of Conduct. While the code is MIT licensed participation in the community has some rules to make this a good place to work and learn.
TLDR
- Be respectful.
- Abusive behavior is never tolerated.
- Data published to NodeBots is hosted at the discretion of the service administrators, and may be removed.
- Don't build evil robots.
- Violations of this code may result in swift and permanent expulsion from the NodeBots community.
Governance and Community
SerialPort is currently employees a governance with a group of maintainers, committers and contributors, all fixing bugs and adding features and improving documentation. You need not apply to work on SerialPort, all are welcome to join, build, and maintain this project.
- A Contributor is any individual creating or commenting on an issue or pull request. By participating, this is you.
- Committers are contributors who have been given write access to the repository. They can review and merge pull requests.
- Maintainers are committers representing the required technical expertise to resolve rare disputes.
If you have a PR that improves the project people in any or all of the above people will help you land it.
Maintainers
Contributors
This project exists thanks to all the people who contribute. [Contribute].
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]