
Module: /home/henthorn/AUV/auv-qnx/auv/altex/onboard/camera/xportTest.cc
Group: 'DGROUP' CONST,CONST2,_DATA,_BSS

Segment: _TEXT  DWORD USE32  00000c5a bytes  

/****************************************************************************/
/* Copyright (c) 2008 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : xportTest.cc                                                  */
/* Author   : K Headley                                                     */
/* Project  : Benthic Imaging AUV                                           */
/* Created  : 04/01/2008                                                    */
/****************************************************************************/
/* Modification History:                                                    */
/*  $Id: xportTest.cc,v 1.3 2012/04/05 22:43:38 headley Exp $    */
/*  $Name:  $  */
/****************************************************************************/

#include "XPort.h"
#include "BicamConsts.h"
#include "qnx_port.h"
#include <signal.h>

#ifdef QNX
using namespace std;
#endif

/* local function defs */
int testConnectXPort(XPort xport);
int testWriteMessage(XPort xport);
int testWriteCommand(XPort xport);
int testReadResponse(XPort xport);
void startMockXPort(char *host);

pid_t mockXPortPID;
pid_t gpioPID;
pid_t serialPID;
#define NUM_THREADS 2

int testConnectXPort(XPort *xport){
  int test;
 0000                    int near testConnectXPort( XPort near * ):
 0000  68 1c 00 00 00                    push    0000001cH
 0005  e8 00 00 00 00                    call    __CHK
 000a  53                                push    ebx
 000b  52                                push    edx
 000c  89 c3                             mov     ebx,eax

  test=xport->connectxp(XPCON_ALL);
 000e  ba 02 00 00 00                    mov     edx,00000002H
 0013  e8 00 00 00 00                    call    int near XPort::connectxp( ConnectionID )

  if(test==OK){
 0018  85 c0                             test    eax,eax
 001a  75 39                             jne     L1

    printdbg("testConnectXPort: host:%s gpioPort:%d serialPort:%d \n",
	  xport->getConnection()->getHost(), 
	  xport->getConnection()->getpGPIO(),
	  xport->getConnection()->getpSerial());
 001c  89 d8                             mov     eax,ebx
 001e  e8 00 00 00 00                    call    XPortConnection near * near XPort::getConnection()
 0023  e8 00 00 00 00                    call    int unsigned near XPortConnection::getpSerial()
 0028  50                                push    eax
 0029  89 d8                             mov     eax,ebx
 002b  e8 00 00 00 00                    call    XPortConnection near * near XPort::getConnection()
 0030  e8 00 00 00 00                    call    int unsigned near XPortConnection::getpGPIO()
 0035  50                                push    eax
 0036  89 d8                             mov     eax,ebx
 0038  e8 00 00 00 00                    call    XPortConnection near * near XPort::getConnection()
 003d  e8 00 00 00 00                    call    char near * near XPortConnection::getHost()
 0042  50                                push    eax
 0043  68 00 00 00 00                    push    offset L63
 0048  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 004d  83 c4 10                          add     esp,00000010H

    return TEST_OK;
  }
 0050  31 c0                             xor     eax,eax
 0052  5a                                pop     edx
 0053  5b                                pop     ebx
 0054  c3                                ret     

  return TEST_FAILED;
 0055  b8 fb ff ff ff    L1              mov     eax,0fffffffbH

}
 005a  5a                                pop     edx
 005b  5b                                pop     ebx
 005c  c3                                ret     

int testDisconnectXPort(XPort xport){
  int test;
 005d                    int near testDisconnectXPort( XPort ):
 005d  68 0c 00 00 00                    push    0000000cH
 0062  e8 00 00 00 00                    call    __CHK
 0067  52                                push    edx
 0068  50                                push    eax

  test=xport.disconnectxp(XPCON_ALL);
 0069  ba 02 00 00 00                    mov     edx,00000002H
 006e  e8 00 00 00 00                    call    int near XPort::disconnectxp( ConnectionID )

  if(test==OK){
    return TEST_OK;
  }
 0073  85 c0                             test    eax,eax
 0075  74 05                             je      L2

  return TEST_FAILED;
 0077  b8 fb ff ff ff                    mov     eax,0fffffffbH

}
 007c  83 c4 04          L2              add     esp,00000004H
 007f  5a                                pop     edx
 0080  c3                                ret     

int testWriteSerial(XPort xport){
  int test=0;
  char *msg="this is a test message\n";
 0081                    int near testWriteSerial( XPort ):
 0081  68 18 00 00 00                    push    00000018H
 0086  e8 00 00 00 00                    call    __CHK
 008b  53                                push    ebx
 008c  51                                push    ecx
 008d  52                                push    edx
 008e  56                                push    esi
 008f  50                                push    eax

  int len=(strlen(msg)+1);

 0090  b8 36 00 00 00                    mov     eax,offset L64
 0095  e8 00 00 00 00                    call    strlen_
 009a  8d 70 01                          lea     esi,+1H[eax]

  test=xport.writeSerial(msg,len,0);
 009d  31 c9                             xor     ecx,ecx
 009f  89 f3                             mov     ebx,esi
 00a1  ba 36 00 00 00                    mov     edx,offset L64
 00a6  8b 04 24                          mov     eax,[esp]
 00a9  e8 00 00 00 00                    call    int near XPort::writeSerial( char const near *, int unsigned, int unsigned )
 00ae  89 c3                             mov     ebx,eax

  if(test!=len){
 00b0  39 f0                             cmp     eax,esi
 00b2  74 27                             je      L3

    cout << "testWriteSerial: failed; returned "<<test<<endl;
 00b4  ba 4e 00 00 00                    mov     edx,offset L65
 00b9  b8 00 00 00 00                    mov     eax,offset ostream near cout
 00be  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 00c3  89 da                             mov     edx,ebx
 00c5  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( long )
 00ca  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 00cf  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

    return TEST_FAILED;
  }
 00d4  b8 fb ff ff ff                    mov     eax,0fffffffbH
 00d9  eb 02                             jmp     L4

  return TEST_OK;
 00db  31 f0             L3              xor     eax,esi

}
 00dd  83 c4 04          L4              add     esp,00000004H
 00e0  5e                                pop     esi
 00e1  5a                                pop     edx
 00e2  59                                pop     ecx
 00e3  5b                                pop     ebx
 00e4  c3                                ret     

int testWriteCommand(XPort xport){
  int test=0;
 00e5                    int near testWriteCommand( XPort ):
 00e5  68 2c 00 00 00                    push    0000002cH
 00ea  e8 00 00 00 00                    call    __CHK
 00ef  53                                push    ebx
 00f0  51                                push    ecx
 00f1  52                                push    edx
 00f2  56                                push    esi
 00f3  83 ec 14                          sub     esp,00000014H
 00f6  50                                push    eax

  int result=0;
 00f7  31 f6                             xor     esi,esi

  XPortResponse xpResponse;
 00f9  8d 44 24 10                       lea     eax,+10H[esp]
 00fd  e8 00 00 00 00                    call    near XPortResponse::XPortResponse()

  XPortCommand xpCommand(XP_CMD_GET_FUNCTIONS,0x7,0x7);

  //printdbg("testSendCommand: sending command\n");
 0102  b9 07 00 00 00                    mov     ecx,00000007H
 0107  89 cb                             mov     ebx,ecx
 0109  ba 10 00 00 00                    mov     edx,00000010H
 010e  8d 44 24 04                       lea     eax,+4H[esp]
 0112  e8 00 00 00 00                    call    near XPortCommand::XPortCommand( char unsigned, int unsigned, int unsigned )

  test=xport.writeCommand(&xpCommand);
 0117  8d 54 24 04                       lea     edx,+4H[esp]
 011b  8b 04 24                          mov     eax,[esp]
 011e  e8 00 00 00 00                    call    int near XPort::writeCommand( XPortCommand near * )

  if(test!=XPORT_COMMAND_LEN){
 0123  83 f8 09                          cmp     eax,00000009H
 0126  74 05                             je      L5

    result++;
  }
  //printdbg("testSendCommand: reading response\n");
 0128  be 01 00 00 00                    mov     esi,00000001H

  xport.readResponse(&xpResponse);
  //printdbg("testSendCommand: response received:\n");
  //showResponse(&xpResponse);

 012d  8d 54 24 10       L5              lea     edx,+10H[esp]
 0131  8b 04 24                          mov     eax,[esp]
 0134  e8 00 00 00 00                    call    int near XPort::readResponse( XPortResponse near * )

  if(result>0)
 0139  85 f6                             test    esi,esi
 013b  7e 07                             jle     L6

    return TEST_FAILED;
  else
 013d  b8 fb ff ff ff                    mov     eax,0fffffffbH
 0142  eb 02                             jmp     L7

    return TEST_OK;
 0144  31 c0             L6              xor     eax,eax

}

 0146  83 c4 18          L7              add     esp,00000018H
 0149  5e                                pop     esi
 014a  5a                                pop     edx
 014b  59                                pop     ecx
 014c  5b                                pop     ebx
 014d  c3                                ret     

int testReadResponse(XPort xport){
  int test=0;
 014e                    int near testReadResponse( XPort ):
 014e  68 30 00 00 00                    push    00000030H
 0153  e8 00 00 00 00                    call    __CHK
 0158  53                                push    ebx
 0159  51                                push    ecx
 015a  52                                push    edx
 015b  56                                push    esi
 015c  83 ec 18                          sub     esp,00000018H
 015f  50                                push    eax

  int result=0;
 0160  31 f6                             xor     esi,esi

  unsigned char testCmd=XP_CMD_GET_FUNCTIONS;
 0162  c6 44 24 18 10                    mov     byte ptr +18H[esp],10H

  XPortResponse xpResponse;
 0167  8d 44 24 10                       lea     eax,+10H[esp]
 016b  e8 00 00 00 00                    call    near XPortResponse::XPortResponse()

  XPortCommand xpCommand;

 0170  8d 44 24 04                       lea     eax,+4H[esp]
 0174  e8 00 00 00 00                    call    near XPortCommand::XPortCommand()

  xpCommand.set(testCmd,0xFF,0xFF);
  //printdbg("testReadResponse sending:\n");
  //showCommand(xpCommand);

 0179  b9 ff 00 00 00                    mov     ecx,000000ffH
 017e  89 cb                             mov     ebx,ecx
 0180  ba 10 00 00 00                    mov     edx,00000010H
 0185  8d 44 24 04                       lea     eax,+4H[esp]
 0189  e8 00 00 00 00                    call    void near XPortCommand::set( char unsigned, int unsigned, int unsigned )

  test=xport.writeCommand(&xpCommand);
 018e  8d 54 24 04                       lea     edx,+4H[esp]
 0192  8b 04 24                          mov     eax,[esp]
 0195  e8 00 00 00 00                    call    int near XPort::writeCommand( XPortCommand near * )

  if(test!=XPORT_COMMAND_LEN){
 019a  83 f8 09                          cmp     eax,00000009H
 019d  74 05                             je      L8

    result++;
  }
  //printdbg("testReadResponse: sendCommand returned %d\n",test);
 019f  be 01 00 00 00                    mov     esi,00000001H

  test=xport.readResponse(&xpResponse);
 01a4  8d 54 24 10       L8              lea     edx,+10H[esp]
 01a8  8b 04 24                          mov     eax,[esp]
 01ab  e8 00 00 00 00                    call    int near XPort::readResponse( XPortResponse near * )

  if(xpResponse.getCommand() != testCmd ||
     xpResponse.getP1()  != 0xff){
 01b0  8d 44 24 10                       lea     eax,+10H[esp]
 01b4  e8 00 00 00 00                    call    char unsigned near XPortResponse::getCommand()
 01b9  3a 44 24 18                       cmp     al,+18H[esp]
 01bd  75 10                             jne     L9
 01bf  8d 44 24 10                       lea     eax,+10H[esp]
 01c3  e8 00 00 00 00                    call    int unsigned near XPortResponse::getP1()
 01c8  3d ff 00 00 00                    cmp     eax,000000ffH
 01cd  74 01                             je      L10

    result++;
  }

 01cf  46                L9              inc     esi

  if(result>0)
 01d0  85 f6             L10             test    esi,esi
 01d2  7e 07                             jle     L11

    return TEST_FAILED;
  else
 01d4  b8 fb ff ff ff                    mov     eax,0fffffffbH
 01d9  eb 02                             jmp     L12

    return TEST_OK;
 01db  31 c0             L11             xor     eax,eax

}


 01dd  83 c4 1c          L12             add     esp,0000001cH
 01e0  5e                                pop     esi
 01e1  5a                                pop     edx
 01e2  59                                pop     ecx
 01e3  5b                                pop     ebx
 01e4  c3                                ret     

int getListenerSocket(int *sd, char *hostname, unsigned short port, struct sockaddr_in *servAddr){
  struct hostent *h;

 01e5                    int near getListenerSocket( int near *, char near *, short unsigned, sockaddr_in near * ):
 01e5  68 20 00 00 00                    push    00000020H
 01ea  e8 00 00 00 00                    call    __CHK
 01ef  56                                push    esi
 01f0  57                                push    edi
 01f1  55                                push    ebp
 01f2  89 c6                             mov     esi,eax
 01f4  89 d7                             mov     edi,edx

  printdbg("getListenerSocket: setting up listener on %s port %d (%hu)\n",hostname,port,port);
  /* create socket */
 01f6  0f b7 eb                          movzx   ebp,bx
 01f9  55                                push    ebp
 01fa  55                                push    ebp
 01fb  52                                push    edx
 01fc  68 71 00 00 00                    push    offset L66
 0201  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 0206  83 c4 10                          add     esp,00000010H

  *sd = socket(AF_INET, SOCK_STREAM, 0);
 0209  31 db                             xor     ebx,ebx
 020b  ba 01 00 00 00                    mov     edx,00000001H
 0210  b8 02 00 00 00                    mov     eax,00000002H
 0215  e8 00 00 00 00                    call    socket_
 021a  89 06                             mov     [esi],eax

   if(*sd<0) {
 021c  85 c0                             test    eax,eax
 021e  7d 13                             jge     L14

    perror("getListenerSocket: cannot open socket ");
 0220  b8 ad 00 00 00                    mov     eax,offset L67
 0225  e8 00 00 00 00                    call    perror_

    return ERROR;
  }
 022a  b8 ff ff ff ff    L13             mov     eax,0ffffffffH
 022f  5d                                pop     ebp
 0230  5f                                pop     edi
 0231  5e                                pop     esi
 0232  c3                                ret     

   printdbg("getListenerSocket: got socket (%d)\n",*sd);

  /* bind server port */
 0233  50                L14             push    eax
 0234  68 d4 00 00 00                    push    offset L68
 0239  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 023e  83 c4 08                          add     esp,00000008H

   printdbg("getListenerSocket: calling gethostbyname %s\n",hostname);
 0241  57                                push    edi
 0242  68 f8 00 00 00                    push    offset L69
 0247  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 024c  83 c4 08                          add     esp,00000008H

   h = gethostbyname(hostname);
 024f  89 f8                             mov     eax,edi
 0251  e8 00 00 00 00                    call    gethostbyname_

  if(h==NULL) {
 0256  85 c0                             test    eax,eax
 0258  75 17                             jne     L15

    printdbg("getListenerSocket: unknown host '%s' (%d)\n",hostname,h_errno);
    return ERROR;
  }
 025a  8b 35 00 00 00 00                 mov     esi,_h_errno
 0260  56                                push    esi
 0261  57                                push    edi
 0262  68 25 01 00 00                    push    offset L70
 0267  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 026c  83 c4 0c                          add     esp,0000000cH
 026f  eb b9                             jmp     L13

   printdbg("getListenerSocket: gethostbyname complete\n");

 0271  68 50 01 00 00    L15             push    offset L71
 0276  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 027b  83 c4 04                          add     esp,00000004H

  servAddr->sin_family = AF_INET;
  //memcpy((char *) &servAddr->sin_addr.s_addr, h->h_addr_list[0], h->h_length);
  /* not sure why, but it won't bind using the hostname: 
     memcpy((char *) &servAddr->sin_addr.s_addr, h->h_addr_list[0], h->h_length);
     must use INADDR_ANY
  */
 027e  c6 41 01 02                       mov     byte ptr +1H[ecx],02H

  servAddr->sin_addr.s_addr = htonl(INADDR_ANY);
 0282  31 c0                             xor     eax,eax
 0284  e8 00 00 00 00                    call    htonl_
 0289  89 41 04                          mov     +4H[ecx],eax

  servAddr->sin_port = htons(port);

 028c  89 e8                             mov     eax,ebp
 028e  e8 00 00 00 00                    call    htons_
 0293  66 89 41 02                       mov     +2H[ecx],ax

  errno=0;
 0297  e8 00 00 00 00                    call    __get_errno_ptr_
 029c  c7 00 00 00 00 00                 mov     dword ptr [eax],00000000H

  if(bind(*sd, (struct sockaddr *) servAddr, sizeof(*servAddr))<0) {
 02a2  8b 06                             mov     eax,[esi]
 02a4  bb 10 00 00 00                    mov     ebx,00000010H
 02a9  89 ca                             mov     edx,ecx
 02ab  e8 00 00 00 00                    call    bind_
 02b0  85 c0                             test    eax,eax
 02b2  7d 1a                             jge     L16

    printdbg("getListenerSocket: cannot bind port (%d)\n",errno);
    return ERROR;
  }

 02b4  e8 00 00 00 00                    call    __get_errno_ptr_
 02b9  8b 08                             mov     ecx,[eax]
 02bb  51                                push    ecx
 02bc  68 7b 01 00 00                    push    offset L72
 02c1  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 02c6  83 c4 08                          add     esp,00000008H
 02c9  e9 5c ff ff ff                    jmp     L13

  listen(*sd,2);    

 02ce  8b 06             L16             mov     eax,[esi]
 02d0  ba 02 00 00 00                    mov     edx,00000002H
 02d5  e8 00 00 00 00                    call    listen_

  return *sd;
 02da  8b 06                             mov     eax,[esi]

}

 02dc  5d                                pop     ebp
 02dd  5f                                pop     edi
 02de  5e                                pop     esi
 02df  c3                                ret     

void *gpioListener(void *threadid){
  int tid;
  int sd, newSd;
  SOCKLEN svrLen;
  struct sockaddr_in svrAddr;
 02e0                    void near * near gpioListener( void near * ):
 02e0  68 b4 00 00 00                    push    000000b4H
 02e5  e8 00 00 00 00                    call    __CHK
 02ea  53                                push    ebx
 02eb  51                                push    ecx
 02ec  52                                push    edx
 02ed  56                                push    esi
 02ee  57                                push    edi
 02ef  55                                push    ebp
 02f0  81 ec 8c 00 00 00                 sub     esp,0000008cH
 02f6  89 c2                             mov     edx,eax

  int MSG_BUFFER_SIZE=32;
  char msgBuffer[32];
  int readLen=0;
 02f8  bf 20 00 00 00                    mov     edi,00000020H

  XPortCommand xpCommand;
 02fd  8d 44 24 70                       lea     eax,+70H[esp]
 0301  e8 00 00 00 00                    call    near XPortCommand::XPortCommand()

  XPortResponse xpResponse;
  int test=0,disconnect=0;
  char hostName[MAXHOSTNAMELEN];

	//tid=(int)threadid;
	tid=(long)threadid;
 0306  8d 44 24 7c                       lea     eax,+7cH[esp]
 030a  e8 00 00 00 00                    call    near XPortResponse::XPortResponse()

  printdbg("GPIO listener: starting on port %ld thread tid=%d\n",GPIO_IP_PORT,tid);
 030f  52                                push    edx
 0310  68 f0 77 00 00                    push    000077f0H
 0315  68 a5 01 00 00                    push    offset L73
 031a  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 031f  83 c4 0c                          add     esp,0000000cH

  test=gethostname(hostName,MAXHOSTNAMELEN);


  /* create socket */
 0322  ba 40 00 00 00                    mov     edx,00000040H
 0327  89 e0                             mov     eax,esp
 0329  e8 00 00 00 00                    call    gethostname_

  sd = getListenerSocket(&sd,hostName,GPIO_IP_PORT,&svrAddr);
 032e  8d 4c 24 60                       lea     ecx,+60H[esp]
 0332  bb f0 77 00 00                    mov     ebx,000077f0H
 0337  89 e2                             mov     edx,esp
 0339  8d 84 24 84 00 00 
       00                                lea     eax,+84H[esp]
 0340  e8 00 00 00 00                    call    int near getListenerSocket( int near *, char near *, short unsigned, sockaddr_in near * )
 0345  89 84 24 84 00 00 
       00                                mov     +84H[esp],eax

  if(sd==ERROR){
 034c  83 f8 ff                          cmp     eax,0ffffffffH
 034f  75 11                             jne     L18

    perror("gpioListener: GPIO listener: cannot open socket\n");
 0351  b8 d8 01 00 00                    mov     eax,offset L74
 0356  e8 00 00 00 00    L17             call    perror_

    return NULL;//pthread_exit((void *)err);
  }

  while(1) {
 035b  31 c0                             xor     eax,eax
 035d  e9 56 01 00 00                    jmp     L26

    printdbg("GPIO listener: waiting on port %d sd=%d\n",GPIO_IP_PORT,sd);
 0362  8b 94 24 84 00 00 
       00                L18             mov     edx,+84H[esp]
 0369  52                                push    edx
 036a  68 f0 77 00 00                    push    000077f0H
 036f  68 09 02 00 00                    push    offset L75
 0374  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 0379  83 c4 0c                          add     esp,0000000cH

    listen(sd,2);    

 037c  ba 02 00 00 00                    mov     edx,00000002H
 0381  8b 84 24 84 00 00 
       00                                mov     eax,+84H[esp]
 0388  e8 00 00 00 00                    call    listen_

    svrLen = sizeof(svrAddr);
 038d  c7 84 24 88 00 00 
       00 10 00 00 00                    mov     dword ptr +88H[esp],00000010H

    newSd = accept(sd, (struct sockaddr *) &svrAddr, &svrLen);
 0398  8d 9c 24 88 00 00 
       00                                lea     ebx,+88H[esp]
 039f  8d 54 24 60                       lea     edx,+60H[esp]
 03a3  8b 84 24 84 00 00 
       00                                mov     eax,+84H[esp]
 03aa  e8 00 00 00 00                    call    accept_
 03af  89 c6                             mov     esi,eax

    if(newSd<0) {
 03b1  85 c0                             test    eax,eax
 03b3  7d 07                             jge     L19

      perror("GPIO listener: cannot accept connection ");
      //pthread_exit((void *)&err);
      return NULL;
    }
 03b5  b8 32 02 00 00                    mov     eax,offset L76
 03ba  eb 9a                             jmp     L17

    printdbg("GPIO listener: got GPIO connection from %s\n",inet_ntoa(svrAddr.sin_addr));

    /* wait for data */
 03bc  8b 44 24 64       L19             mov     eax,+64H[esp]
 03c0  e8 00 00 00 00                    call    inet_ntoa_
 03c5  50                                push    eax
 03c6  68 5b 02 00 00                    push    offset L77
 03cb  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 03d0  83 c4 08                          add     esp,00000008H

    disconnect=0;
 03d3  31 ed                             xor     ebp,ebp

    while(!disconnect){
      errno=0;
      readLen=recv(newSd, msgBuffer,MSG_BUFFER_SIZE,0);
      if(readLen<0){
	printdbg("GPIO listener: recv returned %d (errno=%d)\n",readLen,errno);
	switch(errno){
	case ENOTCONN:
	  disconnect=1;
	  break;
	default:
	  break;
	}
 03d5  e9 90 00 00 00                    jmp     L25

      }else if(readLen==0){
 03da  75 12             L20             jne     L21

	printdbg("GPIO listener: connection closed by client\n");
	disconnect=1;
 03dc  68 b3 02 00 00                    push    offset L79
 03e1  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 03e6  83 c4 04                          add     esp,00000004H

      }else{
 03e9  e9 74 ff ff ff                    jmp     L18

	if(readLen!=XPORT_COMMAND_LEN){
 03ee  83 f8 09          L21             cmp     eax,00000009H
 03f1  74 10                             je      L22

	  printdbg("GPIO listener: warning - invalid message length (%d!=%d)\n",readLen,XPORT_COMMAND_LEN);
	}
 03f3  6a 09                             push    00000009H
 03f5  50                                push    eax
 03f6  68 df 02 00 00                    push    offset L80
 03fb  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 0400  83 c4 0c                          add     esp,0000000cH

	test=xpCommand.parse(msgBuffer);
 0403  8d 54 24 40       L22             lea     edx,+40H[esp]
 0407  8d 44 24 70                       lea     eax,+70H[esp]
 040b  e8 00 00 00 00                    call    int near XPortCommand::parse( char const near * )

	if(test!=IS_VALID){
 0410  85 c0                             test    eax,eax
 0412  74 10                             je      L23

	  printdbg("GPIO listener: invalid command returned (%d)\n",test);
 0414  50                                push    eax
 0415  68 19 03 00 00                    push    offset L81
 041a  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 041f  83 c4 08                          add     esp,00000008H

	}else{
 0422  eb 3e                             jmp     L24

	  xpResponse.set(xpCommand.getCommand(),xpCommand.getP1());
	  //printdbg("GPIO listener: sending response:\n");
	  //showResponse(&xpResponse);
 0424  8d 44 24 70       L23             lea     eax,+70H[esp]
 0428  e8 00 00 00 00                    call    int unsigned near XPortCommand::getP1()
 042d  89 c3                             mov     ebx,eax
 042f  8d 44 24 70                       lea     eax,+70H[esp]
 0433  e8 00 00 00 00                    call    char unsigned near XPortCommand::getCommand()
 0438  31 d2                             xor     edx,edx
 043a  88 c2                             mov     dl,al
 043c  8d 44 24 7c                       lea     eax,+7cH[esp]
 0440  e8 00 00 00 00                    call    void near XPortResponse::set( char unsigned, int unsigned )

	  send(newSd,xpResponse.toBytes(msgBuffer),XPORT_RESPONSE_LEN,0);
 0445  8d 54 24 40                       lea     edx,+40H[esp]
 0449  8d 44 24 7c                       lea     eax,+7cH[esp]
 044d  e8 00 00 00 00                    call    char near * near XPortResponse::toBytes( char near * )
 0452  89 c2                             mov     edx,eax
 0454  31 c9                             xor     ecx,ecx
 0456  bb 05 00 00 00                    mov     ebx,00000005H
 045b  89 f0                             mov     eax,esi
 045d  e8 00 00 00 00                    call    send_

	}
      }
    } 
  }

  return NULL;//pthread_exit( (void *) err);

 0462  85 ed             L24             test    ebp,ebp
 0464  0f 85 f8 fe ff ff                 jne     L18
 046a  e8 00 00 00 00    L25             call    __get_errno_ptr_
 046f  c7 00 00 00 00 00                 mov     dword ptr [eax],00000000H
 0475  31 c9                             xor     ecx,ecx
 0477  89 fb                             mov     ebx,edi
 0479  8d 54 24 40                       lea     edx,+40H[esp]
 047d  89 f0                             mov     eax,esi
 047f  e8 00 00 00 00                    call    recv_
 0484  89 c2                             mov     edx,eax
 0486  85 c0                             test    eax,eax
 0488  0f 8d 4c ff ff ff                 jge     L20
 048e  e8 00 00 00 00                    call    __get_errno_ptr_
 0493  8b 08                             mov     ecx,[eax]
 0495  51                                push    ecx
 0496  52                                push    edx
 0497  68 87 02 00 00                    push    offset L78
 049c  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 04a1  83 c4 0c                          add     esp,0000000cH
 04a4  e8 00 00 00 00                    call    __get_errno_ptr_
 04a9  8b 00                             mov     eax,[eax]
 04ab  3d 01 01 00 00                    cmp     eax,00000101H
 04b0  0f 84 ac fe ff ff                 je      L18
 04b6  eb aa                             jmp     L24

}

 04b8  81 c4 8c 00 00 00 L26             add     esp,0000008cH
 04be  5d                L27             pop     ebp
 04bf  5f                                pop     edi
 04c0  5e                                pop     esi
 04c1  5a                                pop     edx
 04c2  59                                pop     ecx
 04c3  5b                                pop     ebx
 04c4  c3                                ret     

void *serialListener(void *threadid){
  int tid;
  int sd, newSd;
  SOCKLEN svrLen;
  struct sockaddr_in svrAddr;
 04c5                    void near * near serialListener( void near * ):
 04c5  68 80 01 00 00                    push    00000180H
 04ca  e8 00 00 00 00                    call    __CHK
 04cf  53                                push    ebx
 04d0  51                                push    ecx
 04d1  52                                push    edx
 04d2  56                                push    esi
 04d3  57                                push    edi
 04d4  55                                push    ebp
 04d5  81 ec 58 01 00 00                 sub     esp,00000158H

  int MSG_BUFFER_SIZE=256;
  char msgBuffer[256];
  int readLen=0;
  int disconnect=0;
  char hostName[MAXHOSTNAMELEN];
	//tid=(int)threadid;
	tid=(long)threadid;
 04db  be 00 01 00 00                    mov     esi,00000100H

  printdbg("SERIAL listener: starting on port %d thread tid=%ld\n",SERIAL_IP_PORT,tid);

 04e0  50                                push    eax
 04e1  68 11 27 00 00                    push    00002711H
 04e6  68 47 03 00 00                    push    offset L82
 04eb  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 04f0  83 c4 0c                          add     esp,0000000cH

  gethostname(hostName,MAXHOSTNAMELEN);

  /* create socket */
 04f3  ba 40 00 00 00                    mov     edx,00000040H
 04f8  8d 84 24 00 01 00 
       00                                lea     eax,+100H[esp]
 04ff  e8 00 00 00 00                    call    gethostname_

  sd = getListenerSocket(&sd,hostName,SERIAL_IP_PORT,&svrAddr);
 0504  8d 8c 24 40 01 00 
       00                                lea     ecx,+140H[esp]
 050b  bb 11 27 00 00                    mov     ebx,00002711H
 0510  8d 94 24 00 01 00 
       00                                lea     edx,+100H[esp]
 0517  8d 84 24 50 01 00 
       00                                lea     eax,+150H[esp]
 051e  e8 00 00 00 00                    call    int near getListenerSocket( int near *, char near *, short unsigned, sockaddr_in near * )
 0523  89 84 24 50 01 00 
       00                                mov     +150H[esp],eax

  if(sd==ERROR){
 052a  83 f8 ff                          cmp     eax,0ffffffffH
 052d  75 11                             jne     L29

    perror("SERIAL listener: cannot open socket");
 052f  b8 7c 03 00 00                    mov     eax,offset L83
 0534  e8 00 00 00 00    L28             call    perror_

    return NULL;//pthread_exit((void *)err);
  }

  while(1) {
 0539  31 c0                             xor     eax,eax
 053b  e9 ff 00 00 00                    jmp     L37

    printdbg("SERIAL listener: waiting on port %d sd=%d\n",SERIAL_IP_PORT,sd);
 0540  8b 94 24 50 01 00 
       00                L29             mov     edx,+150H[esp]
 0547  52                                push    edx
 0548  68 11 27 00 00                    push    00002711H
 054d  68 a0 03 00 00                    push    offset L84
 0552  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 0557  83 c4 0c                          add     esp,0000000cH

    listen(sd,2);    

 055a  ba 02 00 00 00                    mov     edx,00000002H
 055f  8b 84 24 50 01 00 
       00                                mov     eax,+150H[esp]
 0566  e8 00 00 00 00                    call    listen_

    svrLen = sizeof(svrAddr);
 056b  c7 84 24 54 01 00 
       00 10 00 00 00                    mov     dword ptr +154H[esp],00000010H

    newSd = accept(sd, (struct sockaddr *) &svrAddr, &svrLen);
 0576  8d 9c 24 54 01 00 
       00                                lea     ebx,+154H[esp]
 057d  8d 94 24 40 01 00 
       00                                lea     edx,+140H[esp]
 0584  8b 84 24 50 01 00 
       00                                mov     eax,+150H[esp]
 058b  e8 00 00 00 00                    call    accept_
 0590  89 c5                             mov     ebp,eax

    if(newSd<0) {
 0592  85 c0                             test    eax,eax
 0594  7d 07                             jge     L30

      perror("SERIAL listener: cannot accept connection ");
       return NULL;//pthread_exit((void *)err);
    }
 0596  b8 cb 03 00 00                    mov     eax,offset L85
 059b  eb 97                             jmp     L28

    printdbg("SERIAL listener: got SERIAL connection from %s\n",inet_ntoa(svrAddr.sin_addr));

    /* wait for data */
 059d  8b 84 24 44 01 00 
       00                L30             mov     eax,+144H[esp]
 05a4  e8 00 00 00 00                    call    inet_ntoa_
 05a9  50                                push    eax
 05aa  68 f6 03 00 00                    push    offset L86
 05af  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 05b4  83 c4 08                          add     esp,00000008H

    disconnect=0;
 05b7  31 ff                             xor     edi,edi

    while(!disconnect){
      errno=0;
      readLen=recv(newSd, msgBuffer,MSG_BUFFER_SIZE,0);
      if(readLen<0){
 05b9  eb 4d                             jmp     L35

	printdbg("SERIAL listener: recv returned %d (errno=%d)\n",readLen,errno);
 05bb  e8 00 00 00 00    L31             call    __get_errno_ptr_
 05c0  8b 08                             mov     ecx,[eax]
 05c2  51                                push    ecx
 05c3  52                                push    edx
 05c4  68 26 04 00 00                    push    offset L87
 05c9  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 05ce  83 c4 0c                          add     esp,0000000cH

	switch(errno){
	case ENOTCONN:
	  disconnect=1;
	  break;
	default:
	  break;
	}
 05d1  e8 00 00 00 00                    call    __get_errno_ptr_
 05d6  8b 00                             mov     eax,[eax]
 05d8  3d 01 01 00 00                    cmp     eax,00000101H
 05dd  74 11                             je      L33
 05df  eb 14                             jmp     L34

      }else if(readLen==0){
 05e1  75 45             L32             jne     L36

	printdbg("SERIAL listener: connection closed by client\n");
	disconnect=1;
      }else{
 05e3  68 54 04 00 00                    push    offset L88
 05e8  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 05ed  83 c4 04                          add     esp,00000004H
 05f0  bf 01 00 00 00    L33             mov     edi,00000001H
 05f5  89 f3             L34             mov     ebx,esi
 05f7  31 d2                             xor     edx,edx
 05f9  89 e0                             mov     eax,esp
 05fb  e8 00 00 00 00                    call    memset_
 0600  85 ff                             test    edi,edi
 0602  0f 85 38 ff ff ff                 jne     L29
 0608  e8 00 00 00 00    L35             call    __get_errno_ptr_
 060d  c7 00 00 00 00 00                 mov     dword ptr [eax],00000000H
 0613  31 c9                             xor     ecx,ecx
 0615  89 f3                             mov     ebx,esi
 0617  89 e2                             mov     edx,esp
 0619  89 e8                             mov     eax,ebp
 061b  e8 00 00 00 00                    call    recv_
 0620  89 c2                             mov     edx,eax
 0622  85 c0                             test    eax,eax
 0624  7c 95                             jl      L31
 0626  eb b9                             jmp     L32

	msgBuffer[MSG_BUFFER_SIZE]='\0';
 0628  30 e4             L36             xor     ah,ah
 062a  88 24 34                          mov     [esp+esi],ah

	printdbg("Serial listener received message:[%s]\n",msgBuffer);
 062d  89 e0                             mov     eax,esp
 062f  50                                push    eax
 0630  68 82 04 00 00                    push    offset L89
 0635  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 063a  83 c4 08                          add     esp,00000008H

      }
      memset(&msgBuffer[0],0x00,MSG_BUFFER_SIZE);
    } 
  }

  return NULL;//pthread_exit( (void *) err);

 063d  eb b6                             jmp     L34

}
/*
void startMockXPortThreads(char *host){
  pthread_t threads[NUM_THREADS];
  pthread_attr_t pthread_custom_attr;
  int rc,i=0,j=1;

  /// fork a process to act as an XPort stand-in 
  mockXPortPID=fork();

  if( mockXPortPID == -1){
    perror("fork");
    exit(EXIT_FAILURE);
  }
  if( mockXPortPID == 0){
    printdbg("mock xport PID %ld on host %s\n",(long)getpid(),host);

    // spin threads to listen on different ports 
    pthread_attr_init(&pthread_custom_attr);

    rc=pthread_create(&threads[0],&pthread_custom_attr,gpioListener,(void *)i);
    if(rc!=0)
      printdbg("error creating gpio listener: %d\n",rc);

    rc=pthread_create(&threads[1],&pthread_custom_attr,serialListener,(void *)j);
    if(rc!=0)
      printdbg("error creating serial listener: %d\n",rc);

    printdbg("mock XPort listening...\n");
    pthread_join(threads[0],NULL);
    pthread_join(threads[1],NULL);
    printdbg("mock XPort exiting\n");
    return;//_exit(-1);
  }
  printdbg("sleeping 2 sec\n");
  sleep(2);

  return;  
}
*/
 063f  81 c4 58 01 00 00 L37             add     esp,00000158H
 0645  e9 74 fe ff ff                    jmp     L27

void startMockXPort(char *host){
  unsigned foo;
  /* fork processes to act as an XPort stand-in
     One listens for GPIO and the other for serial
     connections.
  */
 064a                    void near startMockXPort( char near * ):
 064a  68 14 00 00 00                    push    00000014H
 064f  e8 00 00 00 00                    call    __CHK
 0654  52                                push    edx
 0655  89 c2                             mov     edx,eax

  gpioPID=fork();

 0657  e8 00 00 00 00                    call    fork_
 065c  a3 00 00 00 00                    mov     int near gpioPID,eax

  if( gpioPID == -1){
 0661  83 f8 ff                          cmp     eax,0ffffffffH
 0664  75 14                             jne     L38

    perror("startMockXPort: gpio fork");
 0666  b8 a9 04 00 00                    mov     eax,offset L90
 066b  e8 00 00 00 00                    call    perror_

    exit(EXIT_FAILURE);
  }
 0670  b8 01 00 00 00                    mov     eax,00000001H
 0675  e8 00 00 00 00                    call    exit_

  if( gpioPID == 0){
 067a  83 3d 00 00 00 00 
       00                L38             cmp     dword ptr int near gpioPID,00000000H
 0681  75 25                             jne     L39

    printdbg("startMockXPort: gpio PID %ld on host %s\n",(long)getpid(),host);
 0683  52                                push    edx
 0684  e8 00 00 00 00                    call    getpid_
 0689  50                                push    eax
 068a  68 c3 04 00 00                    push    offset L91
 068f  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 0694  83 c4 0c                          add     esp,0000000cH

    gpioListener(NULL);
 0697  31 c0                             xor     eax,eax
 0699  e8 00 00 00 00                    call    void near * near gpioListener( void near * )

    _exit(-1);
  }

 069e  b8 ff ff ff ff                    mov     eax,0ffffffffH
 06a3  e8 00 00 00 00                    call    _exit_

  errno=0;
 06a8  e8 00 00 00 00    L39             call    __get_errno_ptr_
 06ad  c7 00 00 00 00 00                 mov     dword ptr [eax],00000000H

  foo=sleep(2);

 06b3  b8 02 00 00 00                    mov     eax,00000002H
 06b8  e8 00 00 00 00                    call    sleep_

  serialPID=fork();

 06bd  e8 00 00 00 00                    call    fork_
 06c2  a3 00 00 00 00                    mov     int near serialPID,eax

  if( serialPID == -1){
 06c7  83 f8 ff                          cmp     eax,0ffffffffH
 06ca  75 14                             jne     L40

    perror("startMockXPort: serial fork");
 06cc  b8 ec 04 00 00                    mov     eax,offset L92
 06d1  e8 00 00 00 00                    call    perror_

    exit(EXIT_FAILURE);
  }
 06d6  b8 01 00 00 00                    mov     eax,00000001H
 06db  e8 00 00 00 00                    call    exit_

  if( serialPID == 0){
 06e0  83 3d 00 00 00 00 
       00                L40             cmp     dword ptr int near serialPID,00000000H
 06e7  75 25                             jne     L41

    printdbg("startMockXPort: serial PID %ld on host %s\n",(long)getpid(),host);
 06e9  52                                push    edx
 06ea  e8 00 00 00 00                    call    getpid_
 06ef  50                                push    eax
 06f0  68 08 05 00 00                    push    offset L93
 06f5  e8 00 00 00 00                    call    void near printdbg( char near *, ... )
 06fa  83 c4 0c                          add     esp,0000000cH

    serialListener(NULL);
 06fd  31 c0                             xor     eax,eax
 06ff  e8 00 00 00 00                    call    void near * near serialListener( void near * )

    _exit(-1);
  }

  return;  
 0704  b8 ff ff ff ff                    mov     eax,0ffffffffH
 0709  e8 00 00 00 00                    call    _exit_

}

/* Main Entry Point */
 070e  5a                L41             pop     edx
 070f  c3                                ret     

int main (int argc, char *argv[]){
  char xportHost[MAXHOSTNAMELEN+1];
 0710  68 1c 01 00 00    main_           push    0000011cH
 0715  e8 00 00 00 00                    call    __CHK
 071a  53                                push    ebx
 071b  51                                push    ecx
 071c  56                                push    esi
 071d  57                                push    edi
 071e  81 ec f8 00 00 00                 sub     esp,000000f8H

  int test,passed=0,failed=0;
 0724  31 f6                             xor     esi,esi
 0726  31 ff                             xor     edi,edi

  XPort xport(xportHost,
	      GPIO_IP_PORT,SERIAL_IP_PORT,
	      CFG_GPIO_ALL,CFG_GPIO_OUT,
	      CFG_GPIO_ALL,CFG_GPIO_HI);

 0728  68 ff 00 00 00                    push    000000ffH
 072d  68 ff 00 00 00                    push    000000ffH
 0732  68 ff 00 00 00                    push    000000ffH
 0737  68 ff 00 00 00                    push    000000ffH
 073c  b9 11 27 00 00                    mov     ecx,00002711H
 0741  bb f0 77 00 00                    mov     ebx,000077f0H
 0746  8d 54 24 10                       lea     edx,+10H[esp]
 074a  8d 84 24 c0 00 00 
       00                                lea     eax,+0c0H[esp]
 0751  e8 00 00 00 00                    call    near XPort::XPort( char near *, int unsigned, int unsigned, int unsigned, int unsigned, int unsigned, int unsigned )

  errno=0;
 0756  e8 00 00 00 00                    call    __get_errno_ptr_
 075b  89 30                             mov     [eax],esi

  test=gethostname(xportHost,MAXHOSTNAMELEN);
 075d  ba 40 00 00 00                    mov     edx,00000040H
 0762  89 e0                             mov     eax,esp
 0764  e8 00 00 00 00                    call    gethostname_

  if(test<0)
 0769  85 c0                             test    eax,eax
 076b  7d 27                             jge     L42

    cout<<"gethostname failed errno "<<errno<<endl;
 076d  e8 00 00 00 00                    call    __get_errno_ptr_
 0772  89 c3                             mov     ebx,eax
 0774  ba 33 05 00 00                    mov     edx,offset L94
 0779  b8 00 00 00 00                    mov     eax,offset ostream near cout
 077e  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0783  8b 13                             mov     edx,[ebx]
 0785  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( long )
 078a  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 078f  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  cout<<"starting xport simulated server on "<< xportHost <<"..."<<endl;
 0794  ba 51 05 00 00    L42             mov     edx,offset L96
 0799  b8 00 00 00 00                    mov     eax,offset ostream near cout
 079e  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 07a3  89 e2                             mov     edx,esp
 07a5  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 07aa  ba 4d 05 00 00                    mov     edx,offset L95
 07af  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 07b4  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 07b9  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  startMockXPort(xportHost);
 07be  89 e0                             mov     eax,esp
 07c0  e8 00 00 00 00                    call    void near startMockXPort( char near * )

  sleep(2);

 07c5  b8 02 00 00 00                    mov     eax,00000002H
 07ca  e8 00 00 00 00                    call    sleep_

  cout<<"connecting to server..."<<endl;
 07cf  ba 75 05 00 00                    mov     edx,offset L97
 07d4  b8 00 00 00 00                    mov     eax,offset ostream near cout
 07d9  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 07de  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 07e3  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  xport.getConnection()->configAll(xportHost,
				   GPIO_IP_PORT,SERIAL_IP_PORT,
				   CFG_GPIO_ALL,CFG_GPIO_OUT,
				   CFG_GPIO_ALL,CFG_GPIO_HI);

  
 07e8  68 ff 00 00 00                    push    000000ffH
 07ed  68 ff 00 00 00                    push    000000ffH
 07f2  68 ff 00 00 00                    push    000000ffH
 07f7  68 ff 00 00 00                    push    000000ffH
 07fc  8d 84 24 c0 00 00 
       00                                lea     eax,+0c0H[esp]
 0803  e8 00 00 00 00                    call    XPortConnection near * near XPort::getConnection()
 0808  b9 11 27 00 00                    mov     ecx,00002711H
 080d  bb f0 77 00 00                    mov     ebx,000077f0H
 0812  8d 54 24 10                       lea     edx,+10H[esp]
 0816  e8 00 00 00 00                    call    int near XPortConnection::configAll( char near *, int unsigned, int unsigned, int unsigned, int unsigned, int unsigned, int unsigned )

  test=testConnectXPort(&xport);
 081b  8d 84 24 b0 00 00 
       00                                lea     eax,+0b0H[esp]
 0822  e8 00 00 00 00                    call    int near testConnectXPort( XPort near * )

  (test==TEST_OK?passed++:failed++);
 0827  85 c0                             test    eax,eax
 0829  75 03                             jne     L43
 082b  46                                inc     esi
 082c  eb 01                             jmp     L44
 082e  47                L43             inc     edi

  cout << "main: test connectXport: "<<(test==TEST_OK?"OK":"ERR");
 082f  85 c0             L44             test    eax,eax
 0831  75 07                             jne     L45
 0833  bb 8d 05 00 00                    mov     ebx,offset L98
 0838  eb 05                             jmp     L46
 083a  bb 90 05 00 00    L45             mov     ebx,offset L99
 083f  ba 94 05 00 00    L46             mov     edx,offset L100
 0844  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0849  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 084e  89 da                             mov     edx,ebx
 0850  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )

  cout << "(sdGPIO="<<xport.getConnection()->getsdGPIO()<<") ";
 0855  8d 84 24 b0 00 00 
       00                                lea     eax,+0b0H[esp]
 085c  e8 00 00 00 00                    call    XPortConnection near * near XPort::getConnection()
 0861  e8 00 00 00 00                    call    int near XPortConnection::getsdGPIO()
 0866  89 c3                             mov     ebx,eax
 0868  ba b1 05 00 00                    mov     edx,offset L102
 086d  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0872  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0877  89 da                             mov     edx,ebx
 0879  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( long )
 087e  ba ae 05 00 00                    mov     edx,offset L101
 0883  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )

  cout << "(sdSerial="<<xport.getConnection()->getsdSerial()<<")"<<endl;
 
 0888  8d 84 24 b0 00 00 
       00                                lea     eax,+0b0H[esp]
 088f  e8 00 00 00 00                    call    XPortConnection near * near XPort::getConnection()
 0894  e8 00 00 00 00                    call    int near XPortConnection::getsdSerial()
 0899  89 c3                             mov     ebx,eax
 089b  ba bc 05 00 00                    mov     edx,offset L104
 08a0  b8 00 00 00 00                    mov     eax,offset ostream near cout
 08a5  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 08aa  89 da                             mov     edx,ebx
 08ac  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( long )
 08b1  ba ba 05 00 00                    mov     edx,offset L103
 08b6  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 08bb  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 08c0  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  test=testWriteCommand(xport);
 08c5  8b 84 24 b0 00 00 
       00                                mov     eax,+0b0H[esp]
 08cc  89 84 24 d4 00 00 
       00                                mov     +0d4H[esp],eax
 08d3  8b 84 24 b4 00 00 
       00                                mov     eax,+0b4H[esp]
 08da  89 84 24 d8 00 00 
       00                                mov     +0d8H[esp],eax
 08e1  8b 84 24 b8 00 00 
       00                                mov     eax,+0b8H[esp]
 08e8  89 84 24 dc 00 00 
       00                                mov     +0dcH[esp],eax
 08ef  8b 84 24 bc 00 00 
       00                                mov     eax,+0bcH[esp]
 08f6  89 84 24 e0 00 00 
       00                                mov     +0e0H[esp],eax
 08fd  8b 84 24 c0 00 00 
       00                                mov     eax,+0c0H[esp]
 0904  89 84 24 e4 00 00 
       00                                mov     +0e4H[esp],eax
 090b  8b 84 24 c4 00 00 
       00                                mov     eax,+0c4H[esp]
 0912  89 84 24 e8 00 00 
       00                                mov     +0e8H[esp],eax
 0919  8b 84 24 c8 00 00 
       00                                mov     eax,+0c8H[esp]
 0920  89 84 24 ec 00 00 
       00                                mov     +0ecH[esp],eax
 0927  8b 84 24 cc 00 00 
       00                                mov     eax,+0ccH[esp]
 092e  89 84 24 f0 00 00 
       00                                mov     +0f0H[esp],eax
 0935  8b 84 24 d0 00 00 
       00                                mov     eax,+0d0H[esp]
 093c  89 84 24 f4 00 00 
       00                                mov     +0f4H[esp],eax
 0943  8d 84 24 d4 00 00 
       00                                lea     eax,+0d4H[esp]
 094a  e8 00 00 00 00                    call    int near testWriteCommand( XPort )

  (test==TEST_OK?passed++:failed++);
 094f  85 c0                             test    eax,eax
 0951  75 03                             jne     L47
 0953  46                                inc     esi
 0954  eb 01                             jmp     L48
 0956  47                L47             inc     edi

  cout << "main: test sendCommand: "<<(test==TEST_OK?"OK":"ERR")<<endl;

 0957  b9 00 00 00 00    L48             mov     ecx,offset ostream near & near endl( ostream near & )
 095c  85 c0                             test    eax,eax
 095e  75 07                             jne     L49
 0960  bb c7 05 00 00                    mov     ebx,offset L105
 0965  eb 05                             jmp     L50
 0967  bb ca 05 00 00    L49             mov     ebx,offset L106
 096c  ba ce 05 00 00    L50             mov     edx,offset L107
 0971  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0976  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 097b  89 da                             mov     edx,ebx
 097d  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0982  89 ca                             mov     edx,ecx
 0984  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  test=testReadResponse(xport);
 0989  8b 84 24 b0 00 00 
       00                                mov     eax,+0b0H[esp]
 0990  89 44 24 68                       mov     +68H[esp],eax
 0994  8b 84 24 b4 00 00 
       00                                mov     eax,+0b4H[esp]
 099b  89 44 24 6c                       mov     +6cH[esp],eax
 099f  8b 84 24 b8 00 00 
       00                                mov     eax,+0b8H[esp]
 09a6  89 44 24 70                       mov     +70H[esp],eax
 09aa  8b 84 24 bc 00 00 
       00                                mov     eax,+0bcH[esp]
 09b1  89 44 24 74                       mov     +74H[esp],eax
 09b5  8b 84 24 c0 00 00 
       00                                mov     eax,+0c0H[esp]
 09bc  89 44 24 78                       mov     +78H[esp],eax
 09c0  8b 84 24 c4 00 00 
       00                                mov     eax,+0c4H[esp]
 09c7  89 44 24 7c                       mov     +7cH[esp],eax
 09cb  8b 84 24 c8 00 00 
       00                                mov     eax,+0c8H[esp]
 09d2  89 84 24 80 00 00 
       00                                mov     +80H[esp],eax
 09d9  8b 84 24 cc 00 00 
       00                                mov     eax,+0ccH[esp]
 09e0  89 84 24 84 00 00 
       00                                mov     +84H[esp],eax
 09e7  8b 84 24 d0 00 00 
       00                                mov     eax,+0d0H[esp]
 09ee  89 84 24 88 00 00 
       00                                mov     +88H[esp],eax
 09f5  8d 44 24 68                       lea     eax,+68H[esp]
 09f9  e8 00 00 00 00                    call    int near testReadResponse( XPort )

  (test==TEST_OK?passed++:failed++);
 09fe  85 c0                             test    eax,eax
 0a00  75 03                             jne     L51
 0a02  46                                inc     esi
 0a03  eb 01                             jmp     L52
 0a05  47                L51             inc     edi

  cout << "main: test readResponse: "<<(test==TEST_OK?"OK":"ERR")<<endl;

 0a06  b9 00 00 00 00    L52             mov     ecx,offset ostream near & near endl( ostream near & )
 0a0b  85 c0                             test    eax,eax
 0a0d  75 07                             jne     L53
 0a0f  bb e7 05 00 00                    mov     ebx,offset L108
 0a14  eb 05                             jmp     L54
 0a16  bb ea 05 00 00    L53             mov     ebx,offset L109
 0a1b  ba ee 05 00 00    L54             mov     edx,offset L110
 0a20  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0a25  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0a2a  89 da                             mov     edx,ebx
 0a2c  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0a31  89 ca                             mov     edx,ecx
 0a33  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  test=testWriteSerial(xport);
 0a38  8b 84 24 b0 00 00 
       00                                mov     eax,+0b0H[esp]
 0a3f  89 84 24 8c 00 00 
       00                                mov     +8cH[esp],eax
 0a46  8b 84 24 b4 00 00 
       00                                mov     eax,+0b4H[esp]
 0a4d  89 84 24 90 00 00 
       00                                mov     +90H[esp],eax
 0a54  8b 84 24 b8 00 00 
       00                                mov     eax,+0b8H[esp]
 0a5b  89 84 24 94 00 00 
       00                                mov     +94H[esp],eax
 0a62  8b 84 24 bc 00 00 
       00                                mov     eax,+0bcH[esp]
 0a69  89 84 24 98 00 00 
       00                                mov     +98H[esp],eax
 0a70  8b 84 24 c0 00 00 
       00                                mov     eax,+0c0H[esp]
 0a77  89 84 24 9c 00 00 
       00                                mov     +9cH[esp],eax
 0a7e  8b 84 24 c4 00 00 
       00                                mov     eax,+0c4H[esp]
 0a85  89 84 24 a0 00 00 
       00                                mov     +0a0H[esp],eax
 0a8c  8b 84 24 c8 00 00 
       00                                mov     eax,+0c8H[esp]
 0a93  89 84 24 a4 00 00 
       00                                mov     +0a4H[esp],eax
 0a9a  8b 84 24 cc 00 00 
       00                                mov     eax,+0ccH[esp]
 0aa1  89 84 24 a8 00 00 
       00                                mov     +0a8H[esp],eax
 0aa8  8b 84 24 d0 00 00 
       00                                mov     eax,+0d0H[esp]
 0aaf  89 84 24 ac 00 00 
       00                                mov     +0acH[esp],eax
 0ab6  8d 84 24 8c 00 00 
       00                                lea     eax,+8cH[esp]
 0abd  e8 00 00 00 00                    call    int near testWriteSerial( XPort )

  (test==TEST_OK?passed++:failed++);
 0ac2  85 c0                             test    eax,eax
 0ac4  75 03                             jne     L55
 0ac6  46                                inc     esi
 0ac7  eb 01                             jmp     L56
 0ac9  47                L55             inc     edi

  cout << "main: test writeSerial: "<<(test==TEST_OK?"OK":"ERR")<<endl;

 0aca  b9 00 00 00 00    L56             mov     ecx,offset ostream near & near endl( ostream near & )
 0acf  85 c0                             test    eax,eax
 0ad1  75 07                             jne     L57
 0ad3  bb 08 06 00 00                    mov     ebx,offset L111
 0ad8  eb 05                             jmp     L58
 0ada  bb 0b 06 00 00    L57             mov     ebx,offset L112
 0adf  ba 0f 06 00 00    L58             mov     edx,offset L113
 0ae4  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0ae9  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0aee  89 da                             mov     edx,ebx
 0af0  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0af5  89 ca                             mov     edx,ecx
 0af7  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  cout<<"main: disconnecting XPort"<<endl;
 0afc  ba 28 06 00 00                    mov     edx,offset L114
 0b01  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0b06  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0b0b  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 0b10  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  test=testDisconnectXPort(xport);
 0b15  8b 84 24 b0 00 00 
       00                                mov     eax,+0b0H[esp]
 0b1c  89 44 24 44                       mov     +44H[esp],eax
 0b20  8b 84 24 b4 00 00 
       00                                mov     eax,+0b4H[esp]
 0b27  89 44 24 48                       mov     +48H[esp],eax
 0b2b  8b 84 24 b8 00 00 
       00                                mov     eax,+0b8H[esp]
 0b32  89 44 24 4c                       mov     +4cH[esp],eax
 0b36  8b 84 24 bc 00 00 
       00                                mov     eax,+0bcH[esp]
 0b3d  89 44 24 50                       mov     +50H[esp],eax
 0b41  8b 84 24 c0 00 00 
       00                                mov     eax,+0c0H[esp]
 0b48  89 44 24 54                       mov     +54H[esp],eax
 0b4c  8b 84 24 c4 00 00 
       00                                mov     eax,+0c4H[esp]
 0b53  89 44 24 58                       mov     +58H[esp],eax
 0b57  8b 84 24 c8 00 00 
       00                                mov     eax,+0c8H[esp]
 0b5e  89 44 24 5c                       mov     +5cH[esp],eax
 0b62  8b 84 24 cc 00 00 
       00                                mov     eax,+0ccH[esp]
 0b69  89 44 24 60                       mov     +60H[esp],eax
 0b6d  8b 84 24 d0 00 00 
       00                                mov     eax,+0d0H[esp]
 0b74  89 44 24 64                       mov     +64H[esp],eax
 0b78  8d 44 24 44                       lea     eax,+44H[esp]
 0b7c  e8 00 00 00 00                    call    int near testDisconnectXPort( XPort )

  (test==TEST_OK?passed++:failed++);
 0b81  85 c0                             test    eax,eax
 0b83  75 03                             jne     L59
 0b85  46                                inc     esi
 0b86  eb 01                             jmp     L60
 0b88  47                L59             inc     edi

  cout << "main: test disconnectXPort: "<<(test==TEST_OK?"OK":"ERR")<<endl;

 0b89  b9 00 00 00 00    L60             mov     ecx,offset ostream near & near endl( ostream near & )
 0b8e  85 c0                             test    eax,eax
 0b90  75 07                             jne     L61
 0b92  bb 42 06 00 00                    mov     ebx,offset L115
 0b97  eb 05                             jmp     L62
 0b99  bb 45 06 00 00    L61             mov     ebx,offset L116
 0b9e  ba 49 06 00 00    L62             mov     edx,offset L117
 0ba3  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0ba8  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0bad  89 da                             mov     edx,ebx
 0baf  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0bb4  89 ca                             mov     edx,ecx
 0bb6  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  cout<<"main: killing GPIO server"<<endl;
 0bbb  ba 66 06 00 00                    mov     edx,offset L118
 0bc0  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0bc5  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0bca  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 0bcf  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  kill(gpioPID,SIGKILL);
 0bd4  a1 00 00 00 00                    mov     eax,int near gpioPID
 0bd9  ba 09 00 00 00                    mov     edx,00000009H
 0bde  e8 00 00 00 00                    call    kill_

  cout<<"main: killing SERIAL server"<<endl;
 0be3  ba 80 06 00 00                    mov     edx,offset L119
 0be8  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0bed  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0bf2  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 0bf7  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  kill(serialPID,SIGKILL);
 0bfc  a1 00 00 00 00                    mov     eax,int near serialPID
 0c01  ba 09 00 00 00                    mov     edx,00000009H
 0c06  e8 00 00 00 00                    call    kill_

  cout<<"main: done - "<<passed<<" tests passed "<<failed<<" tests failed"<<endl;

 0c0b  ba b9 06 00 00                    mov     edx,offset L122
 0c10  b8 00 00 00 00                    mov     eax,offset ostream near cout
 0c15  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0c1a  89 f2                             mov     edx,esi
 0c1c  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( long )
 0c21  ba aa 06 00 00                    mov     edx,offset L121
 0c26  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0c2b  89 fa                             mov     edx,edi
 0c2d  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( long )
 0c32  ba 9c 06 00 00                    mov     edx,offset L120
 0c37  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( char const near * )
 0c3c  ba 00 00 00 00                    mov     edx,offset ostream near & near endl( ostream near & )
 0c41  e8 00 00 00 00                    call    ostream near & near ostream::operator <<( ostream near & (near *)( ))

  exit(EXIT_SUCCESS);

  return 0;
 0c46  31 c0                             xor     eax,eax
 0c48  e8 00 00 00 00                    call    exit_

} 
 0c4d  31 c0                             xor     eax,eax
 0c4f  81 c4 f8 00 00 00                 add     esp,000000f8H
 0c55  5f                                pop     edi
 0c56  5e                                pop     esi
 0c57  59                                pop     ecx
 0c58  5b                                pop     ebx
 0c59  c3                                ret     

No disassembly errors

------------------------------------------------------------

Segment: CONST  DWORD USE32  000006c7 bytes  
 0000  74 65 73 74 43 6f 6e 6e L63             - testConn
 0008  65 63 74 58 50 6f 72 74                 - ectXPort
 0010  3a 20 68 6f 73 74 3a 25                 - : host:%
 0018  73 20 67 70 69 6f 50 6f                 - s gpioPo
 0020  72 74 3a 25 64 20 73 65                 - rt:%d se
 0028  72 69 61 6c 50 6f 72 74                 - rialPort
 0030  3a 25 64 20 0a 00                       - :%d ..
 0036  74 68 69 73 20 69 73 20 L64             - this is 
 003e  61 20 74 65 73 74 20 6d                 - a test m
 0046  65 73 73 61 67 65 0a 00                 - essage..
 004e  74 65 73 74 57 72 69 74 L65             - testWrit
 0056  65 53 65 72 69 61 6c 3a                 - eSerial:
 005e  20 66 61 69 6c 65 64 3b                 -  failed;
 0066  20 72 65 74 75 72 6e 65                 -  returne
 006e  64 20 00                                - d .
 0071  67 65 74 4c 69 73 74 65 L66             - getListe
 0079  6e 65 72 53 6f 63 6b 65                 - nerSocke
 0081  74 3a 20 73 65 74 74 69                 - t: setti
 0089  6e 67 20 75 70 20 6c 69                 - ng up li
 0091  73 74 65 6e 65 72 20 6f                 - stener o
 0099  6e 20 25 73 20 70 6f 72                 - n %s por
 00a1  74 20 25 64 20 28 25 68                 - t %d (%h
 00a9  75 29 0a 00                             - u)..
 00ad  67 65 74 4c 69 73 74 65 L67             - getListe
 00b5  6e 65 72 53 6f 63 6b 65                 - nerSocke
 00bd  74 3a 20 63 61 6e 6e 6f                 - t: canno
 00c5  74 20 6f 70 65 6e 20 73                 - t open s
 00cd  6f 63 6b 65 74 20 00                    - ocket .
 00d4  67 65 74 4c 69 73 74 65 L68             - getListe
 00dc  6e 65 72 53 6f 63 6b 65                 - nerSocke
 00e4  74 3a 20 67 6f 74 20 73                 - t: got s
 00ec  6f 63 6b 65 74 20 28 25                 - ocket (%
 00f4  64 29 0a 00                             - d)..
 00f8  67 65 74 4c 69 73 74 65 L69             - getListe
 0100  6e 65 72 53 6f 63 6b 65                 - nerSocke
 0108  74 3a 20 63 61 6c 6c 69                 - t: calli
 0110  6e 67 20 67 65 74 68 6f                 - ng getho
 0118  73 74 62 79 6e 61 6d 65                 - stbyname
 0120  20 25 73 0a 00                          -  %s..
 0125  67 65 74 4c 69 73 74 65 L70             - getListe
 012d  6e 65 72 53 6f 63 6b 65                 - nerSocke
 0135  74 3a 20 75 6e 6b 6e 6f                 - t: unkno
 013d  77 6e 20 68 6f 73 74 20                 - wn host 
 0145  27 25 73 27 20 28 25 64                 - '%s' (%d
 014d  29 0a 00                                - )..
 0150  67 65 74 4c 69 73 74 65 L71             - getListe
 0158  6e 65 72 53 6f 63 6b 65                 - nerSocke
 0160  74 3a 20 67 65 74 68 6f                 - t: getho
 0168  73 74 62 79 6e 61 6d 65                 - stbyname
 0170  20 63 6f 6d 70 6c 65 74                 -  complet
 0178  65 0a 00                                - e..
 017b  67 65 74 4c 69 73 74 65 L72             - getListe
 0183  6e 65 72 53 6f 63 6b 65                 - nerSocke
 018b  74 3a 20 63 61 6e 6e 6f                 - t: canno
 0193  74 20 62 69 6e 64 20 70                 - t bind p
 019b  6f 72 74 20 28 25 64 29                 - ort (%d)
 01a3  0a 00                                   - ..
 01a5  47 50 49 4f 20 6c 69 73 L73             - GPIO lis
 01ad  74 65 6e 65 72 3a 20 73                 - tener: s
 01b5  74 61 72 74 69 6e 67 20                 - tarting 
 01bd  6f 6e 20 70 6f 72 74 20                 - on port 
 01c5  25 6c 64 20 74 68 72 65                 - %ld thre
 01cd  61 64 20 74 69 64 3d 25                 - ad tid=%
 01d5  64 0a 00                                - d..
 01d8  67 70 69 6f 4c 69 73 74 L74             - gpioList
 01e0  65 6e 65 72 3a 20 47 50                 - ener: GP
 01e8  49 4f 20 6c 69 73 74 65                 - IO liste
 01f0  6e 65 72 3a 20 63 61 6e                 - ner: can
 01f8  6e 6f 74 20 6f 70 65 6e                 - not open
 0200  20 73 6f 63 6b 65 74 0a                 -  socket.
 0208  00                                      - .
 0209  47 50 49 4f 20 6c 69 73 L75             - GPIO lis
 0211  74 65 6e 65 72 3a 20 77                 - tener: w
 0219  61 69 74 69 6e 67 20 6f                 - aiting o
 0221  6e 20 70 6f 72 74 20 25                 - n port %
 0229  64 20 73 64 3d 25 64 0a                 - d sd=%d.
 0231  00                                      - .
 0232  47 50 49 4f 20 6c 69 73 L76             - GPIO lis
 023a  74 65 6e 65 72 3a 20 63                 - tener: c
 0242  61 6e 6e 6f 74 20 61 63                 - annot ac
 024a  63 65 70 74 20 63 6f 6e                 - cept con
 0252  6e 65 63 74 69 6f 6e 20                 - nection 
 025a  00                                      - .
 025b  47 50 49 4f 20 6c 69 73 L77             - GPIO lis
 0263  74 65 6e 65 72 3a 20 67                 - tener: g
 026b  6f 74 20 47 50 49 4f 20                 - ot GPIO 
 0273  63 6f 6e 6e 65 63 74 69                 - connecti
 027b  6f 6e 20 66 72 6f 6d 20                 - on from 
 0283  25 73 0a 00                             - %s..
 0287  47 50 49 4f 20 6c 69 73 L78             - GPIO lis
 028f  74 65 6e 65 72 3a 20 72                 - tener: r
 0297  65 63 76 20 72 65 74 75                 - ecv retu
 029f  72 6e 65 64 20 25 64 20                 - rned %d 
 02a7  28 65 72 72 6e 6f 3d 25                 - (errno=%
 02af  64 29 0a 00                             - d)..
 02b3  47 50 49 4f 20 6c 69 73 L79             - GPIO lis
 02bb  74 65 6e 65 72 3a 20 63                 - tener: c
 02c3  6f 6e 6e 65 63 74 69 6f                 - onnectio
 02cb  6e 20 63 6c 6f 73 65 64                 - n closed
 02d3  20 62 79 20 63 6c 69 65                 -  by clie
 02db  6e 74 0a 00                             - nt..
 02df  47 50 49 4f 20 6c 69 73 L80             - GPIO lis
 02e7  74 65 6e 65 72 3a 20 77                 - tener: w
 02ef  61 72 6e 69 6e 67 20 2d                 - arning -
 02f7  20 69 6e 76 61 6c 69 64                 -  invalid
 02ff  20 6d 65 73 73 61 67 65                 -  message
 0307  20 6c 65 6e 67 74 68 20                 -  length 
 030f  28 25 64 21 3d 25 64 29                 - (%d!=%d)
 0317  0a 00                                   - ..
 0319  47 50 49 4f 20 6c 69 73 L81             - GPIO lis
 0321  74 65 6e 65 72 3a 20 69                 - tener: i
 0329  6e 76 61 6c 69 64 20 63                 - nvalid c
 0331  6f 6d 6d 61 6e 64 20 72                 - ommand r
 0339  65 74 75 72 6e 65 64 20                 - eturned 
 0341  28 25 64 29 0a 00                       - (%d)..
 0347  53 45 52 49 41 4c 20 6c L82             - SERIAL l
 034f  69 73 74 65 6e 65 72 3a                 - istener:
 0357  20 73 74 61 72 74 69 6e                 -  startin
 035f  67 20 6f 6e 20 70 6f 72                 - g on por
 0367  74 20 25 64 20 74 68 72                 - t %d thr
 036f  65 61 64 20 74 69 64 3d                 - ead tid=
 0377  25 6c 64 0a 00                          - %ld..
 037c  53 45 52 49 41 4c 20 6c L83             - SERIAL l
 0384  69 73 74 65 6e 65 72 3a                 - istener:
 038c  20 63 61 6e 6e 6f 74 20                 -  cannot 
 0394  6f 70 65 6e 20 73 6f 63                 - open soc
 039c  6b 65 74 00                             - ket.
 03a0  53 45 52 49 41 4c 20 6c L84             - SERIAL l
 03a8  69 73 74 65 6e 65 72 3a                 - istener:
 03b0  20 77 61 69 74 69 6e 67                 -  waiting
 03b8  20 6f 6e 20 70 6f 72 74                 -  on port
 03c0  20 25 64 20 73 64 3d 25                 -  %d sd=%
 03c8  64 0a 00                                - d..
 03cb  53 45 52 49 41 4c 20 6c L85             - SERIAL l
 03d3  69 73 74 65 6e 65 72 3a                 - istener:
 03db  20 63 61 6e 6e 6f 74 20                 -  cannot 
 03e3  61 63 63 65 70 74 20 63                 - accept c
 03eb  6f 6e 6e 65 63 74 69 6f                 - onnectio
 03f3  6e 20 00                                - n .
 03f6  53 45 52 49 41 4c 20 6c L86             - SERIAL l
 03fe  69 73 74 65 6e 65 72 3a                 - istener:
 0406  20 67 6f 74 20 53 45 52                 -  got SER
 040e  49 41 4c 20 63 6f 6e 6e                 - IAL conn
 0416  65 63 74 69 6f 6e 20 66                 - ection f
 041e  72 6f 6d 20 25 73 0a 00                 - rom %s..
 0426  53 45 52 49 41 4c 20 6c L87             - SERIAL l
 042e  69 73 74 65 6e 65 72 3a                 - istener:
 0436  20 72 65 63 76 20 72 65                 -  recv re
 043e  74 75 72 6e 65 64 20 25                 - turned %
 0446  64 20 28 65 72 72 6e 6f                 - d (errno
 044e  3d 25 64 29 0a 00                       - =%d)..
 0454  53 45 52 49 41 4c 20 6c L88             - SERIAL l
 045c  69 73 74 65 6e 65 72 3a                 - istener:
 0464  20 63 6f 6e 6e 65 63 74                 -  connect
 046c  69 6f 6e 20 63 6c 6f 73                 - ion clos
 0474  65 64 20 62 79 20 63 6c                 - ed by cl
 047c  69 65 6e 74 0a 00                       - ient..
 0482  53 65 72 69 61 6c 20 6c L89             - Serial l
 048a  69 73 74 65 6e 65 72 20                 - istener 
 0492  72 65 63 65 69 76 65 64                 - received
 049a  20 6d 65 73 73 61 67 65                 -  message
 04a2  3a 5b 25 73 5d 0a 00                    - :[%s]..
 04a9  73 74 61 72 74 4d 6f 63 L90             - startMoc
 04b1  6b 58 50 6f 72 74 3a 20                 - kXPort: 
 04b9  67 70 69 6f 20 66 6f 72                 - gpio for
 04c1  6b 00                                   - k.
 04c3  73 74 61 72 74 4d 6f 63 L91             - startMoc
 04cb  6b 58 50 6f 72 74 3a 20                 - kXPort: 
 04d3  67 70 69 6f 20 50 49 44                 - gpio PID
 04db  20 25 6c 64 20 6f 6e 20                 -  %ld on 
 04e3  68 6f 73 74 20 25 73 0a                 - host %s.
 04eb  00                                      - .
 04ec  73 74 61 72 74 4d 6f 63 L92             - startMoc
 04f4  6b 58 50 6f 72 74 3a 20                 - kXPort: 
 04fc  73 65 72 69 61 6c 20 66                 - serial f
 0504  6f 72 6b 00                             - ork.
 0508  73 74 61 72 74 4d 6f 63 L93             - startMoc
 0510  6b 58 50 6f 72 74 3a 20                 - kXPort: 
 0518  73 65 72 69 61 6c 20 50                 - serial P
 0520  49 44 20 25 6c 64 20 6f                 - ID %ld o
 0528  6e 20 68 6f 73 74 20 25                 - n host %
 0530  73 0a 00                                - s..
 0533  67 65 74 68 6f 73 74 6e L94             - gethostn
 053b  61 6d 65 20 66 61 69 6c                 - ame fail
 0543  65 64 20 65 72 72 6e 6f                 - ed errno
 054b  20 00                                   -  .
 054d  2e 2e 2e 00             L95             - ....
 0551  73 74 61 72 74 69 6e 67 L96             - starting
 0559  20 78 70 6f 72 74 20 73                 -  xport s
 0561  69 6d 75 6c 61 74 65 64                 - imulated
 0569  20 73 65 72 76 65 72 20                 -  server 
 0571  6f 6e 20 00                             - on .
 0575  63 6f 6e 6e 65 63 74 69 L97             - connecti
 057d  6e 67 20 74 6f 20 73 65                 - ng to se
 0585  72 76 65 72 2e 2e 2e 00                 - rver....
 058d  4f 4b 00                L98             - OK.
 0590  45 52 52 00             L99             - ERR.
 0594  6d 61 69 6e 3a 20 74 65 L100            - main: te
 059c  73 74 20 63 6f 6e 6e 65                 - st conne
 05a4  63 74 58 70 6f 72 74 3a                 - ctXport:
 05ac  20 00                                   -  .
 05ae  29 20 00                L101            - ) .
 05b1  28 73 64 47 50 49 4f 3d L102            - (sdGPIO=
 05b9  00                                      - .
 05ba  29 00                   L103            - ).
 05bc  28 73 64 53 65 72 69 61 L104            - (sdSeria
 05c4  6c 3d 00                                - l=.
 05c7  4f 4b 00                L105            - OK.
 05ca  45 52 52 00             L106            - ERR.
 05ce  6d 61 69 6e 3a 20 74 65 L107            - main: te
 05d6  73 74 20 73 65 6e 64 43                 - st sendC
 05de  6f 6d 6d 61 6e 64 3a 20                 - ommand: 
 05e6  00                                      - .
 05e7  4f 4b 00                L108            - OK.
 05ea  45 52 52 00             L109            - ERR.
 05ee  6d 61 69 6e 3a 20 74 65 L110            - main: te
 05f6  73 74 20 72 65 61 64 52                 - st readR
 05fe  65 73 70 6f 6e 73 65 3a                 - esponse:
 0606  20 00                                   -  .
 0608  4f 4b 00                L111            - OK.
 060b  45 52 52 00             L112            - ERR.
 060f  6d 61 69 6e 3a 20 74 65 L113            - main: te
 0617  73 74 20 77 72 69 74 65                 - st write
 061f  53 65 72 69 61 6c 3a 20                 - Serial: 
 0627  00                                      - .
 0628  6d 61 69 6e 3a 20 64 69 L114            - main: di
 0630  73 63 6f 6e 6e 65 63 74                 - sconnect
 0638  69 6e 67 20 58 50 6f 72                 - ing XPor
 0640  74 00                                   - t.
 0642  4f 4b 00                L115            - OK.
 0645  45 52 52 00             L116            - ERR.
 0649  6d 61 69 6e 3a 20 74 65 L117            - main: te
 0651  73 74 20 64 69 73 63 6f                 - st disco
 0659  6e 6e 65 63 74 58 50 6f                 - nnectXPo
 0661  72 74 3a 20 00                          - rt: .
 0666  6d 61 69 6e 3a 20 6b 69 L118            - main: ki
 066e  6c 6c 69 6e 67 20 47 50                 - lling GP
 0676  49 4f 20 73 65 72 76 65                 - IO serve
 067e  72 00                                   - r.
 0680  6d 61 69 6e 3a 20 6b 69 L119            - main: ki
 0688  6c 6c 69 6e 67 20 53 45                 - lling SE
 0690  52 49 41 4c 20 73 65 72                 - RIAL ser
 0698  76 65 72 00                             - ver.
 069c  20 74 65 73 74 73 20 66 L120            -  tests f
 06a4  61 69 6c 65 64 00                       - ailed.
 06aa  20 74 65 73 74 73 20 70 L121            -  tests p
 06b2  61 73 73 65 64 20 00                    - assed .
 06b9  6d 61 69 6e 3a 20 64 6f L122            - main: do
 06c1  6e 65 20 2d 20 00                       - ne - .

No disassembly errors

------------------------------------------------------------

Segment: _BSS  DWORD USE32  0000000c bytes  

No disassembly errors

------------------------------------------------------------

Comdat: istream near & near operator >>( istream near &, <long near >::smanip const near & )  SEGMENT ANY '_TEXT'  00000021 bytes  
 0000  68 0c 00 00 00                    push    0000000cH
 0005  e8 00 00 00 00                    call    __CHK
 000a  53                                push    ebx
 000b  51                                push    ecx
 000c  89 c3                             mov     ebx,eax
 000e  89 d1                             mov     ecx,edx
 0010  8b 52 04                          mov     edx,+4H[edx]
 0013  8b 00                             mov     eax,[eax]
 0015  8b 40 04                          mov     eax,+4H[eax]
 0018  01 d8                             add     eax,ebx
 001a  ff 11                             call    dword ptr [ecx]
 001c  89 d8                             mov     eax,ebx
 001e  59                                pop     ecx
 001f  5b                                pop     ebx
 0020  c3                                ret     

No disassembly errors

------------------------------------------------------------

Comdat: istream near & near operator >>( istream near &, <int near >::smanip const near & )  SEGMENT ANY '_TEXT'  00000021 bytes  
 0000  68 0c 00 00 00                    push    0000000cH
 0005  e8 00 00 00 00                    call    __CHK
 000a  53                                push    ebx
 000b  51                                push    ecx
 000c  89 c3                             mov     ebx,eax
 000e  89 d1                             mov     ecx,edx
 0010  8b 52 04                          mov     edx,+4H[edx]
 0013  8b 00                             mov     eax,[eax]
 0015  8b 40 04                          mov     eax,+4H[eax]
 0018  01 d8                             add     eax,ebx
 001a  ff 11                             call    dword ptr [ecx]
 001c  89 d8                             mov     eax,ebx
 001e  59                                pop     ecx
 001f  5b                                pop     ebx
 0020  c3                                ret     

No disassembly errors

------------------------------------------------------------

Comdat: ostream near & near operator <<( ostream near &, <long near >::smanip const near & )  SEGMENT ANY '_TEXT'  00000021 bytes  
 0000  68 0c 00 00 00                    push    0000000cH
 0005  e8 00 00 00 00                    call    __CHK
 000a  53                                push    ebx
 000b  51                                push    ecx
 000c  89 c3                             mov     ebx,eax
 000e  89 d1                             mov     ecx,edx
 0010  8b 52 04                          mov     edx,+4H[edx]
 0013  8b 00                             mov     eax,[eax]
 0015  8b 40 04                          mov     eax,+4H[eax]
 0018  01 d8                             add     eax,ebx
 001a  ff 11                             call    dword ptr [ecx]
 001c  89 d8                             mov     eax,ebx
 001e  59                                pop     ecx
 001f  5b                                pop     ebx
 0020  c3                                ret     

No disassembly errors

------------------------------------------------------------

Comdat: ostream near & near operator <<( ostream near &, <int near >::smanip const near & )  SEGMENT ANY '_TEXT'  00000021 bytes  
 0000  68 0c 00 00 00                    push    0000000cH
 0005  e8 00 00 00 00                    call    __CHK
 000a  53                                push    ebx
 000b  51                                push    ecx
 000c  89 c3                             mov     ebx,eax
 000e  89 d1                             mov     ecx,edx
 0010  8b 52 04                          mov     edx,+4H[edx]
 0013  8b 00                             mov     eax,[eax]
 0015  8b 40 04                          mov     eax,+4H[eax]
 0018  01 d8                             add     eax,ebx
 001a  ff 11                             call    dword ptr [ecx]
 001c  89 d8                             mov     eax,ebx
 001e  59                                pop     ecx
 001f  5b                                pop     ebx
 0020  c3                                ret     

No disassembly errors

------------------------------------------------------------
