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:13 UTC

[mynewt-newtmgr] branch master updated (7ac2926 -> 9ff22a9)

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

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


    from 7ac2926  Merge pull request #3 from cwanda/conn_name
     new 726d9d5  ble_scanner - Protect adv rpt cb with mutex.
     new 9ff22a9  newtmgr - revendor

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 newtmgr/Godeps/Godeps.json                         | 64 +++++++++++-----------
 newtmgr/vendor/mynewt.apache.org/newt/util/util.go | 10 +++-
 .../newtmgr/nmxact/nmble/ble_scanner.go            | 33 +++++------
 nmxact/nmble/ble_scanner.go                        | 12 ++--
 4 files changed, 64 insertions(+), 55 deletions(-)

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

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

Posted by cc...@apache.org.
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>.

[mynewt-newtmgr] 01/02: ble_scanner - Protect adv rpt cb with mutex.

Posted by cc...@apache.org.
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 726d9d53b31bdf252adcc6109d2880092e038ff1
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Jul 11 16:24:38 2017 -0700

    ble_scanner - Protect adv rpt cb with mutex.
---
 nmxact/nmble/ble_scanner.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/nmxact/nmble/ble_scanner.go b/nmxact/nmble/ble_scanner.go
index 478f1dd..da8532c 100644
--- a/nmxact/nmble/ble_scanner.go
+++ b/nmxact/nmble/ble_scanner.go
@@ -54,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 {
@@ -191,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>.