From 184140b18d385171ebcd184a50e3da3dd8e1848c Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Thu, 24 Feb 2022 17:15:10 +0000 Subject: [PATCH] fixup serialport initialisation --- io/serialport/25-serial.js | 7 ++++--- io/serialport/package.json | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/io/serialport/25-serial.js b/io/serialport/25-serial.js index b0394e1ed..6bd45fab9 100644 --- a/io/serialport/25-serial.js +++ b/io/serialport/25-serial.js @@ -3,7 +3,7 @@ module.exports = function(RED) { "use strict"; var settings = RED.settings; var events = require("events"); - var serialp = require("serialport"); + const { SerialPort } = require('serialport'); var bufMaxSize = 32768; // Max serial buffer size, for inputs... const serialReconnectTime = settings.serialReconnectTime || 15000; @@ -336,7 +336,8 @@ module.exports = function(RED) { //newline = newline.replace("\\n","\n").replace("\\r","\r"); var olderr = ""; var setupSerial = function() { - obj.serial = new serialp(port,{ + obj.serial = new SerialPort({ + path: port, baudRate: baud, dataBits: databits, parity: parity, @@ -487,7 +488,7 @@ module.exports = function(RED) { }()); RED.httpAdmin.get("/serialports", RED.auth.needsPermission('serial.read'), function(req,res) { - serialp.list().then( + SerialPort.list().then( ports => { const a = ports.map(p => p.path); res.json(a); diff --git a/io/serialport/package.json b/io/serialport/package.json index 718091bf3..22d65481e 100644 --- a/io/serialport/package.json +++ b/io/serialport/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-serialport", - "version" : "0.15.0", + "version" : "1.0.1", "description" : "Node-RED nodes to talk to serial ports", "dependencies" : { - "serialport" : "^9.2.5" + "serialport" : "^10.3.0" }, "repository" : { "type":"git", @@ -18,7 +18,7 @@ "serialport": "25-serial.js" } }, - "engines" : { "node" : ">=10.0.0" }, + "engines" : { "node" : ">=12.0.0" }, "author": { "name": "Dave Conway-Jones", "email": "ceejay@vnet.ibm.com",