processing-docs icon indicating copy to clipboard operation
processing-docs copied to clipboard

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

Open redbeard122 opened this issue 4 years ago • 0 comments

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

redbeard122 avatar Jul 07 '21 17:07 redbeard122