Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
3fe34f53
Commit
3fe34f53
authored
Jun 20, 2018
by
Cristian Maglie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added USB id in boards manifest
parent
fc5cfcc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
arduino/cores/cores.go
arduino/cores/cores.go
+21
-1
arduino/cores/packageindex/index.go
arduino/cores/packageindex/index.go
+13
-2
No files found.
arduino/cores/cores.go
View file @
3fe34f53
...
...
@@ -31,6 +31,7 @@ package cores
import
(
"fmt"
"strings"
"github.com/arduino/go-paths-helper"
...
...
@@ -67,7 +68,26 @@ type PlatformRelease struct {
// BoardManifest contains information about a board. These metadata are usually
// provided by the package_index.json
type
BoardManifest
struct
{
Name
string
`json:"-"`
Name
string
`json:"-"`
ID
[]
*
BoardManifestID
`json:"-"`
}
// BoardManifestID contains information on how to identify a board. These metadata
// are usually provided by the package_index.json
type
BoardManifestID
struct
{
USB
string
`json:"-"`
}
// HasUsbID returns true if the BoardManifes contains the specified USB id as
// identification for this board. usbID should be in the format "0000:0000"
func
(
bm
*
BoardManifest
)
HasUsbID
(
vid
,
pid
string
)
bool
{
usbID
:=
strings
.
ToLower
(
vid
+
":"
+
pid
)
for
_
,
id
:=
range
bm
.
ID
{
if
usbID
==
strings
.
ToLower
(
id
.
USB
)
{
return
true
}
}
return
false
}
// ToolDependencies is a set of tool dependency
...
...
arduino/cores/packageindex/index.go
View file @
3fe34f53
...
...
@@ -94,7 +94,12 @@ type indexToolReleaseFlavour struct {
// indexBoard represents a single Board as written in package_index.json file.
type
indexBoard
struct
{
Name
string
`json:"name"`
Name
string
`json:"name"`
ID
[]
indexBoardID
`json:"id"`
}
type
indexBoardID
struct
{
USB
string
`json:"usb"`
}
type
indexHelp
struct
{
...
...
@@ -158,7 +163,13 @@ func (inPlatformRelease indexPlatformRelease) extractDeps() cores.ToolDependenci
func
(
inPlatformRelease
indexPlatformRelease
)
extractBoardsManifest
()
[]
*
cores
.
BoardManifest
{
boards
:=
make
([]
*
cores
.
BoardManifest
,
len
(
inPlatformRelease
.
Boards
))
for
i
,
board
:=
range
inPlatformRelease
.
Boards
{
boards
[
i
]
=
&
cores
.
BoardManifest
{
Name
:
board
.
Name
}
manifest
:=
&
cores
.
BoardManifest
{
Name
:
board
.
Name
}
for
_
,
id
:=
range
board
.
ID
{
if
id
.
USB
!=
""
{
manifest
.
ID
=
append
(
manifest
.
ID
,
&
cores
.
BoardManifestID
{
USB
:
id
.
USB
})
}
}
boards
[
i
]
=
manifest
}
return
boards
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment