-
-
Notifications
You must be signed in to change notification settings - Fork 489
fix: show board info based on the selected port #1803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE: Fixed by 43283ba
- identified port
- unidentified port
- native port
An example of all three is shown here:
$ arduino-cli board list --format json
[
{
"port": {
"address": "/dev/ttyUSB0",
"label": "/dev/ttyUSB0",
"protocol": "serial",
"protocol_label": "Serial Port (USB)",
"properties": {
"pid": "0x6001",
"serialNumber": "AB0P8H9K",
"vid": "0x0403"
}
}
},
{
"matching_boards": [
{
"name": "Arduino Uno",
"fqbn": "arduino:avr:uno"
}
],
"port": {
"address": "/dev/ttyACM0",
"label": "/dev/ttyACM0",
"protocol": "serial",
"protocol_label": "Serial Port (USB)",
"properties": {
"pid": "0x0043",
"serialNumber": "95032303537351D0F001",
"vid": "0x2341"
}
}
},
{
"port": {
"address": "/dev/ttyS4",
"label": "/dev/ttyS4",
"protocol": "serial",
"protocol_label": "Serial Port"
}
}
]
Identified
/dev/ttyACM0
is an identified port:
Arduino IDE 1.x
Arduino IDE 2.x
🙂 Arduino IDE 2.x behavior matches 1.x
Unidentified
/dev/ttyUSB0
is an unidentified port (it is a classic Nano, which uses the manufacturer provided VID/PID pair of its general purpose FTDI FT232RL USB chip, and thus can't be identified as a specific board):
Arduino IDE 1.x
Arduino IDE 2.x
🐛 Arduino IDE 2.x behavior does not match 1.x
The behavior of the current PR code is problematic for two reasons:
- It is incorrect to call
/dev/ttyUSB0
a "native port". - It makes it so the VID and PID (which is valuable information for support/troubleshooting) can not be determined.
Native
/dev/ttyS4
is a native port:
Arduino IDE 1.x
Arduino IDE 2.x
(削除ここまで)(削除) 🙂 Arduino IDE 2.x behavior matches 1.x
(削除ここまで)
Thank you for the review, Per.
I pushed the requested changes. Please review.
I have a few questions and remarks:
- I do not have a classic Nano board; hence I could not reproduce the behavior with an attached board.
- I mocked the
board list --watch format json
response of the CLI based on yourboard list
output, and it works like this in IDE2 from the PR:
Screen Shot 2023年01月09日 at 08 58 05 - How can any client of the CLI distinguish between serial and native serial ports:
{ "port": { "address": "/dev/ttyUSB0", "label": "/dev/ttyUSB0", "protocol": "serial", "protocol_label": "Serial Port (USB)", "properties": { "pid": "0x6001", "serialNumber": "AB0P8H9K", "vid": "0x0403" } } }
{ "port": { "address": "/dev/ttyS4", "label": "/dev/ttyS4", "protocol": "serial", "protocol_label": "Serial Port" } }
- Currently, IDE2 shows an unknown board for a port if the
protocol
is'serial'
and thematching_boards
is not empty or'vid'
and'pid'
is available from theport#properties
. Is this the correct approach? - For the unidentified board, the SN is available:
AB0P8H9K
. Is this correct to show:"Upload any sketch to obtain it."
? Thanks
I have a few questions
- How can any client of the CLI distinguish between serial and native serial ports:
- Is this correct to show:
"Upload any sketch to obtain it."
?
IDE2 will consider a port a non-serial if:
- The
port
protocol
is'serial'
, AND - The VID+PID is available from
port#properties
From @cmaglie:
- before USB, the Serial ports were embedded in the PC. You'll get COM1 and COM2 usually, and you connected them using a 9 pin D-SUB connector this is what the IDE Java calls "native" port, because it's something that is embedded in the PC. It doesn't have any USB VID/PID, so nothing can be told about what you connect to that port
image (3) - so fact 1. if you don't have VID/PID than it's a "native" port
- after some times the USB standard got traction and the old serial ports have been replaced by USB-2-serial converters: you had these cables where one side was USB and the other was 9-pin D-SUB. Actually the USB connection was converted to Serial, but in this case the USB VID/PID are fixed, and are those of the chip mounted on the cable. This is the case where that Per calls "unidentified". you have VID/PID but it's the VID/PID of the "converter"
- finally, we got the modern microcontrollers that have direct USB connection, so they can "emulate" an USB-2-serial cable... in this case each microcontoller can send arbitrary VID/PID, because there is no more the real convert cable, it's emulated, so each board can have his unique VID/PID. This is what Per calls "identified" port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE: resolved
It seems to me that the only requirement now is for a port to be selected, since the information is gathered from the port and the board definition is not used at all.
To reproduce
- Select File > Quit from the Arduino IDE menus if it is running
- Rename or delete (:warning: cautiously) the following folder to produce the condition of not having a board selected:
- Windows:
C:\Users\<user name>\AppData\Roaming\arduino-ide
- Linux:
~/.config/arduino-ide
- macOS:
~/Library/Application Support/arduino-ide
- Windows:
- Start Arduino IDE.
- Select a port from the Tools > Port menu in Arduino IDE.
- Select Tools > Get Board Info from the Arduino IDE menus.
🐛 An inappropriate notification is shown:
(削除ここまで)Please select a board to obtain board info.
(削除) 🐛 The "Board Info" dialog does not open.
(削除ここまで)
arduino-ide-extension/src/browser/contributions/board-selection.ts
Outdated
Show resolved
Hide resolved
arduino-ide-extension/src/browser/contributions/board-selection.ts
Outdated
Show resolved
Hide resolved
43283ba
to
d77cf46
Compare
Could you please take another look, Per?
d77cf46
to
5dcc498
Compare
5dcc498
to
868fa07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Akos!
Motivation
As requested in #1435, IDE2 shows the board info based on the
Tools
>Port
and notTools
>Board
.This PR makes the board's serial number (SN) available via the board details.
Change description
Expected behavioral change:
Network port, can't obtain info.
message when a network port is selected.Native serial port, can't obtain info.
message when nomatching_boards
can be found for the currently selected port. For example, I installed the core for ESP8266MOD, compiled against theNodeMCU 0.9 (ESP-12 Module)
board on the/dev/cu.usbserial-0001
serial
port, compile upload works, but as this board is not recognized as thematching_boards
of a port (board list --format json
), it cannot show the details.Examples:
1435_01.mp4
1435_02.mp4
Locally discovered boards for the examples:
Other information
Closes #1489
Closes #1435
Reviewer checklist