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/08/24 19:12:25 UTC

[mynewt-newtmgr] branch master updated (af9174d -> 731ac4a)

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 af9174d  nmxact - Fix BLE race condition.
     new 16ec497  nmxact - Allow acked write reqs for CoAP services.
     new 99060ac  newtmgr - --write-rsp option to send acked req.
     new 731ac4a  newtmgr - revendor

The 3 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                         | 56 +++++++++++-----------
 newtmgr/bll/bll_sesn.go                            |  2 +-
 newtmgr/bll/bll_sesn_cfg.go                        |  2 +
 newtmgr/cli/commands.go                            |  3 ++
 newtmgr/config/ble_config.go                       |  2 +
 newtmgr/config/bll_config.go                       |  2 +
 newtmgr/nmutil/nmutil.go                           |  1 +
 .../newtmgr/nmxact/nmble/ble_sesn.go               | 12 ++++-
 .../newtmgr/nmxact/nmble/ble_util.go               |  6 ++-
 .../newtmgr/nmxact/nmble/listen.go                 |  5 +-
 .../newtmgr/nmxact/sesn/sesn_cfg.go                |  2 +
 nmxact/nmble/ble_sesn.go                           | 12 ++++-
 nmxact/nmble/ble_util.go                           |  6 ++-
 nmxact/sesn/sesn_cfg.go                            |  2 +
 14 files changed, 73 insertions(+), 40 deletions(-)

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

[mynewt-newtmgr] 02/03: newtmgr - --write-rsp option to send acked req.

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 99060ac9c78908649989e2eff185856de4320135
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Aug 24 12:11:08 2017 -0700

    newtmgr - --write-rsp option to send acked req.
---
 newtmgr/bll/bll_sesn.go      |  2 +-
 newtmgr/bll/bll_sesn_cfg.go  |  2 ++
 newtmgr/cli/commands.go      |  3 +++
 newtmgr/config/ble_config.go |  2 ++
 newtmgr/config/bll_config.go |  2 ++
 newtmgr/nmutil/nmutil.go     |  1 +
 nmxact/nmble/ble_sesn.go     | 12 ++++++++++--
 nmxact/sesn/sesn_cfg.go      |  2 ++
 8 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/newtmgr/bll/bll_sesn.go b/newtmgr/bll/bll_sesn.go
index 3ccdc6c..853db30 100644
--- a/newtmgr/bll/bll_sesn.go
+++ b/newtmgr/bll/bll_sesn.go
@@ -406,7 +406,7 @@ func (s *BllSesn) TxCoapOnce(m coap.Message, resType sesn.ResourceType,
 	}
 
 	txRaw := func(b []byte) error {
-		return s.txWriteCharacteristic(chr, b, true)
+		return s.txWriteCharacteristic(chr, b, !s.cfg.WriteRsp)
 	}
 
 	rsp, err := s.txvr.TxOic(txRaw, m, s.MtuOut(), opt.Timeout)
diff --git a/newtmgr/bll/bll_sesn_cfg.go b/newtmgr/bll/bll_sesn_cfg.go
index 36327cb..954c921 100644
--- a/newtmgr/bll/bll_sesn_cfg.go
+++ b/newtmgr/bll/bll_sesn_cfg.go
@@ -35,6 +35,7 @@ type BllSesnCfg struct {
 	PreferredMtu uint16
 	ConnTimeout  time.Duration
 	ConnTries    int
+	WriteRsp     bool
 }
 
 func NewBllSesnCfg() BllSesnCfg {
@@ -42,5 +43,6 @@ func NewBllSesnCfg() BllSesnCfg {
 		PreferredMtu: 512,
 		ConnTimeout:  10 * time.Second,
 		ConnTries:    3,
+		WriteRsp:     false,
 	}
 }
diff --git a/newtmgr/cli/commands.go b/newtmgr/cli/commands.go
index cde0416..0089573 100644
--- a/newtmgr/cli/commands.go
+++ b/newtmgr/cli/commands.go
@@ -68,6 +68,9 @@ func Commands() *cobra.Command {
 	nmCmd.PersistentFlags().StringVar(&nmutil.DeviceName, "name",
 		"", "name of target BLE device; overrides profile setting")
 
+	nmCmd.PersistentFlags().BoolVar(&nmutil.BleWriteRsp, "write-rsp", false,
+		"Send BLE acked write requests instead of unacked write commands")
+
 	nmCmd.AddCommand(crashCmd())
 	nmCmd.AddCommand(dateTimeCmd())
 	nmCmd.AddCommand(fsCmd())
diff --git a/newtmgr/config/ble_config.go b/newtmgr/config/ble_config.go
index 4d8bc35..f4875c3 100644
--- a/newtmgr/config/ble_config.go
+++ b/newtmgr/config/ble_config.go
@@ -141,6 +141,8 @@ func FillSesnCfg(bx *nmble.BleXport, bc *BleConfig, sc *sesn.SesnCfg) error {
 	// We don't need to stick around until a connection closes.
 	sc.Ble.CloseTimeout = 10000 * time.Millisecond
 
+	sc.Ble.WriteRsp = nmutil.BleWriteRsp
+
 	return nil
 }
 
diff --git a/newtmgr/config/bll_config.go b/newtmgr/config/bll_config.go
index c476a19..d0b995b 100644
--- a/newtmgr/config/bll_config.go
+++ b/newtmgr/config/bll_config.go
@@ -99,5 +99,7 @@ func BuildBllSesnCfg(bc *BllConfig) (bll.BllSesnCfg, error) {
 		return sc, util.NewNewtError("bll session lacks a peer specifier")
 	}
 
+	sc.WriteRsp = nmutil.BleWriteRsp
+
 	return sc, nil
 }
