Skip to content

Add serial number of connected board to board details command #1216

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

Merged
merged 2 commits into from
Mar 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli/board/list.go
Original file line number Diff line number Diff line change
@@ -109,6 +109,7 @@ func watchList(cmd *cobra.Command, inst *rpc.Instance) {
Protocol: event.Port.Protocol,
ProtocolLabel: event.Port.ProtocolLabel,
Boards: event.Port.Boards,
SerialNumber: event.Port.SerialNumber,
Error: event.Error,
})
}
@@ -181,6 +182,7 @@ type watchEvent struct {
Protocol string `json:"protocol,omitempty"`
ProtocolLabel string `json:"protocol_label,omitempty"`
Boards []*rpc.BoardListItem `json:"boards,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
Error string `json:"error,omitempty"`
}

7 changes: 7 additions & 0 deletions commands/board/list.go
Original file line number Diff line number Diff line change
@@ -185,6 +185,7 @@ func List(instanceID int32) (r []*rpc.DetectedPort, e error) {
Protocol: port.Protocol,
ProtocolLabel: port.ProtocolLabel,
Boards: boards,
SerialNumber: port.Prefs.Get("serialNumber"),
}
retVal = append(retVal, p)
}
@@ -222,13 +223,19 @@ func Watch(instanceID int32, interrupt <-chan bool) (<-chan *rpc.BoardListWatchR
}
}

serialNumber := ""
if props := event.Port.Properties; props != nil {
serialNumber = props.Get("serialNumber")
}

outChan <- &rpc.BoardListWatchResp{
EventType: event.Type,
Port: &rpc.DetectedPort{
Address: event.Port.Address,
Protocol: event.Port.Protocol,
ProtocolLabel: event.Port.ProtocolLabel,
Boards: boards,
SerialNumber: serialNumber,
},
Error: boardsError,
}
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -285,6 +285,7 @@ golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
353 changes: 188 additions & 165 deletions rpc/commands/board.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions rpc/commands/board.proto
Original file line number Diff line number Diff line change
@@ -59,6 +59,8 @@ message BoardDetailsResp {
repeated Programmer programmers = 13;
// Set to true if the board supports debugging
bool debugging_supported = 14;
// If a board with the specified FQBN is connected returns its serial number too
string serialNumber = 15;
}

message IdentificationPref {
@@ -192,6 +194,8 @@ message DetectedPort {
string protocol_label = 3;
// The boards attached to the port.
repeated BoardListItem boards = 4;
// Serial number of connected board
string serial_number = 5;
}

message BoardListAllReq {