openframeworks / openframeworks/openFrameworks
ofSerial doesn't find devices plugged in after the program has started
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
OF v0.11.0
OF v0.11.2
Visual Studio 2017
Windows 10
Arduino Due
If the Arduino USB cable is unplugged before running the program, and serial.getDeviceList() is used, it assigns a device ID to any available/connected devices in numerical order e.g. if there are 3 devices available, it assigns 0, 1, 2 to the devices. If the Arduino USB cable is now plugged in while the program is running and serial.getDeviceList() is used again, the new device ID list becomes 0, 1, 2, 0. Instead of detecting the newly connected device, it is repeating the first device twice.
An example output from a modified serial example which recreates the issue is as follows:
- Arduino is disconnected and the OF program is started and key pressed to detect serial devices:
serial device found:
Intel(R) Active Management Technology - SOL (COM3) ID: 0 Port: COM3
serial device found:
Standard Serial over Bluetooth link (COM9) ID: 1 Port: COM9
serial device found:
Standard Serial over Bluetooth link (COM8) ID: 2 Port: COM8
- Arduino is connected while the OF program is still running and key pressed to detect serial devices:
serial device found:
Intel(R) Active Management Technology - SOL (COM3) ID: 0 Port: COM3
serial device found:
Standard Serial over Bluetooth link (COM9) ID: 1 Port: COM9
serial device found:
Standard Serial over Bluetooth link (COM8) ID: 2 Port: COM8
serial device found:
Intel(R) Active Management Technology - SOL (COM3) ID: 0 Port: COM3
I should note that if I run the program with the Arduino connected as follows, everything works fine:
- Arduino is connected and the OF program is started and key pressed to detect serial devices:
serial device found:
Intel(R) Active Management Technology - SOL (COM3) ID: 0 Port: COM3
serial device found:
Standard Serial over Bluetooth link (COM9) ID: 1 Port: COM9
serial device found:
Standard Serial over Bluetooth link (COM8) ID: 2 Port: COM8
serial device found:
Arduino Due (COM7) ID: 3 Port: COM7
The same correct output above is obtained even if Arduino is disconnected and reconnected while the OF program is still running and a key is pressed to detect serial devices.
I have posted the source code that I used to generate the above output here:
https://forum.openframeworks.cc/t/ofserial-doesnt-find-devices-plugged-in-after-the-program-has-started/37799
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at serial.getDeviceList() and the modified serial example linked in the issue, then reproduce the Windows 10 case by unplugging and reconnecting the Arduino while the program runs. Done means a subsequent device scan lists the newly connected Arduino with its own device ID instead of repeating the first device.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, cpp
- Domain
- embedded-iot, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100