Skip to content

Commit 36db25a

Browse files
committed
fix the way to retrive serial number for network
1 parent 63e683d commit 36db25a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/board/board.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ func FromFQBN(ctx context.Context, fqbn string) ([]Board, error) {
182182
if len(port.GetMatchingBoards()) > 0 {
183183
boardName = port.GetMatchingBoards()[0].GetName()
184184
}
185-
serial := strings.ToLower(port.GetPort().GetHardwareId()) // in windows this is uppercase.
185+
186186
switch port.GetPort().GetProtocol() {
187187
case SerialProtocol:
188+
serial := strings.ToLower(port.GetPort().GetHardwareId()) // in windows this is uppercase.
188189
// TODO: we should store the board custom name in the product id so we can get it from the discovery service.
189190
var customName string
190191
if conn, err := adb.FromSerial(serial, ""); err == nil {
@@ -209,6 +210,10 @@ func FromFQBN(ctx context.Context, fqbn string) ([]Board, error) {
209210
}
210211
customName = name[:idx]
211212
}
213+
var serial string
214+
if sn, ok := port.GetPort().GetProperties()["serial_number"]; ok {
215+
serial = sn
216+
}
212217

213218
boards = append(boards, Board{
214219
Protocol: NetworkProtocol,

0 commit comments

Comments
 (0)