Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnttecUSBDMXPRO driver: SerialPort "writable" property no longer exists? #80

Open
tracycollins opened this issue Mar 30, 2019 · 2 comments

Comments

@tracycollins
Copy link

In the sendUniverse method, it checks the "writable" property:

EnttecUSBDMXPRO.prototype.sendUniverse = function () {
  if (!this.dev.writable) {
    return;
  }

I think that it should be checking SerialPort.isOpen property instead? I can't find the writable property in the current SerialPort documentation: https://serialport.io/docs/en/api-stream

I found this while debugging a memory leak when testing an animation to be sure my app wouldn't crash if it couldn't find an Enttec device. If testing for 'writable', the driver will write to a non-existent serial port, leak memory, and eventually crash. When I changed the driver code to this, it seems to run ok:

EnttecUSBDMXPRO.prototype.sendUniverse = function () {
  if (!this.dev.isOpen) {
    return;
  }

@Fensterbank
Copy link
Member

Good catch, in the documentation of the serial port version 7.x.x we are using there is also no mention of writable.
isOpen exists since serialport 5.0.0 while this code was once created using serialport 4, so someone should make a pull request and fix this.

But I'm wondering: if writable would be undefined, the driver would not work at all... Is writable still implemented in the serialport codebase or how does this even work? o_O

@Granjow
Copy link

Granjow commented Mar 25, 2021

It is coming from the stream writable and still exists :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants