Skip to content
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

Upload port detector improvements #2288

Merged
merged 4 commits into from
Aug 31, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Aug 31, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

This patch takes into account the port connection/disconnection that may happen after the upload.
This case was already handled, but this patch slightly increased the timeout to allow the port re-enumeration.

I've added a fallback: if the algorithm is unable to find a port, it will return the user-provided port for the upload.

What is the current behavior?

No upload port detected:

./arduino-cli upload -b arduino:mbed_nano:nano33ble -p /dev/cu.usbmodem5 ~/Documents/Arduino/minimal --format json
{
  "stdout": "Device       : nRF52840-QIAA\nVersion      : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]\nAddress      : 0x0\nPages        : 256\nPage Size    : 4096 bytes\nTotal Size   : 1024KB\nPlanes       : 1\nLock Regions : 0\nLocked       : none\nSecurity     : false\nErase flash\n\nDone in 0.001 seconds\nWrite 84088 bytes to flash (21 pages)\n\r[                              ] 0% (0/21 pages)\r[=                             ] 4% (1/21 pages)\r[==                            ] 9% (2/21 pages)\r[====                          ] 14% (3/21 pages)\r[=====                         ] 19% (4/21 pages)\r[=======                       ] 23% (5/21 pages)\r[========                      ] 28% (6/21 pages)\r[==========                    ] 33% (7/21 pages)\r[===========                   ] 38% (8/21 pages)\r[============                  ] 42% (9/21 pages)\r[==============                ] 47% (10/21 pages)\r[===============               ] 52% (11/21 pages)\r[=================             ] 57% (12/21 pages)\r[==================            ] 61% (13/21 pages)\r[====================          ] 66% (14/21 pages)\r[=====================         ] 71% (15/21 pages)\r[======================        ] 76% (16/21 pages)\r[========================      ] 80% (17/21 pages)\r[=========================     ] 85% (18/21 pages)\r[===========================   ] 90% (19/21 pages)\r[============================  ] 95% (20/21 pages)\r[==============================] 100% (21/21 pages)\nDone in 3.335 seconds\n",
  "stderr": ""
}

See #2287 for details.

What is the new behavior?

It should always detect the port, BTW I'm unable to reproduce it so I'll wait for @kittaakos confirmation :-)

Does this PR introduce a breaking change, and is titled accordingly?

No

Other information

Fix #2287

…vided port

This will ensure that a port is always returned.
Even if `waitForUploadPort` is true, we should extend the timeout to
allow USB enumeration to complete. In this case we extend by only 1
second instead of 5.
@cmaglie cmaglie added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Aug 31, 2023
@cmaglie cmaglie self-assigned this Aug 31, 2023
@cmaglie cmaglie changed the base branch from master to 0.34.x August 31, 2023 08:54
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me. Thank you 🙏

./arduino-cli version                      
arduino-cli  Version: git-snapshot Commit: 7c77ed24 Date: 2023-08-31T08:53:35Z
cat ~/Documents/Arduino/minimal/minimal.ino
void setup() {}
void loop() {}
./arduino-cli compile -b arduino:mbed_nano:nano33ble ~/Documents/Arduino/minimal 
Sketch uses 84080 bytes (8%) of program storage space. Maximum is 983040 bytes.
Global variables use 43968 bytes (16%) of dynamic memory, leaving 218176 bytes for local variables. Maximum is 262144 bytes.

Used platform     Version Path                                                                      
arduino:mbed_nano 4.0.4   /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/4.0.4
./arduino-cli board list                                                        
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.BLTH                    serial   Serial Port       Unknown                                                          
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem2               serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano
./arduino-cli upload -b arduino:mbed_nano:nano33ble ~/Documents/Arduino/minimal -p /dev/cu.usbmodem2 --format json | jq .updated_upload_port
{
  "address": "/dev/cu.usbmodem2",
  "label": "/dev/cu.usbmodem2",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x805A",
    "serialNumber": "131B9378799A643D",
    "vid": "0x2341"
  },
  "hardware_id": "131B9378799A643D"
}
./arduino-cli board list                                                                                           
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.BLTH                    serial   Serial Port       Unknown                                                          
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem14201           serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano
./arduino-cli upload -b arduino:mbed_nano:nano33ble ~/Documents/Arduino/minimal -p /dev/cu.usbmodem14201 --format json | jq .updated_upload_port
{
  "address": "/dev/cu.usbmodem14201",
  "label": "/dev/cu.usbmodem14201",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x805A",
    "serialNumber": "131B9378799A643D",
    "vid": "0x2341"
  },
  "hardware_id": "131B9378799A643D"
}
./arduino-cli board list
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.BLTH                    serial   Serial Port       Unknown                                                          
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem14301           serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano
./arduino-cli upload -b arduino:mbed_nano:nano33ble ~/Documents/Arduino/minimal -p /dev/cu.usbmodem14301 --format json | jq .updated_upload_port
{
  "address": "/dev/cu.usbmodem14301",
  "label": "/dev/cu.usbmodem14301",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x805A",
    "serialNumber": "131B9378799A643D",
    "vid": "0x2341"
  },
  "hardware_id": "131B9378799A643D"
}
./arduino-cli board list
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.BLTH                    serial   Serial Port       Unknown                                                          
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem14401           serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano
./arduino-cli upload -b arduino:mbed_nano:nano33ble ~/Documents/Arduino/minimal -p /dev/cu.usbmodem14401 --format json | jq .updated_upload_port
{
  "address": "/dev/cu.usbmodem14401",
  "label": "/dev/cu.usbmodem14401",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x805A",
    "serialNumber": "131B9378799A643D",
    "vid": "0x2341"
  },
  "hardware_id": "131B9378799A643D"
}

@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Patch coverage: 33.33% and project coverage change: +0.11% 🎉

Comparison is base (304d48c) 62.98% compared to head (0ff1377) 63.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##           0.34.x    #2288      +/-   ##
==========================================
+ Coverage   62.98%   63.10%   +0.11%     
==========================================
  Files         221      221              
  Lines       19746    19747       +1     
==========================================
+ Hits        12438    12462      +24     
+ Misses       6206     6186      -20     
+ Partials     1102     1099       -3     
Flag Coverage Δ
unit 63.10% <33.33%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
commands/upload/upload.go 73.73% <33.33%> (-0.13%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kittaakos
Copy link
Contributor

Here is with the complete debug output:

./arduino-cli version
arduino-cli  Version: git-snapshot Commit: 7c77ed24 Date: 2023-08-31T08:53:35Z
./arduino-cli board list 
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.BLTH                    serial   Serial Port       Unknown                                                          
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem14201           serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano
./arduino-cli upload -b arduino:mbed_nano:nano33ble -p /dev/cu.usbmodem14201 ~/Documents/Arduino/minimal -v --log --log-level debug
INFO[0000] Config file not found, using default values  
INFO[0000] arduino-cli version git-snapshot             
INFO[0000] Executing `arduino-cli upload`               
INFO[0000] Checking signature                            index=/Users/a.kitta/Library/Arduino15/package_index.json signatureFile=/Users/a.kitta/Library/Arduino15/package_index.json.sig trusted=true
INFO[0000] Loading hardware from: /Users/a.kitta/Library/Arduino15/packages 
INFO[0000] Loading package Croduino_Boards from: /Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/hardware/Inkplate/1.0.1/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="Croduino_Boards:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/tools 
INFO[0000] Loaded tool                                   tool="Croduino_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Croduino_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Croduino_Boards:[email protected]"
INFO[0000] Loading package Inkplate_Boards from: /Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/hardware/esp32/3.0.1/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="Inkplate_Boards:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/tools 
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:riscv32-esp-elf-gcc@gcc8_4_0-esp-2021r2-patch3"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:xtensa-esp32-elf-gcc@gcc8_4_0-esp-2021r2-patch3"
INFO[0000] Loading package arduino from: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/esp32/2.0.11-debug/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/4.0.4/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.0.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.8/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_portenta/1.0.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.0.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/arduino/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/arduino/tools 
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loading package builtin from: /Users/a.kitta/Library/Arduino15/packages/builtin 
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/builtin/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/builtin/tools 
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loading package esp32 from: /Users/a.kitta/Library/Arduino15/packages/esp32/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="esp32:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/esp32/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/esp32/tools 
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]_20220823"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]_20220823"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loading package esp8266 from: /Users/a.kitta/Library/Arduino15/packages/esp8266/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="esp8266:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/esp8266/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/esp8266/tools 
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loading package rp2040 from: /Users/a.kitta/Library/Arduino15/packages/rp2040/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/rp2040/hardware/rp2040/3.2.2/installed.json
INFO[0000] Loaded platform                               platform="rp2040:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/rp2040/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/rp2040/tools 
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loading package teensy from: /Users/a.kitta/Library/Arduino15/packages/teensy/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/teensy/hardware/avr/1.57.0/installed.json
INFO[0000] Adding monitor tool                           protocol=teensy tool="teensy:teensy-monitor"
INFO[0000] Loaded platform                               platform="teensy:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/teensy/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/teensy/tools 
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loading hardware from: /Users/a.kitta/Documents/Arduino/hardware 
INFO[0000] Searching tools required for platform rp2040:[email protected] 
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
DEBU[0000] current best: Croduino_Boards:[email protected]  bundle=false managed=true version=1.0.1
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/hardware/Inkplate/1.0.1/libraries location=platform
DEBU[0000] current best: Inkplate_Boards:[email protected]     bundle=false managed=true version=3.0.1
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/hardware/esp32/3.0.1/libraries location=platform
DEBU[0000] current best: rp2040:[email protected]             bundle=false managed=true version=3.2.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/rp2040/hardware/rp2040/3.2.2/libraries location=platform
DEBU[0000] current best: arduino:[email protected]               bundle=false managed=true version=1.8.6
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries location=platform
DEBU[0000] current best: arduino:[email protected]           bundle=false managed=true version=1.8.8
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.8/libraries location=platform
DEBU[0000] current best: arduino:[email protected]             bundle=false managed=true version=1.8.13
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/libraries location=platform
DEBU[0000] current best: arduino:[email protected]      bundle=false managed=true version=2.0.11-debug
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/esp32/2.0.11-debug/libraries location=platform
DEBU[0000] current best: arduino:[email protected]  bundle=false managed=true version=1.0.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_portenta/1.0.2/libraries location=platform
DEBU[0000] current best: arduino:[email protected]       bundle=false managed=true version=1.0.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.0.2/libraries location=platform
DEBU[0000] current best: arduino:[email protected]         bundle=false managed=true version=4.0.4
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/4.0.4/libraries location=platform
DEBU[0000] current best: arduino:[email protected]     bundle=false managed=true version=4.0.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.0.2/libraries location=platform
DEBU[0000] current best: esp8266:[email protected]           bundle=false managed=true version=3.1.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries location=platform
DEBU[0000] current best: esp32:[email protected]              bundle=false managed=true version=2.0.11
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/libraries location=platform
DEBU[0000] current best: teensy:[email protected]               bundle=false managed=true version=1.57.0
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/teensy/hardware/avr/1.57.0/libraries location=platform
INFO[0000] Loading libraries index file                  index=/Users/a.kitta/Library/Arduino15/library_index.json
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Documents/Arduino/libraries location=user
INFO[0001] starting discovery rp2040 process            
INFO[0001] starting discovery builtin:dfu-discovery process 
INFO[0001] starting discovery builtin:mdns-discovery process 
INFO[0001] starting discovery teensy:teensy-discovery process 
INFO[0001] starting discovery builtin:serial-discovery process 
INFO[0001] started discovery rp2040 process             
INFO[0001] started discovery teensy:teensy-discovery process 
INFO[0001] started discovery builtin:mdns-discovery process 
INFO[0001] started discovery builtin:dfu-discovery process 
INFO[0001] sending command HELLO 1 "arduino-cli git-snapshot" to discovery rp2040 
INFO[0001] sending command HELLO 1 "arduino-cli git-snapshot" to discovery teensy:teensy-discovery 
INFO[0001] sending command HELLO 1 "arduino-cli git-snapshot" to discovery builtin:mdns-discovery 
INFO[0001] sending command HELLO 1 "arduino-cli git-snapshot" to discovery builtin:dfu-discovery 
INFO[0001] started discovery builtin:serial-discovery process 
INFO[0001] sending command HELLO 1 "arduino-cli git-snapshot" to discovery builtin:serial-discovery 
INFO[0001] from discovery builtin:mdns-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] from discovery teensy:teensy-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery teensy:teensy-discovery 
INFO[0001] sending command START_SYNC to discovery builtin:mdns-discovery 
INFO[0001] from discovery teensy:teensy-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery builtin:dfu-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] from discovery builtin:mdns-discovery received message type: start_sync, message: OK 
INFO[0001] sending command START_SYNC to discovery builtin:dfu-discovery 
INFO[0001] from discovery builtin:serial-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery builtin:serial-discovery 
INFO[0001] from discovery builtin:serial-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.BLTH 
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.Bluetooth-Incoming-Port 
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.usbmodem14201 
INFO[0001] from discovery builtin:dfu-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery rp2040 received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery rp2040 
INFO[0001] from discovery rp2040 received message type: start_sync, message: OK 
DEBU[0001] current best: arduino:[email protected]         bundle=false managed=true version=4.0.4
INFO[0001] Required tool                                 tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
DEBU[0001] current best: arduino:[email protected]         bundle=false managed=true version=4.0.4
INFO[0001] Required tool                                 tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
DEBU[0001] Detecting new board port after upload         task=port_detection
DEBU[0001] Ignored watcher event before upload           event="&{add /dev/cu.BLTH builtin:serial-discovery}" task=port_detection
DEBU[0001] Ignored watcher event before upload           event="&{add /dev/cu.Bluetooth-Incoming-Port builtin:serial-discovery}" task=port_detection
DEBU[0001] Ignored watcher event before upload           event="&{add /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
DEBU[0001] LAST: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14201:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14201:true /dev/tty.usbmodem14301:true]  phase="board reset"
DEBU[0001] TOUCH: /dev/cu.usbmodem14201                  phase="board reset"
INFO[0001] Performing 1200-bps touch reset on serial port /dev/cu.usbmodem14201  phase="board reset"
Performing 1200-bps touch reset on serial port /dev/cu.usbmodem14201
INFO[0001] from discovery builtin:serial-discovery received message type: remove, port: /dev/cu.usbmodem14201 
DEBU[0001] User-specified port has been disconnected, forcing wait for upload port  event="&{remove /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
INFO[0001] Waiting for upload port...                    phase="board reset"
Waiting for upload port...
DEBU[0001] WAIT: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14301:true]  phase="board reset"
DEBU[0001] WAIT: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14301:true]  phase="board reset"
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.usbmodem14201 
DEBU[0001] Ignored watcher event before upload           event="&{add /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
DEBU[0002] WAIT: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14201:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14201:true /dev/tty.usbmodem14301:true]  phase="board reset"
DEBU[0002] New ports found!                              phase="board reset"
DEBU[0003] CHECK: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14201:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14201:true /dev/tty.usbmodem14301:true]  phase="board reset"
INFO[0003] Upload port found on /dev/cu.usbmodem14201    phase="board reset"
Upload port found on /dev/cu.usbmodem14201
"/Users/a.kitta/Library/Arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac" -d --port=cu.usbmodem14201 -U -i -e -w "/private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino/sketches/A051B7F4F3A6DA790A80412CD0106F8D/minimal.ino.bin" -R
Set binary mode
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Connected at 921600 baud
identifyChip()=nRF52840-QIAA
write(addr=0,size=0x34)
writeWord(addr=0x30,value=0x400)
writeWord(addr=0x20,value=0)
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Device       : nRF52840-QIAA
Version      : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Address      : 0x0
Pages        : 256
Page Size    : 4096 bytes
Total Size   : 1024KB
Planes       : 1
Lock Regions : 0
Locked       : none
Security     : false
Erase flash
chipErase(addr=0)

Done in 0.001 seconds
Write 84088 bytes to flash (21 pages)
[                              ] 0% (0/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0, size=0x1000)
[=                             ] 4% (1/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x1000, size=0x1000)
[==                            ] 9% (2/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x2000, size=0x1000)
[====                          ] 14% (3/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x3000, size=0x1000)
[=====                         ] 19% (4/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x4000, size=0x1000)
[=======                       ] 23% (5/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x5000, size=0x1000)
[========                      ] 28% (6/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x6000, size=0x1000)
[==========                    ] 33% (7/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x7000, size=0x1000)
[===========                   ] 38% (8/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x8000, size=0x1000)
[============                  ] 42% (9/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x9000, size=0x1000)
[==============                ] 47% (10/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xa000, size=0x1000)
[===============               ] 52% (11/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xb000, size=0x1000)
[=================             ] 57% (12/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xc000, size=0x1000)
[==================            ] 61% (13/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xd000, size=0x1000)
[====================          ] 66% (14/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xe000, size=0x1000)
[=====================         ] 71% (15/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xf000, size=0x1000)
[======================        ] 76% (16/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x10000, size=0x1000)
[========================      ] 80% (17/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x11000, size=0x1000)
[=========================     ] 85% (18/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x12000, size=0x1000)
[===========================   ] 90% (19/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x13000, size=0x1000)
[============================  ] 95% (20/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x14000, size=0x1000)
[==============================] 100% (21/21 pages)
Done in 3.334 seconds
reset()
INFO[0007] from discovery builtin:serial-discovery received message type: remove, port: /dev/cu.usbmodem14201 
DEBU[0007] Ignored non-add event                         event="&{remove /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
INFO[0008] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.usbmodem14201 
DEBU[0008] Found new upload port candidate (prio=1110)   event="&{add /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
DEBU[0008] New candidate port match the desired HW ID, timeout reduced to 1 second.  task=port_detection
DEBU[0009] Timeout waiting for candidate port            selected_port=/dev/cu.usbmodem14201 task=port_detection
New upload port: /dev/cu.usbmodem14201 (serial)

@kittaakos
Copy link
Contributor

This is the trace output of Arduino CLI 0.34.0 when the UploadResponse does not contain the port.

a.kitta@Akoss-MacBook-Pro resources % ./arduino-cli board list
Port                            Protocol Type              Board Name          FQBN                        Core             
/dev/cu.BLTH                    serial   Serial Port       Unknown                                                          
/dev/cu.Bluetooth-Incoming-Port serial   Serial Port       Unknown                                                          
/dev/cu.usbmodem14201           serial   Serial Port (USB) Arduino Nano 33 BLE arduino:mbed_nano:nano33ble arduino:mbed_nano

a.kitta@Akoss-MacBook-Pro resources % ./arduino-cli upload -b arduino:mbed_nano:nano33ble ~/Documents/Arduino/minimal -p /dev/cu.usbmodem14201 -v --log --log-level trace 
INFO[0000] Config file not found, using default values  
INFO[0000] arduino-cli version 0.34.0                   
INFO[0000] Executing `arduino-cli upload`               
INFO[0000] Checking signature                            index=/Users/a.kitta/Library/Arduino15/package_index.json signatureFile=/Users/a.kitta/Library/Arduino15/package_index.json.sig trusted=true
INFO[0000] Loading hardware from: /Users/a.kitta/Library/Arduino15/packages 
INFO[0000] Loading package Croduino_Boards from: /Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/hardware/Inkplate/1.0.1/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="Croduino_Boards:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/tools 
INFO[0000] Loaded tool                                   tool="Croduino_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Croduino_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Croduino_Boards:[email protected]"
INFO[0000] Loading package Inkplate_Boards from: /Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/hardware/esp32/3.0.1/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="Inkplate_Boards:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/tools 
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:[email protected]"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:riscv32-esp-elf-gcc@gcc8_4_0-esp-2021r2-patch3"
INFO[0000] Loaded tool                                   tool="Inkplate_Boards:xtensa-esp32-elf-gcc@gcc8_4_0-esp-2021r2-patch3"
INFO[0000] Loading package arduino from: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/esp32/2.0.11-debug/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/4.0.4/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.0.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.8/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_portenta/1.0.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.0.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="arduino:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/arduino/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/arduino/tools 
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loaded tool                                   tool="arduino:[email protected]"
INFO[0000] Loading package builtin from: /Users/a.kitta/Library/Arduino15/packages/builtin 
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/builtin/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/builtin/tools 
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loaded tool                                   tool="builtin:[email protected]"
INFO[0000] Loading package esp32 from: /Users/a.kitta/Library/Arduino15/packages/esp32/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="esp32:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/esp32/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/esp32/tools 
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]_20220823"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]_20220823"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loaded tool                                   tool="esp32:[email protected]"
INFO[0000] Loading package esp8266 from: /Users/a.kitta/Library/Arduino15/packages/esp8266/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/installed.json
INFO[0000] Adding monitor tool                           protocol=serial tool="builtin:serial-monitor"
INFO[0000] Loaded platform                               platform="esp8266:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/esp8266/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/esp8266/tools 
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loaded tool                                   tool="esp8266:[email protected]"
INFO[0000] Loading package rp2040 from: /Users/a.kitta/Library/Arduino15/packages/rp2040/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/rp2040/hardware/rp2040/3.2.2/installed.json
INFO[0000] Loaded platform                               platform="rp2040:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/rp2040/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/rp2040/tools 
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loaded tool                                   tool="rp2040:[email protected]"
INFO[0000] Loading package teensy from: /Users/a.kitta/Library/Arduino15/packages/teensy/hardware 
INFO[0000] Missing signature file                        index=/Users/a.kitta/Library/Arduino15/packages/teensy/hardware/avr/1.57.0/installed.json
INFO[0000] Adding monitor tool                           protocol=teensy tool="teensy:teensy-monitor"
INFO[0000] Loaded platform                               platform="teensy:[email protected]"
INFO[0000] Checking existence of 'tools' path: /Users/a.kitta/Library/Arduino15/packages/teensy/tools 
INFO[0000] Loading tools from dir: /Users/a.kitta/Library/Arduino15/packages/teensy/tools 
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loaded tool                                   tool="teensy:[email protected]"
INFO[0000] Loading hardware from: /Users/a.kitta/Documents/Arduino/hardware 
INFO[0000] Searching tools required for platform rp2040:[email protected] 
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
INFO[0000] Required tool                                 tool="rp2040:[email protected]"
DEBU[0000] current best: teensy:[email protected]               bundle=false managed=true version=1.57.0
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/teensy/hardware/avr/1.57.0/libraries location=platform
DEBU[0000] current best: arduino:[email protected]             bundle=false managed=true version=1.8.13
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/samd/1.8.13/libraries location=platform
DEBU[0000] current best: arduino:[email protected]         bundle=false managed=true version=4.0.4
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/4.0.4/libraries location=platform
DEBU[0000] current best: arduino:[email protected]     bundle=false managed=true version=4.0.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.0.2/libraries location=platform
DEBU[0000] current best: arduino:[email protected]  bundle=false managed=true version=1.0.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_portenta/1.0.2/libraries location=platform
DEBU[0000] current best: arduino:[email protected]               bundle=false managed=true version=1.8.6
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries location=platform
DEBU[0000] current best: arduino:[email protected]       bundle=false managed=true version=1.0.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.0.2/libraries location=platform
DEBU[0000] current best: arduino:[email protected]           bundle=false managed=true version=1.8.8
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.8/libraries location=platform
DEBU[0000] current best: arduino:[email protected]      bundle=false managed=true version=2.0.11-debug
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/esp32/2.0.11-debug/libraries location=platform
DEBU[0000] current best: rp2040:[email protected]             bundle=false managed=true version=3.2.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/rp2040/hardware/rp2040/3.2.2/libraries location=platform
DEBU[0000] current best: esp32:[email protected]              bundle=false managed=true version=2.0.11
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/libraries location=platform
DEBU[0000] current best: Croduino_Boards:[email protected]  bundle=false managed=true version=1.0.1
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/Croduino_Boards/hardware/Inkplate/1.0.1/libraries location=platform
DEBU[0000] current best: Inkplate_Boards:[email protected]     bundle=false managed=true version=3.0.1
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/Inkplate_Boards/hardware/esp32/3.0.1/libraries location=platform
DEBU[0000] current best: esp8266:[email protected]           bundle=false managed=true version=3.1.2
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries location=platform
INFO[0000] Loading libraries index file                  index=/Users/a.kitta/Library/Arduino15/library_index.json
INFO[0000] Adding libraries dir                          dir=/Users/a.kitta/Documents/Arduino/libraries location=user
TRAC[0001] Upload port                                   port=/dev/cu.usbmodem14201
INFO[0001] starting discovery builtin:dfu-discovery process 
INFO[0001] starting discovery builtin:serial-discovery process 
INFO[0001] starting discovery teensy:teensy-discovery process 
INFO[0001] starting discovery rp2040 process            
INFO[0001] starting discovery builtin:mdns-discovery process 
INFO[0001] started discovery teensy:teensy-discovery process 
INFO[0001] started discovery builtin:serial-discovery process 
INFO[0001] started discovery builtin:dfu-discovery process 
INFO[0001] sending command HELLO 1 "arduino-cli 0.34.0" to discovery builtin:dfu-discovery 
INFO[0001] sending command HELLO 1 "arduino-cli 0.34.0" to discovery teensy:teensy-discovery 
INFO[0001] started discovery rp2040 process             
INFO[0001] sending command HELLO 1 "arduino-cli 0.34.0" to discovery builtin:serial-discovery 
INFO[0001] sending command HELLO 1 "arduino-cli 0.34.0" to discovery rp2040 
INFO[0001] started discovery builtin:mdns-discovery process 
INFO[0001] sending command HELLO 1 "arduino-cli 0.34.0" to discovery builtin:mdns-discovery 
INFO[0001] from discovery teensy:teensy-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] from discovery builtin:dfu-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery builtin:dfu-discovery 
INFO[0001] sending command START_SYNC to discovery teensy:teensy-discovery 
INFO[0001] from discovery teensy:teensy-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery builtin:serial-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery builtin:serial-discovery 
INFO[0001] from discovery builtin:serial-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.BLTH 
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.Bluetooth-Incoming-Port 
INFO[0001] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.usbmodem14201 
INFO[0001] from discovery builtin:mdns-discovery received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery builtin:mdns-discovery 
INFO[0001] from discovery builtin:mdns-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery builtin:dfu-discovery received message type: start_sync, message: OK 
INFO[0001] from discovery rp2040 received message type: hello, message: OK, protocol version: 1 
INFO[0001] sending command START_SYNC to discovery rp2040 
INFO[0001] from discovery rp2040 received message type: start_sync, message: OK 
DEBU[0001] current best: arduino:[email protected]         bundle=false managed=true version=4.0.4
INFO[0001] Required tool                                 tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
TRAC[0001] Upload /Users/a.kitta/Documents/Arduino/minimal on arduino:mbed_nano:nano33ble started 
TRAC[0001] Upload port                                   port=/dev/cu.usbmodem14201
TRAC[0001] Detected FQBN                                 fqbn="arduino:mbed_nano:nano33ble"
DEBU[0001] current best: arduino:[email protected]         bundle=false managed=true version=4.0.4
INFO[0001] Required tool                                 tool="arduino:arm-none-eabi-gcc@7-2017q4"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
INFO[0001] Required tool                                 tool="arduino:[email protected]"
TRAC[0001] Upload data                                   board="arduino:mbed_nano:nano33ble" boardPlatform="arduino:[email protected]" buildPlatform="arduino:[email protected]"
TRAC[0001] Upload tool                                   uploadToolID=bossac uploadToolPlatform="arduino:[email protected]"
TRAC[0001] Detecting new board port after upload         task=port_detection
TRAC[0001] Ignored watcher event before upload           event="&{add /dev/cu.BLTH builtin:serial-discovery}" task=port_detection
TRAC[0001] Ignored watcher event before upload           event="&{add /dev/cu.Bluetooth-Incoming-Port builtin:serial-discovery}" task=port_detection
TRAC[0001] Ignored watcher event before upload           event="&{add /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
DEBU[0001] LAST: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14201:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14201:true /dev/tty.usbmodem14301:true]  phase="board reset"
DEBU[0001] TOUCH: /dev/cu.usbmodem14201                  phase="board reset"
INFO[0001] Performing 1200-bps touch reset on serial port /dev/cu.usbmodem14201  phase="board reset"
Performing 1200-bps touch reset on serial port /dev/cu.usbmodem14201
INFO[0002] from discovery builtin:serial-discovery received message type: remove, port: /dev/cu.usbmodem14201 
TRAC[0002] User-specified port has been disconnected, forcing wait for upload port  event="&{remove /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
INFO[0002] Waiting for upload port...                    phase="board reset"
Waiting for upload port...
DEBU[0002] WAIT: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14301:true]  phase="board reset"
DEBU[0002] WAIT: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14301:true]  phase="board reset"
INFO[0002] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.usbmodem14201 
TRAC[0002] Ignored watcher event before upload           event="&{add /dev/cu.usbmodem14201 builtin:serial-discovery}" task=port_detection
DEBU[0002] WAIT: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14201:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14201:true /dev/tty.usbmodem14301:true]  phase="board reset"
DEBU[0002] New ports found!                              phase="board reset"
DEBU[0003] CHECK: map[/dev/cu.BLTH:true /dev/cu.Bluetooth-Incoming-Port:true /dev/cu.usbmodem14101:true /dev/cu.usbmodem14201:true /dev/cu.usbmodem14301:true /dev/tty.BLTH:true /dev/tty.Bluetooth-Incoming-Port:true /dev/tty.usbmodem14101:true /dev/tty.usbmodem14201:true /dev/tty.usbmodem14301:true]  phase="board reset"
INFO[0003] Upload port found on /dev/tty.usbmodem14201   phase="board reset"
Upload port found on /dev/tty.usbmodem14201
TRAC[0003] Executing upload tool: "/Users/a.kitta/Library/Arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac" -d --port=tty.usbmodem14201 -U -i -e -w "/private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino/sketches/A051B7F4F3A6DA790A80412CD0106F8D/minimal.ino.bin" -R  phase=upload
"/Users/a.kitta/Library/Arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac" -d --port=tty.usbmodem14201 -U -i -e -w "/private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino/sketches/A051B7F4F3A6DA790A80412CD0106F8D/minimal.ino.bin" -R
Set binary mode
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Connected at 921600 baud
identifyChip()=nRF52840-QIAA
write(addr=0,size=0x34)
writeWord(addr=0x30,value=0x400)
writeWord(addr=0x20,value=0)
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Device       : nRF52840-QIAA
Version      : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Address      : 0x0
Pages        : 256
Page Size    : 4096 bytes
Total Size   : 1024KB
Planes       : 1
Lock Regions : 0
Locked       : none
Security     : false
Erase flash
chipErase(addr=0)

