Commit ec5c3ed1 authored by Roberto Sora's avatar Roberto Sora Committed by rsora

Fix serial port URI parsing in board attach command (#661)

parent ad9d5f6f
...@@ -112,7 +112,10 @@ func Attach(ctx context.Context, req *rpc.BoardAttachReq, taskCB commands.TaskPr ...@@ -112,7 +112,10 @@ func Attach(ctx context.Context, req *rpc.BoardAttachReq, taskCB commands.TaskPr
// for the matching. // for the matching.
func findSerialConnectedBoard(pm *packagemanager.PackageManager, monitor *discovery.Monitor, deviceURI *url.URL) *cores.Board { func findSerialConnectedBoard(pm *packagemanager.PackageManager, monitor *discovery.Monitor, deviceURI *url.URL) *cores.Board {
found := false 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 var serialDevice discovery.SerialDevice
for _, device := range monitor.Serial() { for _, device := range monitor.Serial() {
if device.Port == location { if device.Port == location {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment