Should the `stat` command in newtmgr be behaving similarly to the console command where it returns a list of all stat entries available?

That was the behaviour I was expecting, though I also tried `stat list`, `stat show` and `stat all` or just `stat` before looking at the documentation (which didn't elaborate, but not biggie there are more important problems to solve!).

It seems there might be an error here:

   $ newtmgr -c serial1 stat
   panic: runtime error: index out of range

   goroutine 1 [running]:
   panic(0x42965a0, 0xc820010080)
   /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
   mynewt.apache.org/newt/newtmgr/cli.statsRunCmd(0xc8200df800,
   0xc82000e820, 0x0, 0x2)
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/cli/stats.go:57
   +0x946
   github.com/spf13/cobra.(*Command).execute(0xc8200df800,
   0xc82000e620, 0x2, 0x2, 0x0, 0x0)
   /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:565 +0x85a
   github.com/spf13/cobra.(*Command).ExecuteC(0xc8200de000,
   0xc8200df800, 0x0, 0x0)
   /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:651 +0x55c
   github.com/spf13/cobra.(*Command).Execute(0xc8200de000, 0x0, 0x0)
   /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:610 +0x2d
   main.main()
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/newtmgr.go:25
   +0x25

When I run with a valid name things are fine:

   $ newtmgr -c serial1 stat ble_svc_dis
   Return Code = 0
   Stats Name: ble_svc_dis
      manufacturer_reads_stat: 0
      model_reads_stat: 0
      serial_reads_stat: 0
      firmware_rev_reads_stat: 0
      hardware_rev_reads_stat: 0
      software_rev_reads_stat: 0

It seems there isn't currently a way to know via newtmgr how many stat entries are present, although this information is available in the console version.

I'm running the latest newtmgr available in the master branch of the repo.

K.

PS: The stats module is great, BTW. The reason I enjoy using Mynewt so much is the (sadly uncommon) focus on real product deployments. Details like this make life so much easier when devices are out in the wild, but those 'details' tend to be forgotten in a lot of tools and platforms or a sad afterthought. So many RTOSes and platforms are overly academic and it's refreshing that the design decisions with Mynewt are being informed by the realities of real world product releases, and having to debug things in the field.

Reply via email to