Skip to content

Commit 418cee3

Browse files
alessio-peruginicmaglie
authored andcommitted
apply changes to search vidpid
1 parent 4d1a337 commit 418cee3

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Diff for: arduino/cores/packagemanager/package_manager.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ func (pme *Explorer) GetCustomGlobalProperties() *properties.Map {
192192
}
193193

194194
// FindPlatformReleaseProvidingBoardsWithVidPid FIXMEDOC
195-
func (pme *Explorer) FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid string) []*cores.PlatformRelease {
196-
res := []*cores.PlatformRelease{}
195+
func (pme *Explorer) FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid string) []*cores.Platform {
196+
res := []*cores.Platform{}
197197
for _, targetPackage := range pme.packages {
198198
for _, targetPlatform := range targetPackage.Platforms {
199199
platformRelease := targetPlatform.GetLatestRelease()
@@ -202,7 +202,7 @@ func (pme *Explorer) FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid strin
202202
}
203203
for _, boardManifest := range platformRelease.BoardsManifest {
204204
if boardManifest.HasUsbID(vid, pid) {
205-
res = append(res, platformRelease)
205+
res = append(res, targetPlatform)
206206
break
207207
}
208208
}

Diff for: commands/core/search.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"github.com/arduino/arduino-cli/arduino/cores"
2525
"github.com/arduino/arduino-cli/arduino/utils"
2626
"github.com/arduino/arduino-cli/commands"
27-
f "github.com/arduino/arduino-cli/internal/algorithms"
2827
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2928
)
3029

@@ -39,11 +38,7 @@ func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse
3938
res := []*cores.Platform{}
4039
if isUsb, _ := regexp.MatchString("[0-9a-f]{4}:[0-9a-f]{4}", req.SearchArgs); isUsb {
4140
vid, pid := req.SearchArgs[:4], req.SearchArgs[5:]
42-
// TODO: De-duplicate return Platforms
43-
// TODO: Inline FindPlatformReleaseProvidingBoardsWithVidPid
44-
res = f.Map(pme.FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid), func(x *cores.PlatformRelease) *cores.Platform {
45-
return x.Platform
46-
})
41+
res = pme.FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid)
4742
} else {
4843
searchArgs := utils.SearchTermsFromQueryString(req.SearchArgs)
4944
for _, targetPackage := range pme.GetPackages() {

0 commit comments

Comments
 (0)