Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3871cae

Browse filesBrowse files
committed
1 parent 3df8397 commit 3871cae
Copy full SHA for 3871cae

File tree

Expand file treeCollapse file tree

4 files changed

+24
-6
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+24
-6
lines changed

‎cli/certificates/flash.go

Copy file name to clipboardExpand all lines: cli/certificates/flash.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func flashCertificatesWithPlugin(uploader *plugin.FwUploader, certificateURLs, c
153153
return nil, err
154154
}
155155

156-
_, err = uploader.FlashCertificates(commonFlags.Address, commonFlags.Fqbn, certsBundle, stdout, stderr)
156+
_, err = uploader.FlashCertificates(commonFlags.Address, commonFlags.Fqbn, globals.LogLevel, globals.Verbose, certsBundle, stdout, stderr)
157157
return &flasher.FlashResult{
158158
Flasher: &flasher.ExecOutput{
159159
Stdout: stdoutBuffer.String(),

‎cli/firmware/flash.go

Copy file name to clipboardExpand all lines: cli/firmware/flash.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func updateFirmwareWithPlugin(uploader *plugin.FwUploader, fwPath *paths.Path) (
171171
stdout = os.Stdout
172172
stderr = os.Stderr
173173
}
174-
res, err := uploader.FlashFirmware(commonFlags.Address, commonFlags.Fqbn, fwPath, stdout, stderr)
174+
res, err := uploader.FlashFirmware(commonFlags.Address, commonFlags.Fqbn, globals.LogLevel, globals.Verbose, fwPath, stdout, stderr)
175175
if err != nil {
176176
return nil, fmt.Errorf("couldn't update firmware: %s", err)
177177
}

‎cli/firmware/getversion.go

Copy file name to clipboardExpand all lines: cli/firmware/getversion.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func getVersionWithPlugin(uploader *plugin.FwUploader) *flasher.FlashResult {
8989
stdout = os.Stdout
9090
stderr = os.Stderr
9191
}
92-
res, err := uploader.GetFirmwareVersion(commonFlags.Address, commonFlags.Fqbn, stdout, stderr)
92+
res, err := uploader.GetFirmwareVersion(commonFlags.Address, commonFlags.Fqbn, globals.LogLevel, globals.Verbose, stdout, stderr)
9393
if err != nil {
9494
feedback.Fatal(fmt.Sprintf("Couldn't get firmware version: %s", err), feedback.ErrGeneric)
9595
}

‎plugin/plugin.go

Copy file name to clipboardExpand all lines: plugin/plugin.go
+21-3Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,20 @@ func (uploader *FwUploader) QueryAPIVersion() (int, error) {
8484
}
8585

8686
// GetFirmwareVersion runs the plugin to obtain the version of the installed firmware
87-
func (uploader *FwUploader) GetFirmwareVersion(portAddress, fqbn string, stdout, stderr io.Writer) (*GetFirmwareVersionResult, error) {
87+
func (uploader *FwUploader) GetFirmwareVersion(portAddress, fqbn, LogLevel string, verbose bool, stdout, stderr io.Writer) (*GetFirmwareVersionResult, error) {
8888
args := []string{"firmware", "get-version"}
8989
if portAddress != "" {
9090
args = append(args, "-p", portAddress)
9191
}
9292
if fqbn != "" {
9393
args = append(args, "-b", fqbn)
9494
}
95+
if verbose {
96+
args = append(args, "-v")
97+
}
98+
if LogLevel != "" {
99+
args = append(args, "--log-level", LogLevel)
100+
}
95101
execStdout, execStderr, execErr := uploader.exec(stdout, stderr, args...)
96102

97103
res := &GetFirmwareVersionResult{
@@ -129,14 +135,20 @@ type GetFirmwareVersionResult struct {
129135
}
130136

131137
// FlashFirmware runs the plugin to flash the selected firmware
132-
func (uploader *FwUploader) FlashFirmware(portAddress, fqbn string, firmwarePath *paths.Path, stdout, stderr io.Writer) (*FlashFirmwareResult, error) {
138+
func (uploader *FwUploader) FlashFirmware(portAddress, fqbn, LogLevel string, verbose bool, firmwarePath *paths.Path, stdout, stderr io.Writer) (*FlashFirmwareResult, error) {
133139
args := []string{"firmware", "flash", firmwarePath.String()}
134140
if portAddress != "" {
135141
args = append(args, "-p", portAddress)
136142
}
137143
if fqbn != "" {
138144
args = append(args, "-b", fqbn)
139145
}
146+
if verbose {
147+
args = append(args, "-v")
148+
}
149+
if LogLevel != "" {
150+
args = append(args, "--log-level", LogLevel)
151+
}
140152
execStdout, execStderr, execErr := uploader.exec(stdout, stderr, args...)
141153

142154
res := &FlashFirmwareResult{
@@ -192,14 +204,20 @@ func (uploader *FwUploader) exec(stdout, stderr io.Writer, args ...string) (*byt
192204
}
193205

194206
// FlashCertificates writes the given certificates bundle in PEM format.
195-
func (uploader *FwUploader) FlashCertificates(portAddress, fqbn string, certsPath *paths.Path, stdout, stderr io.Writer) (*FlashCertificatesResult, error) {
207+
func (uploader *FwUploader) FlashCertificates(portAddress, fqbn, LogLevel string, verbose bool, certsPath *paths.Path, stdout, stderr io.Writer) (*FlashCertificatesResult, error) {
196208
args := []string{"cert", "flash", certsPath.String()}
197209
if portAddress != "" {
198210
args = append(args, "-p", portAddress)
199211
}
200212
if fqbn != "" {
201213
args = append(args, "-b", fqbn)
202214
}
215+
if verbose {
216+
args = append(args, "-v")
217+
}
218+
if LogLevel != "" {
219+
args = append(args, "--log-level", LogLevel)
220+
}
203221
execStdout, execStderr, execErr := uploader.exec(stdout, stderr, args...)
204222

205223
res := &FlashCertificatesResult{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.