Skip to content

Commit be141e5

Browse files
committed
Code updates to include more header info
1 parent d8c67d8 commit be141e5

File tree

17 files changed

+12427
-77
lines changed

17 files changed

+12427
-77
lines changed

cli/ota/decode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type decodeHeaderFlags struct {
3333
func initDecodeHeaderCommand() *cobra.Command {
3434
flags := &decodeHeaderFlags{}
3535
uploadCommand := &cobra.Command{
36-
Use: "decode",
36+
Use: "header-decode",
3737
Short: "OTA firmware header decoder",
3838
Long: "decode OTA firmware header of the given binary file",
3939
Run: func(cmd *cobra.Command, args []string) {

cli/ota/encode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type encodeBinaryFlags struct {
3535
func initEncodeBinaryCommand() *cobra.Command {
3636
flags := &encodeBinaryFlags{}
3737
uploadCommand := &cobra.Command{
38-
Use: "encode",
38+
Use: "header-encode",
3939
Short: "OTA firmware encoder",
4040
Long: "encode header firmware to make it compatible with Arduino OTA",
4141
Run: func(cmd *cobra.Command, args []string) {

command/ota/encode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func Encode(params *EncodeParams) (*string, error) {
3838
}
3939

4040
// Verify if file has already an OTA header
41-
header, _ := ota.DecodeOtaFirmwareHeader(params.File)
41+
header, _ := ota.DecodeOtaFirmwareHeaderFromFile(params.File)
4242
if header != nil {
4343
return nil, fmt.Errorf("file %s contains a valid OTA header. Skip header encoding", params.File)
4444
}

command/ota/generate.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
inota "github.com/arduino/arduino-cloud-cli/internal/ota"
2727
)
2828

29-
3029
// Generate takes a .bin file and generates a .ota file.
3130
func Generate(binFile string, outFile string, fqbn string) error {
3231

command/ota/massupload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func MassUpload(ctx context.Context, params *MassUploadParams, cred *config.Cred
6767

6868
if !params.DoNotApplyHeader {
6969
//Verify if file has already an OTA header
70-
header, _ := ota.DecodeOtaFirmwareHeader(params.File)
70+
header, _ := ota.DecodeOtaFirmwareHeaderFromFile(params.File)
7171
if header != nil {
7272
params.DoNotApplyHeader = true
7373
}

command/ota/readheader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func ReadHeader(params *ReadHeaderParams) error {
4747
}
4848

4949
// Verify if file has already an OTA header
50-
header, err := ota.DecodeOtaFirmwareHeader(params.File)
50+
header, err := ota.DecodeOtaFirmwareHeaderFromFile(params.File)
5151
if err != nil {
5252
return fmt.Errorf("file %s does not contains a valid OTA header: %v", params.File, err)
5353
}

command/ota/upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func Upload(ctx context.Context, params *UploadParams, cred *config.Credentials)
6464

6565
if !params.DoNotApplyHeader {
6666
//Verify if file has already an OTA header
67-
header, _ := ota.DecodeOtaFirmwareHeader(params.File)
67+
header, _ := ota.DecodeOtaFirmwareHeaderFromFile(params.File)
6868
if header != nil {
6969
params.DoNotApplyHeader = true
7070
}

coverage_unit.txt

Lines changed: 12138 additions & 0 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ require (
4343
github.com/golang/protobuf v1.5.3 // indirect
4444
github.com/h2non/filetype v1.1.3 // indirect
4545
github.com/hashicorp/hcl v1.0.0 // indirect
46+
github.com/icza/bitio v1.1.0 // indirect
4647
github.com/inconshreveable/mousetrap v1.0.0 // indirect
4748
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
4849
github.com/josharian/intern v1.0.0 // indirect

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6/go.mod h1:JslaLRrzGsO
285285
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
286286
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
287287
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
288+
github.com/icza/bitio v1.1.0 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0=
289+
github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A=
290+
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA=
288291
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
289292
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
290293
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=

0 commit comments

Comments
 (0)