Problem running mux


#1

I am having problems using the MuxCtrl tool on WP85 (https://github.com/mangOH/MuxControl)

I can produce the binaries and install them onto my mangOH Green, but I am getting errors on running the mux binary.

root@swi-mdm9x15:~# app runProc muxCtrlTools --exe=/legato/apps/9c08522aea925f495b2abb20f97ca8e4/read-only/bin/mux -- 1
Connecting to service ...
Error: Can't connect to muxCtrlService.  Is it running?

The process is running:

root@swi-mdm9x15:~# ps fax
417 ?        Ss     0:00 ./system/bin/startSystem
418 ?        S<     0:00  \_ /legato/systems/current/bin/supervisor --no-daemonize
422 ?        S<     0:00      \_ serviceDirectory
428 ?        S<     0:00      \_ logCtrlDaemon
449 ?        S<     0:02      \_ configTree
455 ?        S<     0:00      \_ updateDaemon
465 ?        S<     0:00      \_ watchdog
484 ?        Sl     0:00      \_ audioDaemon
485 ?        Sl     0:00      \_ avcDaemon
486 ?        Sl     0:00      \_ cellNetService
487 ?        Sl     0:00      \_ dcsDaemon
488 ?        Sl     0:00      \_ fwupdateDaemon
489 ?        S      0:00      \_ gpioService
491 ?        Sl     0:00      \_ modemDaemon
492 ?        Sl     0:00      \_ posDaemon
493 ?        S      0:00      \_ powerManagerService
494 ?        Sl     0:00      \_ secStore
496 ?        S      0:00      \_ wifiService
4541 ?        S      0:00      \_ muxCtrlService

I get the same thing running the binary directly:

root@swi-mdm9x15:~# /legato/apps/9c08522aea925f495b2abb20f97ca8e4/read-only/bin/mux 1
Connecting to service ...
Error: Can't connect to muxCtrlService.  Is it running?

The muxCtrlService appears to be running:

root@swi-mdm9x15:~# app status
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] positioningService
[running] powerMgr
[running] secStore
[stopped] smsInboxService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[running] muxCtrlService
[stopped] muxCtrlTools
[stopped] bluetoothUtil

I am building muxCtrlService and muxCtrlTools like this:

echo $LEGATO_ROOT
/home/vagrant/legato/packages/legato.framework.16.4.0.I201606090927/resources/legato
MANGOH_ROOT=/home/vagrant/mangoh_root mkapp --cflags="-I." -t wp85 muxCtrlService/muxCtrlService.adef
MANGOH_ROOT=/home/vagrant/mangoh_root mkapp --cflags="-I." -t wp85 tools/muxCtrlTools.adef
instapp muxCtrlService.wp85.update <ip>
instapp muxCtrlTools.wp85.update <ip>

To try and further understand what is happening, here is the (partial) output from strace:

root@swi-mdm9x15:~# strace /legato/apps/9c08522aea925f495b2abb20f97ca8e4/read-only/bin/mux 1

