@@ -27,6 +27,7 @@ import (
2727 "github.com/arduino/arduino-cli/commands"
2828 rpc "github.com/arduino/arduino-cli/rpc/commands"
2929 "github.com/pkg/errors"
30+ "github.com/sirupsen/logrus"
3031)
3132
3233var (
@@ -87,11 +88,6 @@ func List(instanceID int32) ([]*rpc.DetectedPort, error) {
8788 return nil , errors .Wrap (err , "unable to instance serial-discovery" )
8889 }
8990
90- if err := serialDiscovery .Start (); err != nil {
91- return nil , errors .Wrap (err , "unable to start serial-discovery" )
92- }
93- defer serialDiscovery .Close ()
94-
9591 ports , err := serialDiscovery .List ()
9692 if err != nil {
9793 return nil , errors .Wrap (err , "error getting port list from serial-discovery" )
@@ -102,6 +98,7 @@ func List(instanceID int32) ([]*rpc.DetectedPort, error) {
10298 b := []* rpc.BoardListItem {}
10399
104100 // first query installed cores through the Package Manager
101+ logrus .Debug ("Querying installed cores for board identification..." )
105102 for _ , board := range pm .IdentifyBoard (port .IdentificationPrefs ) {
106103 b = append (b , & rpc.BoardListItem {
107104 Name : board .Name (),
@@ -112,12 +109,14 @@ func List(instanceID int32) ([]*rpc.DetectedPort, error) {
112109 // if installed cores didn't recognize the board, try querying
113110 // the builder API
114111 if len (b ) == 0 {
112+ logrus .Debug ("Querying builder API for board identification..." )
115113 url := fmt .Sprintf ("https://builder.arduino.cc/v3/boards/byVidPid/%s/%s" ,
116114 port .IdentificationPrefs .Get ("vid" ),
117115 port .IdentificationPrefs .Get ("pid" ))
118116 items , err := apiByVidPid (url )
119117 if err == ErrNotFound {
120118 // the board couldn't be detected, keep going with the next port
119+ logrus .Debug ("Board not recognized" )
121120 continue
122121 } else if err != nil {
123122 // this is bad, bail out
0 commit comments