Hi all,

I'm having 2 troubles regarding calling Data Model paths.

  1. I'm running my demon program on RDK OS, armv7 Broadcom based (Vantiva CGA437 box).
    When calling dmcli I always get 102 error: "Ccsp msg bus internal error 102".
    BUT, when I've compiled a small 'main' program with the same code, it works perfectly fine.
    Here's the code:
    #define _GNU_SOURCE
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include <unistd.h>
    #include <errno.h>
    #include <rbus.h>
    
    int main(int argc, char *argv[])
    {
        int ret = -1;
        FILE *pipe = NULL;
        char buffer[256] = {0};
        char cmd[] = "dmcli eRT getv Device.DeviceInfo.SerialNumber";
    
        pipe = popen(cmd, "r");
        if(NULL == pipe) {
            printf("Pipe is NULL. popen() failed. Error: %d\n", errno);
            return ret;
        }
    
        while (NULL != fgets(buffer, sizeof(buffer), pipe)) {
            printf("buffer: %s\n", buffer);
        }
    
        pclose(pipe);
    
        return ret;
    }


    Also running "dmcli eRT getv Device.DeviceInfo.SerialNumber" through shell command or through system() will fail.
    I've no clue about the implementation of dmcli, so I'm here for some help.
    Should I call the dmcli in different manner? Is there something my demon does not correctly?
  2. I have another problem trying to use librbus. 
    When I try to rbus_open(), the program immediately inflates in its VSZ by 18MB. That's way too much.
    Here's the program:
    #define _GNU_SOURCE
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include <unistd.h>
    #include <rbus.h>
    
    rbusHandle_t handle;
    
    int main(int argc, char *argv[])
    {
       rbus_open(&handle, "mytest");
    
       while (true) {
           sleep(100);
       }
    }
    The VSZ here 22100KB. Once I remove the rbus_open() it'll be 4684KB.
    Please advice, is there any compilation that should be different? Some flags? 


  • No labels

2 Comments

  1. Unknown User (deepika.b)

    Hi Unknown User (artiuma) 

    • In your platform , all the RDK-B process are up ? CccspCr, CcspPandm , CcspPsm process are up and running ?
    • If you query dmcli eRT getv Device.DeviceInfo. , whether you are able to see the query is getting updated ?
    • dmcli eRT getv Device.DeviceInfo.SerialNumber → For this dmcli , the data is read from HAL api platform_hal_GetSerialNumber ,Could you please check whether this is implemented for your platform .
    • VSZ : here are you invoking rbus_open api from code or externally ? could you check whether the invocation of rbus_open is successful with introducing conditions and verify 
  2. Unknown User (artiuma)

    Hi Unknown User (deepika.b) 

    • Seems like all of these are up and running, yes
      root@MyModem:/tmp# ps | grep -i ccsp
       4603 root     39372 S    /usr/bin/CcspCrSsp -subsys eRT.
       4950 root      126m S    /usr/bin/CcspPandMSsp -subsys eRT.
       8137 root     40384 S    /usr/bin/CcspTandDSsp -subsys eRT.
       8279 root      160m S    /usr/bin/CcspWifiSsp -subsys eRT.
       8288 root     66376 S    /usr/bin/CcspEthAgent -subsys eRT.
       8386 root     42380 S    /usr/bin/CcspTr069PaSsp -subsys eRT.
       8545 root      2956 S    {self_heal_conne} /bin/sh /usr/ccsp/tad/self_heal_connectivity_test.sh
       8567 root      3052 S    {resource_monito} /bin/sh /usr/ccsp/tad/resource_monitor.sh
      11538 root     98184 S    /usr/bin/CcspLMLite -subsys eRT.
      11988 root     50688 S    /usr/bin/CcspCMAgentSsp -subsys eRT.
      16867 root      2692 S    /bin/sh /usr/ccsp/wifi/wifi-heal.sh
      19963 root     59124 S    /usr/bin/CcspMtaAgentSsp -subsys eRT.
      25242 root      2672 S    grep -i ccsp
      
      


    • I see that dmcli eRT getv Device.DeviceInfo. succeeds but no sure what you mean by 'updated'.
    • How do I check whether platform_hal_GetSerialNumber is implemented? 
    • Of course, here's the updated code
      #define _GNU_SOURCE
      #include <stdio.h>
      #include <stdlib.h>
      #include <stdbool.h>
      #include <unistd.h>
      #include <errno.h>
      #include <rbus.h>
       
      rbusHandle_t handle;
       
      int main(int argc, char *argv[])
      {
          int err;
      
          err = rbus_open(&handle, "mytest");
          if (err != RBUS_ERROR_SUCCESS) {
              printf("Failed to open, err %d, errno %d", err, errno);
              exit(1);
          }
      
          while (true) {
              sleep(100);
          }
      }

      And here is how I compile it
      #!/bin/sh -xe
      
      export PATH="/opt/toolchains/CGA437AORB_toolchain/recipe-sysroot-native/usr/bin/arm-rdk-linux-gnueabi:$PATH"
      export CFLAGS="-march=armv7ve -Os -fomit-frame-pointer -ffunction-sections -fmerge-all-constants -fdata-sections -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a15 -I/opt/toolchains/CGA437AORB_toolchain/recipe-sysroot/usr/include/ -Ihome/cvr/dev-stats/rdkb-2021q3-dunfell-r0/recipe-sysroot/usr/include/gnu/ -I/opt/toolchains/CGA437AORB_toolchain/recipe-sysroot/usr/include/rbus/"
      export LDFLAGS="-Wl,--gc-sections -Wl,--sort-common -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a15 --sysroot=/opt/toolchains/CGA437AORB_toolchain/recipe-sysroot -L/opt/toolchains/CGA437AORB_toolchain/recipe-sysroot/usr/lib"
      
      /opt/toolchains/CGA437AORB_toolchain/recipe-sysroot-native/usr/bin/arm-rdk-linux-gnueabi/arm-rdk-linux-gnueabi-gcc -DPLATFORM_HAVE_PRCTL -Wall $CFLAGS -c -o main.o main2.c
      /opt/toolchains/CGA437AORB_toolchain/recipe-sysroot-native/usr/bin/arm-rdk-linux-gnueabi/arm-rdk-linux-gnueabi-gcc $LDFLAGS -o main main.o -lrbus

      You can replace the paths with your toolchain and examine the exe in runtime.
      I've tried to valgrind it but I have no symbols for the libraries that being used (rbus and all underlying libs).


    Thanks a lot for the help!