Problem with accessing Shell Commands through SMP from Android Device Manager app

I am developing an app using DFU and that part is going well using the nRF Device Manager app.  However, the features using shell to send commands do not work, all say Command not implemented.  This was based on the SMP Server app.

Shell commands do work on the UART over the USB link, and custom commands can be added to them.  How do I get shell commands to attach over the SMP link?  looking at the .C code it says that options that are set will work on SMP.  Is there a way to get both the SMP link and USB Uart shells to work?

The nRF Device manager app also has a Chat interface that echoes back a string you send.  Where is the way to have an application hook into this service/command on the device side and perform custom operations?   The service does work, so the code must be somewhere.

  • Hi Christopher 

    I will look into your questions. 

    Shell commands do work on the UART over the USB link, and custom commands can be added to them.  How do I get shell commands to attach over the SMP link?

    I would start by looking at the smp server sample 

    Is there a way to get both the SMP link and USB Uart shells to work?

    I will need to check, 

    The nRF Device manager app also has a Chat interface that echoes back a string you send.  Where is the way to have an application hook into this service/command on the device side and perform custom operations?   The service does work, so the code must be somewhere.

    I'm a bit unsure what you mean here. You can use the shell interface in the device manager app to communicate with smp over shell

    Regards

    Runar

  • if you look at the nRF Device Manager android app, the first tab after connection has an "echo" interface that looks like messaging (text bubbles) that echoes text strings you put into it.  My idea is to understand how this is implemented in case a similar communication message link would be useful in application code.

    The SMP server sample has no visible code under the src tree for shell command handling.  The nRF Device Manager shell tab returns an error (8) undefined command for all of them.  This is true for both the SMP server sample and my application based on it.

    The SMP also has a file transfer protocol that tested out OK with the sample and the application we are making.  In the documentation there is mention that for security you might want to add code to keep the file transfer open only to "trusted" apps.  Where is the handle/API to do this?  SMP server sample has no visible code adding hooks/handlers to the interface.  Where would this be done?

    Alternatively if there is some other sample that shows tweaking of the full SMP interface more directly by all means point me at that.

  • I have a chat with a few coworkers regarding our questions

    Christopher Smith said:

    The SMP server sample has no visible code under the src tree for shell command handling.  The nRF Device Manager shell tab returns an error (8) undefined command for all of them.  This is true for both the SMP server sample and my application based on it.

    This example shows how to add custom commands to the zephyr shell. The smp_svr samples forwards the Zephyr shell so it should be possible to add new commands to it. You can add functionality from different modules by including them in prj.conf

    But as a start you will  need the following

    CONFIG_SHELL

    CONFIG_BT_SHELL

    Regards

    Christopher Smith said:

    The SMP also has a file transfer protocol that tested out OK with the sample and the application we are making.  In the documentation there is mention that for security you might want to add code to keep the file transfer open only to "trusted" apps.  Where is the handle/API to do this?  SMP server sample has no visible code adding hooks/handlers to the interface.  Where would this be done?

    My teams DFU/MCUMGR specialist is currently out of office, but from what I can find, it looks like you need to have enable CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN. The SMP charcareristic permission levels get set at https://github.com/nrfconnect/sdk-zephyr/blob/bdda11bdb687157e55b44e3053bb0966ecf75d4f/subsys/mgmt/mcumgr/transport/src/smp_bt.c#L370 

    Runar

  • I have already added custom commands to the shell in my app, based on the shell example.  These commands do work in the USB interface in the IDE.  They do not work, none of them, in the SMP shell in the Android Device Manager app.

    I do have the line CONFIG_SHELL_BACKEND_SERIAL=y in my prj.conf which might be why the USB shell works.  The list of supported backends mentions SMP but there isn't a CONFIG for it that I found.  Is there a CONFIG to enable this, or a working sample that does shell commands from the Device Manager Android App?

    As to the second part, that setting does seem to enable SMP authorization.  How do I hook into that process to do verification?

  • Just a quick update. I have run into the same issue as you regarding it works over USB but not over any other interface, so i'm looking into that. 

    Regards

    Runar

Related