From e852bd7825305f9f349bcea2e6eb143c170cdc34 Mon Sep 17 00:00:00 2001 From: Delta Date: Sat, 22 May 2021 23:32:35 -0700 Subject: [PATCH 1/2] Fixed Issue 5 --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c112985..c5b875a 100755 --- a/index.js +++ b/index.js @@ -38,13 +38,13 @@ function fromSignedInt8(byte) { //Get A List Of Serial Ports: exports.ports = (cb) => { - Serial.list((err, ports) => { cb(err?[]:ports); }); + Serial.list().then(ports => cb(ports), err => cb([])); } //Asks you to select a serial port: exports.prompt = (cb) => { //List available ports in command line: - Serial.list((err, ports) => { + Serial.list().then(ports => { console.log(chalk.yellow("--------- Available Ports ---------")); for(let i=0; i < ports.length; i++) { let commString = "["+(i+1)+"] "+ports[i].comName; From a9d1dc21b9557075ec0aa3e9244bf8893efdf92f Mon Sep 17 00:00:00 2001 From: Delta Date: Fri, 4 Jun 2021 22:02:24 -0700 Subject: [PATCH 2/2] Addressed PortInfo.comName deprication message --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index c5b875a..f107b1b 100755 --- a/index.js +++ b/index.js @@ -47,7 +47,7 @@ exports.prompt = (cb) => { Serial.list().then(ports => { console.log(chalk.yellow("--------- Available Ports ---------")); for(let i=0; i < ports.length; i++) { - let commString = "["+(i+1)+"] "+ports[i].comName; + let commString = "["+(i+1)+"] "+ports[i].path; if(ports[i].manufacturer) commString += (", Brand = '"+ports[i].manufacturer+"'"); console.log(commString); } @@ -56,9 +56,9 @@ exports.prompt = (cb) => { //Wait for user input: function onPortSelectInput(port) { port=port.replace(/\n/g, "").replace(/\r/g, ""); let portExists=0; - for(let i=0; i < ports.length; i++) if(port == ports[i].comName) { portExists=1; break; } + for(let i=0; i < ports.length; i++) if(port == ports[i].path) { portExists=1; break; } if(!portExists && Number(port) && ports[Number(port)-1]) { - port = ports[Number(port)-1].comName; portExists=1; + port = ports[Number(port)-1].path; portExists=1; } if(portExists) { console.log(chalk.bgGreen.black("Listening on port \""+port+"\"")+"\n");