You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/07/11 23:39:15 UTC

[mynewt-newtmgr] 02/02: newtmgr - revendor

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git

commit 9ff22a90556525ab78d01f3b13b13555e24a1c91
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Jul 11 16:29:36 2017 -0700

    newtmgr - revendor
---
 newtmgr/Godeps/Godeps.json                         | 64 +++++++++++-----------
 newtmgr/vendor/mynewt.apache.org/newt/util/util.go | 10 +++-
 .../newtmgr/nmxact/nmble/ble_scanner.go            | 33 +++++------
 3 files changed, 57 insertions(+), 50 deletions(-)

diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index cba07db..374bf44 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -106,83 +106,83 @@
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newt/util",
-			"Comment": "mynewt_1_0_1_tag-3-g90ec8e3",
-			"Rev": "90ec8e3772eaf622b5d98f6bf71531a87dcbc853"
+			"Comment": "mynewt_1_0_1_tag-9-g1b9a1e2",
+			"Rev": "1b9a1e240963929f714c8a0e771fab0528aa0389"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newt/util/unixchild",
-			"Comment": "mynewt_1_0_1_tag-3-g90ec8e3",
-			"Rev": "90ec8e3772eaf622b5d98f6bf71531a87dcbc853"
+			"Comment": "mynewt_1_0_1_tag-9-g1b9a1e2",
+			"Rev": "1b9a1e240963929f714c8a0e771fab0528aa0389"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newt/viper",
-			"Comment": "mynewt_1_0_1_tag-3-g90ec8e3",
-			"Rev": "90ec8e3772eaf622b5d98f6bf71531a87dcbc853"
+			"Comment": "mynewt_1_0_1_tag-9-g1b9a1e2",
+			"Rev": "1b9a1e240963929f714c8a0e771fab0528aa0389"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newt/yaml",
-			"Comment": "mynewt_1_0_1_tag-3-g90ec8e3",
-			"Rev": "90ec8e3772eaf622b5d98f6bf71531a87dcbc853"
+			"Comment": "mynewt_1_0_1_tag-9-g1b9a1e2",
+			"Rev": "1b9a1e240963929f714c8a0e771fab0528aa0389"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/bledefs",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmble",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmp",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmserial",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmxutil",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/oic",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/omp",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/scan",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/sesn",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/udp",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xact",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xport",
-			"Comment": "mynewt_0_9_0_tag-526-ge20e599",
-			"Rev": "e20e599f956cb7caf13eebf41e6f572284339439"
+			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
+			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
 		}
 	]
 }
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/util/util.go b/newtmgr/vendor/mynewt.apache.org/newt/util/util.go
index 3e144e6..cc56e8a 100644
--- a/newtmgr/vendor/mynewt.apache.org/newt/util/util.go
+++ b/newtmgr/vendor/mynewt.apache.org/newt/util/util.go
@@ -42,6 +42,7 @@ import (
 )
 
 var Verbosity int
+var PrintShellCmds bool
 var logFile *os.File
 
 func ParseEqualsPair(v string) (string, string, error) {
@@ -247,6 +248,7 @@ func Init(logLevel log.Level, logFile string, verbosity int) error {
 	}
 
 	Verbosity = verbosity
+	PrintShellCmds = false
 
 	return nil
 }
@@ -291,6 +293,10 @@ func ShellCommandLimitDbgOutput(
 	}
 	log.Debugf("%s%s", envLogStr, strings.Join(cmdStrs, " "))
 
+	if PrintShellCmds {
+		StatusMessage(VERBOSITY_SILENT, "%s\n", strings.Join(cmdStrs, " "))
+	}
+
 	name := cmdStrs[0]
 	args := cmdStrs[1:]
 	cmd := exec.Command(name, args...)
@@ -452,7 +458,7 @@ func MoveFile(srcFile string, destFile string) error {
 	}
 
 	if err := os.RemoveAll(srcFile); err != nil {
-		return err
+		return ChildNewtError(err)
 	}
 
 	return nil
@@ -464,7 +470,7 @@ func MoveDir(srcDir string, destDir string) error {
 	}
 
 	if err := os.RemoveAll(srcDir); err != nil {
-		return err
+		return ChildNewtError(err)
 	}
 
 	return nil
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_scanner.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_scanner.go
index 1214f04..da8532c 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_scanner.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_scanner.go
@@ -11,6 +11,7 @@ import (
 	"mynewt.apache.org/newtmgr/nmxact/nmxutil"
 	"mynewt.apache.org/newtmgr/nmxact/scan"
 	"mynewt.apache.org/newtmgr/nmxact/sesn"
+	"mynewt.apache.org/newtmgr/nmxact/xact"
 )
 
 // Implements scan.Scanner.
@@ -53,8 +54,12 @@ func (s *BleScanner) discover() (*BleDev, error) {
 	var dev *BleDev
 	advRptCb := func(r BleAdvReport) {
 		if s.cfg.Ble.ScanPred(r) {
+			s.mtx.Lock()
+
 			dev = &r.Sender
 			s.discoverer.Stop()
+
+			s.mtx.Unlock()
 		}
 	}
 	if err := s.discoverer.Start(advRptCb); err != nil {
@@ -83,22 +88,20 @@ func (s *BleScanner) connect(dev BleDev) error {
 }
 
 func (s *BleScanner) readHwId() (string, error) {
-	rsp, err := sesn.GetResource(s.bos, "/mynewt/hwid", sesn.NewTxOptions())
-	if err != nil {
-		return "", err
-	}
+	c := xact.NewConfigReadCmd()
+	c.Name = "id/hwid"
 
-	m, err := nmxutil.DecodeCborMap(rsp)
+	res, err := c.Run(s.bos)
 	if err != nil {
 		return "", err
 	}
-
-	hwid, ok := m["hwid"].(string)
-	if !ok {
-		return "", fmt.Errorf("device reports invalid hwid: %#v", hwid)
+	if res.Status() != 0 {
+		return "",
+			fmt.Errorf("failed to read hardware ID; NMP status=%discoverer",
+				res.Status())
 	}
-
-	return hwid, nil
+	cres := res.(*xact.ConfigReadResult)
+	return cres.Rsp.Val, nil
 }
 
 func (s *BleScanner) scan() (*scan.ScanPeer, error) {
@@ -192,21 +195,19 @@ func (s *BleScanner) Stop() error {
 	s.enabled = false
 
 	s.mtx.Lock()
+	defer s.mtx.Unlock()
 
 	discoverer := s.discoverer
-	s.discoverer = nil
-
 	bos := s.bos
-	s.bos = nil
-
-	s.mtx.Unlock()
 
 	if discoverer != nil {
 		discoverer.Stop()
+		s.discoverer = nil
 	}
 
 	if bos != nil {
 		bos.Close()
+		s.bos = nil
 	}
 
 	return nil

-- 
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.