Skip to content

Commit 8b54899

Browse files
Change GetPort's returned type to rpc.Port
1 parent b007e7c commit 8b54899

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Diff for: internal/cli/arguments/fqbn.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ func CalculateFQBNAndPort(portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance,
8989
if err != nil {
9090
feedback.Fatal(tr("Error getting port metadata: %v", err), feedback.ErrGeneric)
9191
}
92-
return fqbn, port.ToRPC()
92+
return fqbn, port
9393
}

Diff for: internal/cli/arguments/port.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"time"
2121

2222
"github.com/arduino/arduino-cli/arduino"
23-
"github.com/arduino/arduino-cli/arduino/discovery"
2423
"github.com/arduino/arduino-cli/commands"
2524
"github.com/arduino/arduino-cli/commands/board"
2625
"github.com/arduino/arduino-cli/internal/cli/feedback"
@@ -70,8 +69,7 @@ func (p *Port) GetPortAddressAndProtocol(instance *rpc.Instance, defaultAddress,
7069

7170
// GetPort returns the Port obtained by parsing command line arguments.
7271
// The extra metadata for the ports is obtained using the pluggable discoveries.
73-
func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol string) (*discovery.Port, error) {
74-
// TODO: REMOVE discovery from here (use board.List instead)
72+
func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol string) (*rpc.Port, error) {
7573

7674
address := p.address
7775
protocol := p.protocol
@@ -84,7 +82,7 @@ func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol s
8482
// the attached board without specifying explictly a port.
8583
// Tools that work this way must be specified using the property
8684
// "BOARD_ID.upload.tool.default" in the platform's boards.txt.
87-
return &discovery.Port{
85+
return &rpc.Port{
8886
Protocol: "default",
8987
}, nil
9088
}
@@ -113,13 +111,13 @@ func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol s
113111
}
114112
port := portEvent.Port
115113
if (protocol == "" || protocol == port.Protocol) && address == port.Address {
116-
return port, nil
114+
return port.ToRPC(), nil
117115
}
118116

119117
case <-deadline:
120118
// No matching port found
121119
if protocol == "" {
122-
return &discovery.Port{
120+
return &rpc.Port{
123121
Address: address,
124122
Protocol: "serial",
125123
}, nil

Diff for: internal/cli/burnbootloader/burnbootloader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func runBootloaderCommand(command *cobra.Command, args []string) {
7676
if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderRequest{
7777
Instance: instance,
7878
Fqbn: fqbn.String(),
79-
Port: discoveryPort.ToRPC(),
79+
Port: discoveryPort,
8080
Verbose: verbose,
8181
Verify: verify,
8282
Programmer: programmer.String(),

0 commit comments

Comments
 (0)