mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-25 18:37:19 +00:00
Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98807a193f | ||
|
|
171de3b99e | ||
|
|
a62456ca5a | ||
|
|
d1e22b4d23 | ||
|
|
9e42a76ad2 | ||
|
|
35ce121781 | ||
|
|
22c1997ba2 | ||
|
|
f15b1f2ffa | ||
|
|
ad35edcab5 | ||
|
|
175d11e402 | ||
|
|
ef4e02e51d | ||
|
|
e00ed66238 |
7 changed files with 62 additions and 38 deletions
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
|
|
@ -1,9 +1,6 @@
|
|||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
workflow_dispatch:
|
||||
concurrency:
|
||||
group: build-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
|
@ -16,27 +13,33 @@ jobs:
|
|||
os: macos-latest
|
||||
node: x64
|
||||
command: prebuildify
|
||||
args: --arch x64+arm64
|
||||
args: --arch x64+arm64 --target 14.0.0
|
||||
- name: win32-x86
|
||||
os: windows-2019
|
||||
node: x86
|
||||
command: prebuildify
|
||||
args: --target 14.0.0
|
||||
- name: win32-x64
|
||||
os: windows-2019
|
||||
node: x64
|
||||
command: prebuildify
|
||||
args: --target 14.0.0
|
||||
- name: win32-arm64
|
||||
os: windows-2019
|
||||
command: prebuildify
|
||||
args: --arch arm64 --target 20.11.1
|
||||
- name: linux-x64
|
||||
os: ubuntu-latest
|
||||
command: prebuildify-cross
|
||||
args: -i centos7-devtoolset7 -i alpine
|
||||
args: -i centos7-devtoolset7 -i alpine --target 14.0.0
|
||||
- name: linux-arm
|
||||
os: ubuntu-latest
|
||||
command: prebuildify-cross
|
||||
args: -i linux-arm64-lts -i linux-armv7 -i linux-armv7l-musl -i linux-armv6
|
||||
args: -i linux-arm64-lts -i linux-armv7 -i linux-armv7l-musl -i linux-armv6 --target 14.0.0
|
||||
- name: android-arm
|
||||
os: ubuntu-latest
|
||||
command: prebuildify-cross
|
||||
args: -i android-arm64 -i android-armv7
|
||||
args: -i android-arm64 -i android-armv7 --target 14.0.0
|
||||
name: Build ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
|
|
@ -48,7 +51,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- run: npm ci
|
||||
- run: npm run ${{ matrix.command }} -- ${{ matrix.args }}
|
||||
- uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: prebuilds/
|
||||
|
|
@ -59,9 +62,13 @@ jobs:
|
|||
needs: prebuild
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: prebuilds
|
||||
|
|
@ -72,5 +79,5 @@ jobs:
|
|||
- run: npm run build
|
||||
- run: npm run semantic-release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
|
|
|||
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
|
|
@ -1,7 +1,6 @@
|
|||
name: Test / Lint
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
|
|
|||
|
|
@ -13,10 +13,12 @@
|
|||
[
|
||||
"@semantic-release/github",
|
||||
{
|
||||
"successComment": false,
|
||||
"failComment": false,
|
||||
"assets": [
|
||||
{
|
||||
"path": "prebuilds-*.tar.gz",
|
||||
"label": "Binary modules (from npm @serialport/bindings-cpp)"
|
||||
"label": "Binary modules (from npm @sie-js/node-serialport-bindings-cpp)"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# @serialport/bindings-cpp
|
||||
# @sie-js/node-serialport-bindings-cpp (fork with custom baudrate fix)
|
||||
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
|
|
@ -13,14 +13,14 @@ Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your roboti
|
|||
|
||||
- 📚 [**Guides**](https://serialport.io/docs/)
|
||||
- [**API Docs**](https://serialport.io/docs/api-serialport)
|
||||
- [`@serialport/bindings-cpp`](https://www.npmjs.com/package/@serialport/bindings-cpp)
|
||||
- [`@sie-js/node-serialport-bindings-cpp`](https://www.npmjs.com/package/@sie-js/node-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
|
||||
- [`@sie-js/node-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
|
||||
|
||||
|
|
|
|||
42
package-lock.json
generated
42
package-lock.json
generated
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "@serialport/bindings-cpp",
|
||||
"name": "@sie-js/node-serialport-bindings-cpp",
|
||||
"version": "0.0.0-development",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@serialport/bindings-cpp",
|
||||
"name": "@sie-js/node-serialport-bindings-cpp",
|
||||
"version": "0.0.0-development",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
"eslint": "8.57.1",
|
||||
"mocha": "10.8.2",
|
||||
"node-abi": "3.71.0",
|
||||
"node-gyp": "10.2.0",
|
||||
"node-gyp": "^10.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"prebuildify": "6.0.1",
|
||||
"prebuildify-cross": "5.1.1",
|
||||
|
|
@ -8302,9 +8302,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/node-gyp": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.2.0.tgz",
|
||||
"integrity": "sha512-sp3FonBAaFe4aYTcFdZUn2NYkbP7xroPGYvQmP4Nl5PxamznItBnNCgjrVTKrEfQynInMsJvZrdmqUnysCJ8rw==",
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.1.0.tgz",
|
||||
"integrity": "sha512-B4J5M1cABxPc5PwfjhbV5hoy2DP9p8lFXASnEN6hugXOa61416tnTZ29x9sSwAd0o99XNIcpvDDy1swAExsVKA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
@ -8314,9 +8314,9 @@
|
|||
"graceful-fs": "^4.2.6",
|
||||
"make-fetch-happen": "^13.0.0",
|
||||
"nopt": "^7.0.0",
|
||||
"proc-log": "^4.1.0",
|
||||
"proc-log": "^3.0.0",
|
||||
"semver": "^7.3.5",
|
||||
"tar": "^6.2.1",
|
||||
"tar": "^6.1.2",
|
||||
"which": "^4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
|
|
@ -8411,6 +8411,16 @@
|
|||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp/node_modules/proc-log": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz",
|
||||
"integrity": "sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp/node_modules/signal-exit": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||
|
|
@ -21403,9 +21413,9 @@
|
|||
}
|
||||
},
|
||||
"node-gyp": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.2.0.tgz",
|
||||
"integrity": "sha512-sp3FonBAaFe4aYTcFdZUn2NYkbP7xroPGYvQmP4Nl5PxamznItBnNCgjrVTKrEfQynInMsJvZrdmqUnysCJ8rw==",
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.1.0.tgz",
|
||||
"integrity": "sha512-B4J5M1cABxPc5PwfjhbV5hoy2DP9p8lFXASnEN6hugXOa61416tnTZ29x9sSwAd0o99XNIcpvDDy1swAExsVKA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"env-paths": "^2.2.0",
|
||||
|
|
@ -21414,9 +21424,9 @@
|
|||
"graceful-fs": "^4.2.6",
|
||||
"make-fetch-happen": "^13.0.0",
|
||||
"nopt": "^7.0.0",
|
||||
"proc-log": "^4.1.0",
|
||||
"proc-log": "^3.0.0",
|
||||
"semver": "^7.3.5",
|
||||
"tar": "^6.2.1",
|
||||
"tar": "^6.1.2",
|
||||
"which": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
@ -21468,6 +21478,12 @@
|
|||
"brace-expansion": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"proc-log": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz",
|
||||
"integrity": "sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"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",
|
||||
"main": "./dist/index.js",
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
"eslint": "8.57.1",
|
||||
"mocha": "10.8.2",
|
||||
"node-abi": "3.71.0",
|
||||
"node-gyp": "10.2.0",
|
||||
"node-gyp": "^10.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"prebuildify": "6.0.1",
|
||||
"prebuildify-cross": "5.1.1",
|
||||
|
|
@ -57,8 +57,8 @@
|
|||
"scripts": {
|
||||
"build": "rm -rf dist && tsc -p tsconfig-build.json",
|
||||
"install": "node-gyp-build",
|
||||
"prebuildify": "prebuildify --napi --target 14.0.0 --force --strip --verbose",
|
||||
"prebuildify-cross": "prebuildify-cross --napi --target 14.0.0 --force --strip --verbose",
|
||||
"prebuildify": "prebuildify --napi --force --strip --verbose",
|
||||
"prebuildify-cross": "prebuildify-cross --napi --force --strip --verbose",
|
||||
"rebuild": "node-gyp rebuild",
|
||||
"format": "eslint lib test bin --fix",
|
||||
"lint": "eslint lib test bin && cc --verbose",
|
||||
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -114,14 +114,14 @@ void ConnectionOptionsBaton::Execute() {
|
|||
// If there is a custom baud rate on linux you can do the following trick with B38400
|
||||
#if defined(__linux__) && defined(ASYNC_SPD_CUST)
|
||||
if (baudRate == -1) {
|
||||
int err = linuxSetCustomBaudRate(fd, baudRate);
|
||||
int err = linuxSetCustomBaudRate(fd, this->baudRate);
|
||||
|
||||
if (err == -1) {
|
||||
snprintf(errorString, sizeof(errorString), "Error: %s || while retrieving termios2 info", strerror(errno));
|
||||
this->SetError(errorString);
|
||||
return;
|
||||
} else if (err == -2) {
|
||||
snprintf(errorString, sizeof(errorString), "Error: %s || while setting custom baud rate of %d", strerror(errno), baudRate);
|
||||
snprintf(errorString, sizeof(errorString), "Error: %s || while setting custom baud rate of %d", strerror(errno), this->baudRate);
|
||||
this->SetError(errorString);
|
||||
return;
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ void ConnectionOptionsBaton::Execute() {
|
|||
// On OS X, starting with Tiger, we can set a custom baud rate with ioctl
|
||||
#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
|
||||
if (-1 == baudRate) {
|
||||
speed_t speed = baudRate;
|
||||
speed_t speed = this->baudRate;
|
||||
if (-1 == ioctl(fd, IOSSIOSPEED, &speed)) {
|
||||
snprintf(errorString, sizeof(errorString), "Error: %s calling ioctl(.., IOSSIOSPEED, %ld )", strerror(errno), speed);
|
||||
this->SetError(errorString);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue