Home Page Forums Community International Develop Applications & software ARM vs. x86_64 : MH200N returning different data

Applications & software
ARM vs. x86_64 : MH200N returning different data

This topic contains 3 replies, has 2 voices, and was last updated by  vomus 12/03/2019 at 21:11.

0
3
69
  • Verified

    Hi!

    I came across a strange situtation: my simple test program works differently running on x86_64 and ARM (Raspberry Pi). The only thing it does is to connect to my MH200N, and tries to set it in the command mode. However, when I send *99*0##, the module returns *#*1## in the case of x86_64 and a garbage like *#692951104## in the case of RPi. I ran wireshark looking at the packets and this *#692951104## is really there. Running the test program several times changes numbers in this strange string but its structure stays. The packets in the case of RPi differ from the x86_64 by a presence of a TCP Options block but I guess this must be there because of a different architecture where TCP stack is imlpemented. Other than that there is not much of a difference.

    Can anyone explain what might be wrong there?

    This is a piece of a test code that connects to my MH200N:

    #define OWN_COMND_SESSION “*99*0##”
    #define OWN_ACK “*#*1##”

    int OwnConnect (char *mode) {
    int sockid;
    struct sockaddr_in serv_addr;
    char vBuf[OWN_CHUNK_SIZE];

    memset(vBuf,0,sizeof(vBuf));
    memset(&serv_addr,0,sizeof(serv_addr));

    sockid = socket(AF_INET,SOCK_STREAM,0);
    if(sockid < 0) {
    fprintf(stdout,”Socket can not be created…\n”);
    return (-1);
    }

    serv_addr.sin_family = AF_INET;
    serv_addr.sin_port = htons(OWN_PORT);
    if(inet_pton(AF_INET, OWN_SERVER, &serv_addr.sin_addr)<=0) {
    fprintf(stdout,”inet_pton() error occured…\n”);
    return (-1);
    }
    if(connect(sockid, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    fprintf(stdout,”Socket can not be connected…\n”);
    return (-1);
    }

    recv(sockid,vBuf,sizeof(vBuf),0);
    fprintf(stdout,”1 recv() : %s\n”,vBuf);
    if(strncmp(vBuf,OWN_ACK,strlen(OWN_ACK))) {
    fprintf(stdout,”Could not successfully connect : no Bticino ACK…”);
    return (-1);
    }

    int n;
    memset(vBuf,0,sizeof(vBuf));
    n = send(sockid,mode,strlen(mode),0);
    recv(sockid,vBuf,sizeof(vBuf),0);
    if (strncmp(vBuf,OWN_ACK,strlen(OWN_ACK))) {
    fprintf(stdout,”Connection mode %s (n=%d, strlen=%d) not set : %s\n”,mode,n,strlen(mode),vBuf);
    return (-1);
    }
    return sockid;
    }




    User
    vomus
    Role
    Enthusiast
    24 posts
    Verified

    To make a long story short, I can put this for x86_64:

    [serge@perun ~]$ telnet 10.161.0.20 20000
    Trying 10.161.0.20…
    Connected to 10.161.0.20.
    Escape character is ‘^]’.
    *#*1##*99*0##
    *#*1##Connection closed by foreign host.</span>

    and this for ARM

    [pi@sunny ~]$ telnet 10.161.0.20 20000
    Trying 10.161.0.20…
    Connected to 10.161.0.20.
    Escape character is ‘^]’.
    *#*1##*99*0##
    *#509244846##Connection closed by foreign host.</span>

    None needs to look at the C code, just what telnet is giving… Isn’t it strange?
    • This reply was modified 1 month, 2 weeks ago by  vomus.



    User
    vomus
    Role
    Enthusiast
    24 posts
    Verified

    Hello,

    i guess the “<span style=”color: #48595f; font-family: DinPro, sans-serif;”>x86_64″ is in the open ip range, and therefore doesn’t require authentication.</span>

    The reply from “<span style=”color: #48595f; font-family: DinPro, sans-serif;”>ARM” looks like it uses open authentication: </span><span style=”color: #48595f; font-family: DinPro, sans-serif;”>https://rosettacode.org/wiki/OpenWebNet_Password</span&gt;

    regards

    Roma




    User
    RoStief
    Role
    Software Developer
    11 posts
    Verified

    True. I completely forgot about this thing with the IP ranges… Works fine now. Thanks.




    User
    vomus
    Role
    Enthusiast
    24 posts
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.