Done in 0.001 seconds
Write 84088 bytes to flash (21 pages)
[                              ] 0% (0/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0, size=0x1000)
[=                             ] 4% (1/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x1000, size=0x1000)
[==                            ] 9% (2/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x2000, size=0x1000)
[====                          ] 14% (3/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x3000, size=0x1000)
[=====                         ] 19% (4/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x4000, size=0x1000)
[=======                       ] 23% (5/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x5000, size=0x1000)
[========                      ] 28% (6/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x6000, size=0x1000)
[==========                    ] 33% (7/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x7000, size=0x1000)
[===========                   ] 38% (8/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x8000, size=0x1000)
[============                  ] 42% (9/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x9000, size=0x1000)
[==============                ] 47% (10/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xa000, size=0x1000)
[===============               ] 52% (11/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xb000, size=0x1000)
[=================             ] 57% (12/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xc000, size=0x1000)
[==================            ] 61% (13/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xd000, size=0x1000)
[====================          ] 66% (14/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xe000, size=0x1000)
[=====================         ] 71% (15/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0xf000, size=0x1000)
[======================        ] 76% (16/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x10000, size=0x1000)
[========================      ] 80% (17/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x11000, size=0x1000)
[=========================     ] 85% (18/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x12000, size=0x1000)
[===========================   ] 90% (19/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x13000, size=0x1000)
[============================  ] 95% (20/21 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x14000, size=0x1000)
[==============================] 100% (21/21 pages)
Done in 3.326 seconds
reset()
TRAC[0007] Upload successful                            
TRAC[0012] Timeout waiting for candidate port            selected_port=none task=port_detection
a.kitta@Akoss-MacBook-Pro resources % ./arduino-cli board list