diff --git a/newtmgr/nmutil/nmutil.go b/newtmgr/nmutil/nmutil.go
index c0cb124..79e7ef6 100644
--- a/newtmgr/nmutil/nmutil.go
+++ b/newtmgr/nmutil/nmutil.go
@@ -31,6 +31,7 @@ var Timeout float64
 var Tries int
 var ConnProfile string
 var DeviceName string
+var BleWriteRsp bool
 
 func TxOptions() sesn.TxOptions {
 	return sesn.TxOptions{
diff --git a/nmxact/nmble/ble_sesn.go b/nmxact/nmble/ble_sesn.go
index ad990e4..a980141 100644
--- a/nmxact/nmble/ble_sesn.go
+++ b/nmxact/nmble/ble_sesn.go
@@ -365,7 +365,11 @@ func (s *BleSesn) TxNmpOnce(req *nmp.NmpMsg, opt sesn.TxOptions) (
 	}
 
 	txRaw := func(b []byte) error {
-		return s.conn.WriteChrNoRsp(chr, b, "nmp")
+		if s.cfg.Ble.WriteRsp {
+			return s.conn.WriteChr(chr, b, "nmp")
+		} else {
+			return s.conn.WriteChrNoRsp(chr, b, "nmp")
+		}
 	}
 
 	return s.txvr.TxNmp(txRaw, req, s.MtuOut(), opt.Timeout)
@@ -394,7 +398,11 @@ func (s *BleSesn) TxCoapOnce(m coap.Message,
 	}
 
 	txRaw := func(b []byte) error {
-		return s.conn.WriteChrNoRsp(chr, b, "coap")
+		if s.cfg.Ble.WriteRsp {
+			return s.conn.WriteChr(chr, b, "coap")
+		} else {
+			return s.conn.WriteChrNoRsp(chr, b, "coap")
+		}
 	}
 
 	rsp, err := s.txvr.TxOic(txRaw, m, s.MtuOut(), opt.Timeout)
diff --git a/nmxact/sesn/sesn_cfg.go b/nmxact/sesn/sesn_cfg.go
index c3e84f4..005dfa0 100644
--- a/nmxact/sesn/sesn_cfg.go
+++ b/nmxact/sesn/sesn_cfg.go
@@ -79,6 +79,7 @@ type SesnCfgBle struct {
 	OwnAddrType  bledefs.BleAddrType
 	EncryptWhen  bledefs.BleEncryptWhen
 	CloseTimeout time.Duration
+	WriteRsp     bool
 
 	// Central configuration.
 	Central SesnCfgBleCentral
@@ -102,6 +103,7 @@ func NewSesnCfg() SesnCfg {
 		Ble: SesnCfgBle{
 			OwnAddrType:  bledefs.BLE_ADDR_TYPE_RANDOM,
 			CloseTimeout: 30 * time.Second,
+			WriteRsp:     false,
 
 			Central: SesnCfgBleCentral{
 				ConnTries:   3,

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

[mynewt-newtmgr] 03/03: 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 731ac4ad83b08181dec6e1984b3b9968052452f0
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Aug 24 12:07:24 2017 -0700

    newtmgr - revendor
---
 newtmgr/Godeps/Godeps.json                         | 56 +++++++++++-----------
 .../newtmgr/nmxact/nmble/ble_sesn.go               | 12 ++++-
 .../newtmgr/nmxact/nmble/ble_util.go               |  6 ++-
 .../newtmgr/nmxact/nmble/listen.go                 |  5 +-
 .../newtmgr/nmxact/sesn/sesn_cfg.go                |  2 +
 5 files changed, 46 insertions(+), 35 deletions(-)

diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index 69a7c15..d01eb2b 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -127,73 +127,73 @@
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/adv",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/bledefs",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/mgmt",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmble",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmp",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmserial",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmxutil",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/oic",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/omp",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/scan",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/sesn",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/udp",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xact",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xport",
-			"Comment": "mynewt_1_1_0_tag-75-g5ec2cea",
-			"Rev": "5ec2ceaf4415cd3777179e2899c90f1be5bd8226"
+			"Comment": "mynewt_1_1_0_tag-79-ga684718",
+			"Rev": "a68471845fcfb4c77e72f222e0df663d89c70ba8"
 		}
 	]
 }
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go
index ad990e4..a980141 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go
@@ -365,7 +365,11 @@ func (s *BleSesn) TxNmpOnce(req *nmp.NmpMsg, opt sesn.TxOptions) (
 	}
 
 	txRaw := func(b []byte) error {
-		return s.conn.WriteChrNoRsp(chr, b, "nmp")
+		if s.cfg.Ble.WriteRsp {
+			return s.conn.WriteChr(chr, b, "nmp")
+		} else {
+			return s.conn.WriteChrNoRsp(chr, b, "nmp")
+		}
 	}
 
 	return s.txvr.TxNmp(txRaw, req, s.MtuOut(), opt.Timeout)
@@ -394,7 +398,11 @@ func (s *BleSesn) TxCoapOnce(m coap.Message,
 	}
 
 	txRaw := func(b []byte) error {
-		return s.conn.WriteChrNoRsp(chr, b, "coap")
+		if s.cfg.Ble.WriteRsp {
+			return s.conn.WriteChr(chr, b, "coap")
+		} else {
+			return s.conn.WriteChrNoRsp(chr, b, "coap")
+		}
 	}
 
 	rsp, err := s.txvr.TxOic(txRaw, m, s.MtuOut(), opt.Timeout)
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_util.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_util.go
index fa9d151..f31ca31 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_util.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_util.go
@@ -716,8 +716,10 @@ func GenCoapService(cfg CoapServiceCfg) (BleSvc, error) {
 		SvcType: BLE_SVC_TYPE_PRIMARY,
 		Chrs: []BleChr{
 			BleChr{
-				Uuid:       cfg.ReqChrUuid,
-				Flags:      BLE_GATT_F_WRITE_NO_RSP | secFlags,
+				Uuid: cfg.ReqChrUuid,
+				Flags: BLE_GATT_F_WRITE |
+					BLE_GATT_F_WRITE_NO_RSP |
+					secFlags,
 				MinKeySize: 0,
 				AccessCb: func(access BleGattAccess) (uint8, []byte) {
 					return svr.Rx(access), nil
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/listen.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/listen.go
index e1b35b6..19a1f2a 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/listen.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/listen.go
@@ -81,9 +81,8 @@ func (bl *Listener) AfterTimeout(tmo time.Duration) <-chan time.Time {
 func (bl *Listener) Close() {
 	// This provokes a race condition.  The timer may get initialized at any
 	// time.
-	if t := bl.timer; t != nil {
-		nmxutil.StopAndDrainTimer(t)
-		bl.timer = nil
+	if bl.timer != nil {
+		bl.timer.Stop()
 	}
 
 	// Mark the command as acked in case the race condition mentioned above
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/sesn/sesn_cfg.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/sesn/sesn_cfg.go
index c3e84f4..005dfa0 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/sesn/sesn_cfg.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/sesn/sesn_cfg.go
@@ -79,6 +79,7 @@ type SesnCfgBle struct {
 	OwnAddrType  bledefs.BleAddrType
 	EncryptWhen  bledefs.BleEncryptWhen
 	CloseTimeout time.Duration
+	WriteRsp     bool
 
 	// Central configuration.
 	Central SesnCfgBleCentral
@@ -102,6 +103,7 @@ func NewSesnCfg() SesnCfg {
 		Ble: SesnCfgBle{
 			OwnAddrType:  bledefs.BLE_ADDR_TYPE_RANDOM,
 			CloseTimeout: 30 * time.Second,
+			WriteRsp:     false,
 
 			Central: SesnCfgBleCentral{
 				ConnTries:   3,

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

[mynewt-newtmgr] 01/03: nmxact - Allow acked write reqs for CoAP services.

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 16ec49707f7a65c336fd61e967382299023f3d2b
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Aug 24 12:10:52 2017 -0700

    nmxact - Allow acked write reqs for CoAP services.
---
 nmxact/nmble/ble_util.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nmxact/nmble/ble_util.go b/nmxact/nmble/ble_util.go
index fa9d151..f31ca31 100644
--- a/nmxact/nmble/ble_util.go
+++ b/nmxact/nmble/ble_util.go
@@ -716,8 +716,10 @@ func GenCoapService(cfg CoapServiceCfg) (BleSvc, error) {
 		SvcType: BLE_SVC_TYPE_PRIMARY,
 		Chrs: []BleChr{
 			BleChr{
-				Uuid:       cfg.ReqChrUuid,
-				Flags:      BLE_GATT_F_WRITE_NO_RSP | secFlags,
+				Uuid: cfg.ReqChrUuid,
+				Flags: BLE_GATT_F_WRITE |
+					BLE_GATT_F_WRITE_NO_RSP |
+					secFlags,
 				MinKeySize: 0,
 				AccessCb: func(access BleGattAccess) (uint8, []byte) {
 					return svr.Rx(access), nil

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