node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

U-blox on windows closes after connection

Open slavaGanzin opened this issue 1 year ago • 1 comments

SerialPort Version

10.5.0

Node Version

No response

Electron Version

No response

Platform

No response

Architecture

No response

Hardware or chipset of serialport

No response

What steps will reproduce the bug?

const {SerialPort, ReadlineParser } = require('serialport')
const port = new SerialPort({path: 'COM4', baudRate: 9600});

port.on('data', x => console.log(String(x)))

What happens?

I have a u-blox GPS on COM4. It eventually send a empty packages on start. And @serialport/stream thinks that it need to terminate connection. While it make sense, it silently closes connection without describing reason to.

What should have happened?

I think there should be an option to not terminate connection if data is empty, something like {closeOnEmptyPackages: false}

Additional information

Tried to make a PR, but couldn't compile.

✖  @serialport/list:build
       > @serialport/[email protected] build
       > tsc --build tsconfig-build.json
       
       lib/index.ts(4,10): error TS2305: Module '"commander"' has no exported member 'program'.
       lib/index.ts(8,77): error TS2339: Property 'choices' does not exist on type 'Option'.
       
    ✔  @serialport/parser-readline:build (2s)

    ✖  @serialport/terminal:build
       > @serialport/[email protected] build
       > tsc --build tsconfig-build.json
       
       lib/index.ts(3,22): error TS2307: Cannot find module 'enquirer' or its corresponding type declarations.
       lib/index.ts(4,10): error TS2305: Module '"commander"' has no exported member 'program'.
       

slavaGanzin avatar Apr 21 '23 11:04 slavaGanzin

Adding a link to https://github.com/serialport/node-serialport/issues/1690 for visibility, as it seems to be related

GazHank avatar Jun 27 '23 12:06 GazHank