Skip to content

Unexpected board+port selection change when board is disconnected #2143

Closed
@per1234

Description

@per1234

Describe the problem

The port that is currently selected in Arduino IDE may become no longer discoverable under normal operation for any of a number of reasons, including:

  • The user disconnected the board from their computer.
  • The user reset or power cycled the board.
  • The user uploaded a sketch to the board that disables the port.

Arduino IDE automatically switches to a different board and port selection when the currently selected port is no longer discoverable under the following conditions:

  • The user selected a different port at some time.
  • That previously selected port is identified as an Arduino board.
  • The previously selected port was selected using the "board selector" menu.

🐛 The automatic board+port switch might be unnoticed or unwanted by the user, which could result in any of the following:

  • Confusing compilation results due to compiling for a different board than was intended
  • Uploading to a different board than the user intended
  • User having to fight with the IDE to retain their intended board selection

To reproduce

Equipment

  • Any device that produces a port that is identified as an Arduino board. Any official Arduino board other than the classic Nano can be used.
    This will be referred to as "board A" from here on.
  • Any device that produces a port that can be made no longer discoverable.
    This will be referred to as "board B" from here on.

Demo

  1. Connect "board A" to your computer if it is not already.
  2. Select the board+port of "board A" from the dropdown "board selector" menu in the Arduino IDE toolbar.
    ❗You must use the board selector instead of the Tools > Port menu for this step.
  3. Connect "board B" to your computer if it is not already.
  4. Select the board of "board B" from the Tools > Board menu.
    It doesn't matter what you select from the menu, or even if you perform this step at all. It is included in the instructions in order to reflect the typical user journey.
  5. Select the port of "board B" from the Tools > Port menu.
    ❗You must use the Tools > Port menu instead of the board selector menu for this step.
  6. Disconnect "board B" from your computer.

🐛 The board+port selection unexpectedly reverts to that of "board A".

Expected behavior

The board selection made by the user is retained even after the currently selected port becomes no longer discoverable.

No port is selected in Arduino IDE after the currently selected port becomes no longer discoverable, but that port selection is restored if the port becomes discoverable again later. *

* NOTE: there is special handling of the selected port becoming no longer discoverable during an upload operation. The expectation above is about when the selected port becomes no longer discoverable during operational modes of the IDE other than the upload operation.

Arduino IDE version

f6a4325

Operating system

  • Windows
  • Linux
  • macOS

Operating system version

  • Windows 11
  • Ubuntu 22.04
  • macOS Ventura

Additional context

Related: #1319

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions