The C++ bindings for the node serialport project. (Fork)
Find a file
markw65 f8bfc1eed2
fix: single character reads on windows fail (#165)
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>
2024-12-23 15:02:48 -05:00
.github Bring everything up-to-date (#194) 2024-12-23 14:38:28 -05:00
bin fix: find arduino 2022-01-22 22:25:20 -05:00
lib Bring everything up-to-date (#194) 2024-12-23 14:38:28 -05:00
src fix: single character reads on windows fail (#165) 2024-12-23 15:02:48 -05:00
test chore: upgrade ts and fix type warnings (#91) 2022-11-16 22:09:25 -05:00
.eslintrc.js feat: migrate to typescript (#3) 2022-01-22 15:55:03 -05:00
.gitignore feat: migrate to typescript (#3) 2022-01-22 15:55:03 -05:00
.node-version chore(deps): update node.js to v20.18.1 (#189) 2024-12-23 14:49:41 -05:00
.npmignore fix: npm ignore 2022-02-05 10:44:08 -05:00
.releaserc fix: prebuild upload path to a glob 2022-01-07 13:01:47 -05:00
binding.gyp fix: update build tools and fix arm64 build for rpi (#111) 2023-04-19 23:22:09 -04:00
CODE_OF_CONDUCT.md docs: formalize a governance model (#1667) 2018-09-17 22:31:05 -04:00
codecov.yml chore: update codecov because of deprecation (#52) 2022-03-04 23:44:32 -05:00
CONTRIBUTING.md chore: update org/repo urls (#1879) 2019-05-25 22:17:57 -04:00
LICENSE Pull README edits into the template and JS Doc 2017-06-18 21:24:51 -04:00
package-lock.json Bring everything up-to-date (#194) 2024-12-23 14:38:28 -05:00
package.json Bring everything up-to-date (#194) 2024-12-23 14:38:28 -05:00
README.md Update README.md (#109) 2023-04-19 10:29:06 -04:00
SECURITY.md Update SECURITY.md 2021-07-06 14:32:21 -04:00
tsconfig-build.json feat: migrate to typescript (#3) 2022-01-22 15:55:03 -05:00
tsconfig.json feat: new binding interface (#19) 2022-01-29 22:51:40 -05:00

@serialport/bindings-cpp

Backers on Open Collective Sponsors on Open Collective codecov Test / Lint

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.

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.

Developing

Developing node serialport projects

  1. Clone this repo git clone git@github.com:serialport/bindings-cpp.git
  2. Run npm install to setup local package dependencies (run this any time you depend on a package local to this repo)
  3. Run npm test to ensure everything is working properly
  4. If you have a serial loopback device (TX to RX) you can run run TEST_PORT=/path/to/port npm test for a more comprehensive test suite. (Defaults to 115200 baud customize with the TEST_BAUD env.) You can use an arduino with the test/arduino-echo sketch.

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]