Skip to content

Serial.list() doesn't update items after a port gets disconnected #1258

@redbeard122

Description

@redbeard122

Issue description

if conncted to a port say "COM5". if "COM5" is disconncted for any reason, the serial.list() will still show that "COM5" exists even if connction is stopped using serial.stop() after getting "COM5" device disconncted.

again, if conncted to port "COM5" for instance, if connection is stopped using serial.stop() and then if "COM5" device is disconnceted, serial.list() will then update its element and "COM5" isn't there anymore. which is a normal behavior.

test code to varify this issue

import processing.serial.*;
 Serial comPort;

void setup() {
  size(500, 400);
  surface.setTitle("TEST");    
  comPort = new Serial(this, "COM5", 115200);
  background(150);
  frameRate(60);
}

void draw() {
  background(150);  
  println(Serial.list().length);  
}

check for number of serial ports exists first and then try disconncting the device
Serial.list().length will still show that port was not removed...

URL(s) of affected page(s)

Proposed fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions