Skip to content

Commit 0a055a6

Browse files
apply changes to search vidpid
1 parent 3c7bc1a commit 0a055a6

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

arduino/cores/packagemanager/package_manager.go

Lines changed: 3 additions & 3 deletions
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
}

commands/core/search.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/arduino/arduino-cli/arduino/utils"
2626
"github.com/arduino/arduino-cli/commands"
2727
"github.com/arduino/arduino-cli/commands/internal/instances"
28-
f "github.com/arduino/arduino-cli/internal/algorithms"
2928
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
3029
)
3130

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

0 commit comments

Comments
 (0)