Error when starting Bluetooth Util


#1

Hi,
I am currently trying to run the bluetoothUtil demo on my mangoH Green.

But I get the following errors when starting the app:
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] | /legato/systems/current/apps/bluetoothUtil/read-only/bin/bt-init.sh:
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] | line 27:
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] | mux: not found
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] |
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] | /legato/systems/current/apps/bluetoothUtil/read-only/bin/bt-init.sh:
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] | line 28:
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] | mux: not found
Jan 6 00:16:21 | =ERR= | bt-init.sh[2995] |

I installed the muxControl from the github https://github.com/mangOH/MuxControl and they are running:
root@swi-mdm9x15:~# app status
[running] atClient
[running] atServer
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] positioningService
[running] powerMgr
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[running] bluetoothUtil
[running] muxCtrlService
[running] muxCtrlTools

Has anyone having the same issue?

Thank you :slight_smile:


#2

OK, this is going to be a bit of a long story…

MuxCtrlService and MuxCtrlTools are apps that were written a while back to manage muxing of IO on the mangOH Green from userspace using a Legato app. Later we came up with the idea of the IoT framework which was a kernel based system for setting up IoT cards including the muxing of IOs. This code lives in the legato repository under drivers/mangoh. More recently, we have split out the driver loading from the IoT framework. The driver loading is now done by linux_kernel_modules/mangoh in the mangOH repository. This driver is incompatible with the mangoh driver in the legato repository. For the IoT framework, I have been working on migrating the mangoh driver from legato into a driver that will work for the mangOH Red and Green. mangOH Red support is 95% complete. I will update the forum when I post the source for the IoT framework driver that supports mangOH Red.

While you’re waiting, you can remove the mux commands and the echo commands from bt-init.sh and replace it with this:

# Set IoT card GPIO3 to high
echo 7 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio7/direction
echo 1 > /sys/class/gpio/gpio7/value
# Take the IoT card out of reset
echo 2 > /sys/class/gpio/export
echo out > /sys/class/gpio/direction
echo 1 > /sys/class/gpio/gpio2/value

Let me know if you’re still stuck after trying that.


#3

Thank you for the story, it’s always pleasant to know the story behind :slight_smile:

So, I did what you suggested and I get
root@swi-mdm9x15:/legato/systems/current/appsWriteable/bluetoothUtil/bin# ./bt-init.sh
PWD is: /legato/systems/current/appsWriteable/bluetoothUtil/bin
./bt-init.sh: line 36: can't create /sys/class/gpio/direction: Permission denied
sh: write error: Operation not permitted
Can't set device: Device or resource busy
Can't initialize device: Device or resource busy
hci0: Type: BR/EDR Bus: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:24 acl:0 sco:0 commands:6 errors:0
Can't init device hci0: Connection timed out (110)

I really don’t know how to get rid of this permission error…


#4

oops, It should have been echo out > /sys/class/gpio/gpio2/direction for the second block.


#5

Ok, now I do not have the permission issue anymore, thank you :slight_smile:

I still have
sh: write error: Device or resource busy
Can't set device: Device or resource busy

And I do not see my talon bluetooth IoT card leds ON. I put my IoT card on the slot 0; maybe it should be a different one?


#6

Sorry, I just realize that I sent you down the wrong path. For some reason I thought you were using a mangOH Red. Since you are using a mangOH Green, it should just be a matter of creating an appropriate SDEF and building that.

Take a look at this for example: https://github.com/mangOH/Demos/blob/master/smartBoat.sdef

You can take out all of the apps except for bluetoothUtil. The mangOH_Green.sdef (that is reference by the above example) is what provides the mux command. Also, please undo the modifications to bt-init.sh that I suggested previously since those were based on my (incorrect) understanding that you are using mangOH Red.


#7

Hi,
Ok, but I do not understand how I am suppose to build the application from a .sdef file. Could you please elaborate?

I thought that to build an app, I had only to go the sample folder and run make or mkapp -t wp85 <.adef file>. When I run the mkapp command on the .sdef file I have: Path 'containerTracking.sdef' does not end in '.adef'.
I ran these commands from my ubuntu VM on which the legato tools is installed.

Also, I do not understand how the mux command is provided from this file.

Thank you


#8

mksys -t wp85 path/to/system.sdef

The sdef represents an entire legato system. So it builds all the apps.


#9

Hi,

I am at a similar fix.

why is that we get -sh: mux: not found when using mux commands ?


#10

Is there any way we can circumvent the use of mux commands ?