I'm working on some test serial code as preparation for using it in
another project (having never worked with serial I/O on a Palm device
before).  I'm testing between POSE and my Visor, and all works fine... 
immediately after reset.  If I Hotsync, though, the call to SerOpen
returns serErrAlreadyOpen and, while I can send stuff from the Visor all
day long at that point, my receive code no longer works. 

Any ideas?  It seems at first glance like Hotsync 3.5 is leaving the
serial port open when it's done and I'm getting the backwash from that.
This is with a Visor Platinum, syncing over USB then testing with a serial
cradle.

I'm running the following code from my nilEvent handler. I'm doing a data
packet system of sorts, so it returns immediately if there are less than 6
bytes in the receive buffer.  If there are at least that many, it reads in
the packet header, compares part of that against a 4-byte signature, and
pulls in the rest of the packet. 

Thanks in advance...

int OldSer_Receive(unsigned char *buf)
{
    UInt32 count;
    Err err;
    UInt32 recv;

    buf[6] = 0;
    
    err = SerReceiveCheck(libRef, &count);
    if (err) return 0;
    if (count < 6) return 0;

    recv = SerReceive(libRef, buf, 6, 20, &err);
    if (recv != 6 || err != 0)
        return 0;

    if (MemCmp(buf, sig, 4))
    {
        SerReceiveFlush(libRef, 5);
        return 0;
    }
    
    recv = SerReceive(libRef, &buf[6], buf[5], 20, &err);
    if (recv != buf[5] || err != 0)
        return 0;
        
    return 1;
}

----------------------------------------------------------------------
Brian Smith  //   [EMAIL PROTECTED]   //  http://www.arthurian.nu/
Software Developer  //  Gamer  //  Webmaster  //  System Administrator
Karaoke is Japanese for tone deaf.


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to