Skip to content

Commit

Permalink
Fix serial port URI parsing in board attach command (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Sora committed Apr 16, 2020
1 parent ad9d5f6 commit ec5c3ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion commands/board/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ func Attach(ctx context.Context, req *rpc.BoardAttachReq, taskCB commands.TaskPr
// for the matching.
func findSerialConnectedBoard(pm *packagemanager.PackageManager, monitor *discovery.Monitor, deviceURI *url.URL) *cores.Board {
found := false
location := deviceURI.Path
// to support both cases:
// serial:///dev/ttyACM2 parsing gives: deviceURI.Host = "" and deviceURI.Path = /dev/ttyACM2
// serial://COM3 parsing gives: deviceURI.Host = "COM3" and deviceURI.Path = ""
location := deviceURI.Host + deviceURI.Path
var serialDevice discovery.SerialDevice
for _, device := range monitor.Serial() {
if device.Port == location {
Expand Down

0 comments on commit ec5c3ed

Please sign in to comment.