You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by pa...@apache.org on 2016/08/24 23:02:41 UTC

incubator-mynewt-newt git commit: Revert "add a split image command to newtmgr"

Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop d82d6bfaa -> 428b16e06


Revert "add a split image command to newtmgr"

This reverts commit d82d6bfaa4dd8b257c43b9c2a68448b5aad4074c.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/428b16e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/428b16e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/428b16e0

Branch: refs/heads/develop
Commit: 428b16e0686403946711ca769c8beb7c69d1d228
Parents: d82d6bf
Author: Paul Dietrich <pa...@yahoo.com>
Authored: Wed Aug 24 16:02:08 2016 -0700
Committer: Paul Dietrich <pa...@yahoo.com>
Committed: Wed Aug 24 16:02:08 2016 -0700

----------------------------------------------------------------------
 newtmgr/cli/image.go           |  62 ----------------------
 newtmgr/protocol/imagelist.go  |   1 -
 newtmgr/protocol/imagesplit.go | 102 ------------------------------------
 3 files changed, 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/428b16e0/newtmgr/cli/image.go
----------------------------------------------------------------------
diff --git a/newtmgr/cli/image.go b/newtmgr/cli/image.go
index 9565a96..69fa922 100644
--- a/newtmgr/cli/image.go
+++ b/newtmgr/cli/image.go
@@ -25,7 +25,6 @@ import (
 	"io"
 	"io/ioutil"
 	"os"
-	"strconv"
 	"time"
 
 	"mynewt.apache.org/newt/newtmgr/config"
@@ -629,55 +628,6 @@ func coreEraseCmd(cmd *cobra.Command, args []string) {
 	}
 }
 
-func splitCmd(cmd *cobra.Command, args []string) {
-	runner, err := getTargetCmdRunner()
-	if err != nil {
-		nmUsage(cmd, err)
-	}
-	defer runner.Conn.Close()
-
-	split, err := protocol.NewSplit()
-	if err != nil {
-		nmUsage(cmd, err)
-	}
-	var nmr *protocol.NmgrReq
-	if len(args) == 0 {
-		nmr, err = split.EncoderReadRequest()
-	} else if len(args) == 1 {
-		b, err := strconv.ParseBool(args[0])
-
-		if err != nil {
-			nmUsage(cmd, util.NewNewtError("Invalid Boolean Argument"))
-		}
-		split.Split = b
-		nmr, err = split.EncoderWriteRequest()
-	} else {
-		nmUsage(cmd, nil)
-		return
-	}
-
-	if err := runner.WriteReq(nmr); err != nil {
-		nmUsage(cmd, err)
-	}
-
-	rsp, err := runner.ReadResp()
-	if err != nil {
-		nmUsage(cmd, err)
-	}
-
-	srsp, err := protocol.DecodeSplitReadResponse(rsp.Data)
-	if err != nil {
-		nmUsage(cmd, err)
-	}
-
-	if len(args) == 0 {
-		fmt.Printf("Split value is %v\n", srsp.Split)
-	}
-	if srsp.ReturnCode != 0 {
-		fmt.Printf("Error executing split command: rc=%d\n", srsp.ReturnCode)
-	}
-}
-
 func imageCmd() *cobra.Command {
 	imageCmd := &cobra.Command{
 		Use:   "image",
@@ -788,17 +738,5 @@ func imageCmd() *cobra.Command {
 	}
 	imageCmd.AddCommand(coreEraseCmd)
 
-	splitEx := "  newtmgr -c olimex image split 1\n"
-	splitEx += "  newtmgr -c olimex image split 0\n"
-	splitEx += "  newtmgr -c olimex image split\n"
-
-	splitCmd := &cobra.Command{
-		Use:     "split",
-		Short:   "Erase core on target",
-		Example: splitEx,
-		Run:     splitCmd,
-	}
-	imageCmd.AddCommand(splitCmd)
-
 	return imageCmd
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/428b16e0/newtmgr/protocol/imagelist.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/imagelist.go b/newtmgr/protocol/imagelist.go
index 18b5f03..8f4fe8b 100644
--- a/newtmgr/protocol/imagelist.go
+++ b/newtmgr/protocol/imagelist.go
@@ -41,7 +41,6 @@ const (
 	IMGMGR_NMGR_OP_BOOT2    = 5
 	IMGMGR_NMGR_OP_CORELIST = 6
 	IMGMGR_NMGR_OP_CORELOAD = 7
-	IMGMGR_NMGR_OP_SPLITAPP = 8
 )
 
 func HashDecode(src string) (string, error) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/428b16e0/newtmgr/protocol/imagesplit.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/imagesplit.go b/newtmgr/protocol/imagesplit.go
deleted file mode 100644
index 0386b2a..0000000
--- a/newtmgr/protocol/imagesplit.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package protocol
-
-import (
-	"encoding/json"
-	"fmt"
-
-	"mynewt.apache.org/newt/util"
-)
-
-type Split struct {
-	Split      bool
-	ReturnCode int `json:"rc"`
-}
-
-func NewSplit() (*Split, error) {
-	s := &Split{}
-	return s, nil
-}
-
-func (s *Split) EncoderReadRequest() (*NmgrReq, error) {
-	msg := "{}"
-
-	data := []byte(msg)
-
-	nmr, err := NewNmgrReq()
-	if err != nil {
-		return nil, err
-	}
-
-	nmr.Op = NMGR_OP_READ
-	nmr.Flags = 0
-	nmr.Group = NMGR_GROUP_ID_IMAGE
-	nmr.Id = IMGMGR_NMGR_OP_SPLITAPP
-	nmr.Len = uint16(len(data))
-	nmr.Data = data
-
-	return nmr, nil
-}
-
-func (s *Split) EncoderWriteRequest() (*NmgrReq, error) {
-	msg := "{\"split\": "
-	if s.Split {
-		msg += "true"
-	} else {
-		msg += "false"
-	}
-	msg += "}"
-
-	data := []byte(msg)
-
-	nmr, err := NewNmgrReq()
-	if err != nil {
-		return nil, err
-	}
-
-	nmr.Op = NMGR_OP_WRITE
-	nmr.Flags = 0
-	nmr.Group = NMGR_GROUP_ID_IMAGE
-	nmr.Id = IMGMGR_NMGR_OP_SPLITAPP
-	nmr.Len = uint16(len(data))
-	nmr.Data = data
-
-	return nmr, nil
-}
-
-func DecodeSplitReadResponse(data []byte) (*Split, error) {
-	i := &Split{}
-
-	if len(data) == 0 {
-		return i, nil
-	}
-
-	err := json.Unmarshal(data, &i)
-	if err != nil {
-		return nil, util.NewNewtError(fmt.Sprintf("Invalid incoming json: %s",
-			err.Error()))
-	}
-	if i.ReturnCode != 0 {
-		return nil, util.NewNewtError(fmt.Sprintf("Target error: %d",
-			i.ReturnCode))
-	}
-	return i, nil
-}