Repository: incubator-mynewt-newtmgr Updated Branches: refs/heads/master b6629b106 -> 41cf27469
newtmgr - Allow ble name on cmdline. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/34c5eb87 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/34c5eb87 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/34c5eb87 Branch: refs/heads/master Commit: 34c5eb878ee6d3ea7456608244c0cb2cafa4faa1 Parents: b6629b1 Author: Christopher Collins <[email protected]> Authored: Wed Apr 12 11:20:13 2017 -0700 Committer: Christopher Collins <[email protected]> Committed: Wed Apr 12 11:20:13 2017 -0700 ---------------------------------------------------------------------- newtmgr/cli/commands.go | 3 +++ newtmgr/config/ble_config.go | 5 +++++ newtmgr/nmutil/nmutil.go | 1 + 3 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/34c5eb87/newtmgr/cli/commands.go ---------------------------------------------------------------------- diff --git a/newtmgr/cli/commands.go b/newtmgr/cli/commands.go index 72f4999..45eab81 100644 --- a/newtmgr/cli/commands.go +++ b/newtmgr/cli/commands.go @@ -65,6 +65,9 @@ func Commands() *cobra.Command { nmCmd.PersistentFlags().StringVarP(&logLevelStr, "loglevel", "l", "info", "log level to use") + nmCmd.PersistentFlags().StringVarP(&nmutil.DeviceName, "devicename", "n", + "", "name of target BLE device; overrides profile setting") + nmCmd.AddCommand(crashCmd()) nmCmd.AddCommand(dateTimeCmd()) nmCmd.AddCommand(fsCmd()) http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/34c5eb87/newtmgr/config/ble_config.go ---------------------------------------------------------------------- diff --git a/newtmgr/config/ble_config.go b/newtmgr/config/ble_config.go index 5cb93df..d501a71 100644 --- a/newtmgr/config/ble_config.go +++ b/newtmgr/config/ble_config.go @@ -25,6 +25,7 @@ import ( "time" "mynewt.apache.org/newt/util" + "mynewt.apache.org/newtmgr/newtmgr/nmutil" "mynewt.apache.org/newtmgr/nmxact/bledefs" "mynewt.apache.org/newtmgr/nmxact/nmble" "mynewt.apache.org/newtmgr/nmxact/sesn" @@ -106,6 +107,10 @@ func ParseBleConnString(cs string) (*BleConfig, error) { func FillSesnCfg(bc *BleConfig, sc *sesn.SesnCfg) { sc.Ble.OwnAddrType = bc.OwnAddrType + if nmutil.DeviceName != "" { + bc.PeerName = nmutil.DeviceName + } + if bc.PeerName != "" { sc.Ble.PeerSpec = sesn.BlePeerSpecName(bc.PeerName) } else { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/34c5eb87/newtmgr/nmutil/nmutil.go ---------------------------------------------------------------------- diff --git a/newtmgr/nmutil/nmutil.go b/newtmgr/nmutil/nmutil.go index aca8111..9cce127 100644 --- a/newtmgr/nmutil/nmutil.go +++ b/newtmgr/nmutil/nmutil.go @@ -28,6 +28,7 @@ import ( var Timeout float64 var Tries int var ConnProfile string +var DeviceName string func TxOptions() sesn.TxOptions { return sesn.TxOptions{
