Skip to content

Commit dcab980

Browse files
authored
Add board vid and pid in board list json output (#1076)
1 parent bacc2ac commit dcab980

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

Diff for: commands/board/list.go

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ func apiByVidPid(vid, pid string) ([]*rpc.BoardListItem, error) {
8989
retVal = append(retVal, &rpc.BoardListItem{
9090
Name: name,
9191
FQBN: fqbn,
92+
VID: vid,
93+
PID: pid,
9294
})
9395
} else {
9496
return nil, errors.Wrap(err, "error querying Arduino Cloud Api")
@@ -118,6 +120,8 @@ func identify(pm *packagemanager.PackageManager, port *commands.BoardPort) ([]*r
118120
boards = append(boards, &rpc.BoardListItem{
119121
Name: board.Name(),
120122
FQBN: board.FQBN(),
123+
VID: port.IdentificationPrefs.Get("vid"),
124+
PID: port.IdentificationPrefs.Get("pid"),
121125
})
122126
}
123127

Diff for: commands/board/list_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func TestGetByVidPid(t *testing.T) {
5353
require.Len(t, res, 1)
5454
require.Equal(t, "Arduino/Genuino MKR1000", res[0].Name)
5555
require.Equal(t, "arduino:samd:mkr1000", res[0].FQBN)
56+
require.Equal(t, "0xf420", res[0].VID)
57+
require.Equal(t, "0XF069", res[0].PID)
5658

5759
// wrong vid (too long), wrong pid (not an hex value)
5860
res, err = apiByVidPid("0xfffff", "0xDEFG")

Diff for: rpc/commands/board.pb.go

+25-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: rpc/commands/board.proto

+4
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,8 @@ message BoardListItem {
231231
string FQBN = 2;
232232
// If the board is marked as "hidden" in the platform
233233
bool is_hidden = 3;
234+
// Vendor ID
235+
string VID = 4;
236+
// Product ID
237+
string PID = 5;
234238
}

0 commit comments

Comments
 (0)