Compare commits

...

13 commits
main ... v0.0.0

Author SHA1 Message Date
Kirill Zhumarin
efbf143064 chore(release): 0.0.0 2026-06-30 01:17:55 +03:00
Kirill Zhumarin
0b12e361ed Merge branch 'fix/poller-listener-order' into fork 2026-06-30 01:13:39 +03:00
Kirill Zhumarin
0d192899e9 Merge branch 'fix/poller-makecallback' into fork 2026-06-30 01:13:34 +03:00
Kirill Zhumarin
4f22da84a4 fix: register poller listeners before polling 2026-06-30 00:57:21 +03:00
Kirill Zhumarin
92230ebd59 fix: deliver poller events with MakeCallback 2026-06-30 00:56:43 +03:00
Azq2
1bf5396a01
Merge branch 'serialport:main' into fork 2026-06-29 22:18:18 +03:00
Azq2
a9c7f51f35
Update build.yml 2025-10-25 01:22:14 +03:00
Azq2
2660fc46c7
Update build.yml 2025-10-25 00:46:07 +03:00
Azq2
bf451ec73b
Update build.yml 2025-10-24 23:55:24 +03:00
Azq2
68ad700c24
Update build.yml 2025-10-24 23:42:09 +03:00
Kirill Zhumarin
5ef9c1b48e fix: CI 2025-10-24 23:28:26 +03:00
Kirill Zhumarin
9047f14e2a fork 2025-10-24 23:10:28 +03:00
Kirill Zhumarin
bada5a9e5c fix(unix): allow EOPNOTSUPP for TIOCSBRK/TIOCCBRK 2025-10-24 22:03:36 +03:00
10 changed files with 37 additions and 112 deletions

View file

@ -2,8 +2,13 @@ name: Build
on:
push:
branches:
- main
- fork
- beta
permissions:
id-token: write
contents: read
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: false
@ -117,9 +122,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g npm@latest
- run: npm ci
- run: npm run build
- run: npm run semantic-release
- run: npm publish --access public --tag latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -25,7 +25,7 @@ jobs:
# arch isn't used and we have no way to use it currently
- { os: macos-latest, arch: x64 }
- { os: ubuntu-latest, arch: x64 }
- { os: windows-2019, arch: x64 }
- { os: windows-2022, arch: x64 }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3

View file

@ -1,7 +1,8 @@
{
"branches": [
"main",
"next"
"next",
"fork"
],
"plugins": [
"@semantic-release/commit-analyzer",
@ -16,7 +17,7 @@
"assets": [
{
"path": "prebuilds-*.tar.gz",
"label": "Binary modules (from npm @serialport/bindings-cpp)"
"label": "Binary modules (from npm @sie-js/node-serialport-bindings-cpp)"
}
]
}

View file

@ -1,95 +1,2 @@
# @serialport/bindings-cpp
[![Backers on Open Collective](https://opencollective.com/serialport/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/serialport/sponsors/badge.svg)](#sponsors)
[![codecov](https://codecov.io/gh/serialport/bindings-cpp/branch/main/graph/badge.svg?token=rsGeOmdnsV)](https://codecov.io/gh/serialport/bindings-cpp)
[![Test / Lint](https://github.com/serialport/bindings-cpp/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/serialport/bindings-cpp/actions/workflows/test.yml)
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**](https://serialport.io/docs/)
- [**API Docs**](https://serialport.io/docs/api-serialport)
- [`@serialport/bindings-cpp`](https://www.npmjs.com/package/@serialport/bindings-cpp)
- 🐛 [Help and Bugs](https://github.com/serialport/node-serialport/issues/new/choose) 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-cpp`](https://serialport.io/docs/api-bindings-cpp) bindings for Linux, Mac and Windows
- [`@serialport/binding-interface`](https://serialport.io/docs/api-bindings-interface) as an interface to use if you're making your own bindings
- [`@serialport/binding-mock`](https://serialport.io/docs/api-binding-mock) for a mock binding package for testing
## Developing
### Developing node serialport projects
1. Clone this repo `git clone git@github.com:serialport/bindings-cpp.git`
1. Run `npm install` to setup local package dependencies (run this any time you depend on a package local to this repo)
1. Run `npm test` to ensure everything is working properly
1. 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](LICENSE) and all it's dependencies are MIT licensed.
## Code of Conduct
SerialPort follows the [Nodebots Code of Conduct](http://nodebots.io/conduct.html). 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](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951) 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**
- [Francis Gulotta](https://twitter.com/reconbot) | [reconbot](https://github.com/reconbot)
- [Nick Hehr](https://twitter.com/hipsterbrown) | [hipsterbrown](https://github.com/hipsterbrown)
### Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/serialport/node-serialport/graphs/contributors"><img src="https://opencollective.com/serialport/contributors.svg?width=890&button=false" /></a>
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/serialport#backer)]
<a href="https://opencollective.com/serialport#backers" target="_blank"><img src="https://opencollective.com/serialport/backers.svg?width=890"></a>
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/serialport#sponsor)]
<!-- <a href="https://opencollective.com/serialport/sponsor/0/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/1/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/2/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/3/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/4/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/5/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/6/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/7/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/8/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/serialport/sponsor/9/website" target="_blank"><img src="https://opencollective.com/serialport/sponsor/9/avatar.svg"></a> -->
# @sie-js/node-serialport-bindings-cpp
Fork with https://github.com/serialport/bindings-cpp/pull/229

11
fork.sh Normal file
View file

@ -0,0 +1,11 @@
#!/bin/bash
cp $0 /tmp/node_serialport_fork.sh
git reset --hard
grep -r '@serialport/bindings-cpp' -l | xargs sed 's/@serialport\/bindings-cpp/@sie-js\/node-serialport-bindings-cpp/g' -i
grep -r 'github.com/serialport/bindings-cpp.git' -l | xargs sed 's/github.com\/serialport\/bindings-cpp.git/github.com\/siemens-mobile-hacks\/node-serialport-bindings-cpp.git/g' -i
echo '# @sie-js/node-serialport-bindings-cpp' > README.md
echo 'Fork with https://github.com/serialport/bindings-cpp/pull/229' >> README.md
sed -i 's/- main/- fork/g' ./.github/workflows/build.yml
mv /tmp/node_serialport_fork.sh $0

View file

@ -60,6 +60,7 @@ export class Poller extends EventEmitter {
* @returns {Poller} returns itself
*/
once(event: 'readable' | 'writable' | 'disconnect', callback: (err: null | Error) => void): this {
super.once(event, callback)
switch (event) {
case 'readable':
this.poll(EVENTS.UV_READABLE)
@ -71,7 +72,7 @@ export class Poller extends EventEmitter {
this.poll(EVENTS.UV_DISCONNECT)
break
}
return super.once(event, callback)
return this
}
/**

8
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "@serialport/bindings-cpp",
"version": "0.0.0-development",
"name": "@sie-js/node-serialport-bindings-cpp",
"version": "0.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@serialport/bindings-cpp",
"version": "0.0.0-development",
"name": "@sie-js/node-serialport-bindings-cpp",
"version": "0.0.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View file

@ -1,7 +1,7 @@
{
"name": "@serialport/bindings-cpp",
"name": "@sie-js/node-serialport-bindings-cpp",
"description": "SerialPort Hardware bindings for node serialport written in c++",
"version": "0.0.0-development",
"version": "0.0.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"keywords": [
@ -91,7 +91,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/serialport/bindings-cpp.git"
"url": "https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git"
},
"funding": "https://opencollective.com/serialport/donate",
"changelog": {

View file

@ -81,13 +81,13 @@ void Poller::onData(uv_poll_t* handle, int status, int events) {
if (0 != status) {
// fprintf(stdout, "OnData Error status=%s events=%d\n", uv_strerror(status), events);
obj->_stop(); // doesn't matter if this errors
obj->callback.Call({Napi::Error::New(env, uv_strerror(status)).Value(), env.Undefined()});
obj->callback.MakeCallback(obj->Value(), {Napi::Error::New(env, uv_strerror(status)).Value(), env.Undefined()});
} else {
// fprintf(stdout, "OnData status=%d events=%d subscribed=%d\n", status, events, obj->events);
// remove triggered events from the poll
int newEvents = obj->events & ~events;
obj->poll(env, newEvents);
obj->callback.Call({env.Null(), Napi::Number::New(env, events)});
obj->callback.MakeCallback(obj->Value(), {env.Null(), Napi::Number::New(env, events)});
}
}

View file

@ -396,7 +396,7 @@ void SetBaton::Execute() {
result = ioctl(fd, TIOCCBRK, NULL);
}
if (-1 == result) {
if (-1 == result && errno != EOPNOTSUPP) {
snprintf(errorString, sizeof(errorString), "Error: %s, cannot set", strerror(errno));
this->SetError(errorString);
return;