processing / processing/processing4

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

Open
#1,258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
494
Forks
183
Avg merge
4h 39m
Merged PRs (30d)
3

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided Processing sketch and the Serial.list() entry point while disconnecting COM5 during an active connection. Trace how the serial library discovers and refreshes ports; done means Serial.list() no longer includes a disconnected port without requiring serial.stop().

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.