socket(PF_LOCAL, SOCK_SEQPACKET, 0)     = 9
connect(9, {sa_family=AF_LOCAL, sun_path="/tmp/legato/serviceDirectoryClient"}, 110) = 0
sendmsg(9, {msg_name(0)=NULL, msg_iov(1)=[{"P\4\0\0c18113dd9a91662988aae1451bfb"..., 264}], msg_controllen=0, msg_flags=0}, 0) = 264
recvmsg(9, Error: Can't connect to muxCtrlService.  Is it running?
<unfinished ...>
+++ exited with 1 +++

root@swi-mdm9x15:~# ls -l /tmp/legato/serviceDirectoryClient
srwxrwxrwx    1 root     root             0 Jan  8 22:01 /tmp/legato/serviceDirectoryClient

Here is my legato version:

root@swi-mdm9x15:~# legato version
16.04.0_63633d9200de787b7c2a6dca03d2cff3_modified

#2

Hi,

I think the problem might be that when you are doing this:
# app runProc muxCtrlTools --exe=/legato/apps/9c08522aea925f495b2abb20f97ca8e4/read-only/bin/mux -- 1
You are trying to run the mux program inside a sandbox, but mux is not configured to be run sandboxed. If I remember correctly, I think the problem is that apps which expose command line utilities must not be run sandboxed. I remember hearing that the Legato team was working on this, but I don’t know if this feature is landing in the next Legato release or a later one.

try just running /legato/apps/9c08522aea925f495b2abb20f97ca8e4/read-only/bin/mux -- 1


#3

Thanks for the suggestion, but this does not work.

When running a binary directly -- is not understood. Running it directly with the command line argument of 1 gives the same “Can’t connect” problem.

Is there instructions available for building muxCtrl?

How can I begin to debug the connection failure that is occurring?

Thanks.


#4

Hello tobyjaffey,

For easier use, configure in the commands section in the sdef file (example mangoh.sdef):

commands:
{

mux = muxCtrlTools:/bin/mux
}

This will create a symbolic link to the mux application in the /legato/systems/current/bin

You can then call the mux application from the command line:

root@swi-mdm9x15:~# mux 4
Connecting to service …
Executing 4: Turn SPI on for IoT slot 0
Success

root@swi-mdm9x15:~# ls -l /legato/systems/current/bin/

-rwxr-xr-x 1 root root 7750 Jul 28 2016 app
-rwxr-xr-x 1 root root 12790 Jul 28 2016 appCtrl
-rwxr-xr-x 1 root root 1803 Jul 28 2016 cleanSandbox
lrwxrwxrwx 1 root root 30 Jul 28 2016 cm -> …/apps/tools/read-only/bin/cm
-rwxr-xr-x 1 root root 12530 Jul 28 2016 config
-rwxr-xr-x 1 root root 8173 Jul 28 2016 configEcm
-rwxr-xr-x 1 root root 12554 Jul 28 2016 configTree
-rwxr-xr-x 1 root root 12722 Jul 28 2016 execInApp
lrwxrwxrwx 1 root root 36 Jul 28 2016 fwupdate -> …/apps/tools/read-only/bin/fwupdate
-rwxr-xr-x 1 root root 12835 Jul 28 2016 gdbCfg
-rwxr-xr-x 1 root root 81922 Jul 28 2016 inspect
-rwxr-xr-x 1 root root 227 Jul 28 2016 install-hook
-rwxr-xr-x 1 root root 4969 Jul 28 2016 legato
-rwxr-xr-x 1 root root 22375 Jul 28 2016 log
-rwxr-xr-x 1 root root 12471 Jul 28 2016 logCtrlDaemon
lrwxrwxrwx 1 root root 38 Jul 28 2016 mux -> …/apps/muxCtrlTools/read-only/bin/mux
lrwxrwxrwx 1 root root 34 Jul 28 2016 pmtool -> …/apps/tools/read-only/bin/pmtool
-rwxr-xr-x 1 root root 774 Jul 28 2016 procInSandbox
-rwxr-xr-x 1 root root 3271 Jul 28 2016 saveLogs
-rwxr-xr-x 1 root root 12368 Jul 28 2016 sdir
lrwxrwxrwx 1 root root 36 Jul 28 2016 secstore -> …/apps/tools/read-only/bin/secstore
-rwxr-xr-x 1 root root 245 Jul 28 2016 security-unpack
-rwxr-xr-x 1 root root 49036 Jul 28 2016 serviceDirectory
-rwxr-xr-x 1 root root 9545 Jul 28 2016 setNet
-rwxr-xr-x 1 root root 1192 Jul 28 2016 start
-rwxr-xr-x 1 root root 39403 Jul 28 2016 startSystem
-rwxr-xr-x 1 root root 3432 Jul 28 2016 startupScript
-rwxr-xr-x 1 root root 12835 Jul 28 2016 straceCfg
-rwxr-xr-x 1 root root 13627 Jul 28 2016 supervisor
-rwxr-xr-x 1 root root 12664 Jul 28 2016 update
-rwxr-xr-x 1 root root 13926 Jul 28 2016 updateDaemon
-rwxr-xr-x 1 root root 12656 Jul 28 2016 watchdog
-rwxr-xr-x 1 root root 16034 Jul 28 2016 xattr


#5

What spastor said is true. Using the sdef file will enable a more convenient way to launch the mux tool from the command line. I don’t think it will solve the problem you are having with not being able to connect to the muxCtrlService. Have you installed any apps onto this unit other than the standard Legato apps?


#6

@dfrey Not to my knowledge. How would I reset the board back to a known state?

I have tried swiflash -f -m WP85XX -i tmp/deploy/images/swi-mdm 9x15/boot-yocto_wp85.cwe, but this seems to leave the apps in place.


#7

Download the Generic combined image here and then use swiflash to install that. That will set everything back to a known good state. Then you probably want to build the legato system and install it using make wp85 && instlegato wp85 192.168.2.2.

Maybe I’m getting ahead of myself though. Do you have a checked out copy of mangOH from following these instructions? https://github.com/mangOH/manifest/blob/master/README.md