@cmaglie
Copy link
Member Author

cmaglie commented Aug 31, 2023

After chatting with @kittaakos we concluded that the latest commit is not necessary since the detector has already 5 seconds of timeout.

The original problem was that his board was not able to leave the "bootloader" mode if connected directly to the PC (without a USB hub in the middle). So I'm removing the last commit here because it's not needed.

This reverts commit 7c77ed2.

The latest commit is not necessary since the detector has already 5 seconds of timeout.
@cmaglie cmaglie merged commit 048415c into arduino:0.34.x Aug 31, 2023
89 checks passed
@cmaglie cmaglie deleted the port_detector_improvements branch August 31, 2023 10:50
@ardnew ardnew mentioned this pull request Sep 10, 2023
cmaglie added a commit that referenced this pull request Oct 17, 2023
* If the upload port-detector fails detection, fallback to the user-provided port

This will ensure that a port is always returned.

* Increased debug level

* Extend timeout if candidate port is lost in any case

Even if `waitForUploadPort` is true, we should extend the timeout to
allow USB enumeration to complete. In this case we extend by only 1
second instead of 5.

* Revert "Extend timeout if candidate port is lost in any case"

This reverts commit 7c77ed2.

The latest commit is not necessary since the detector has already 5 seconds of timeout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UploadResult#updated_upload_port might be missing from the UploadResponse
3 participants