[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

serial IO Interface revisited.



Hi All, below is hoe I set up my serial device:

The problem I'm having is that I've noticed (using a serial spy software) that I'm missing some bytes between messages and sometimes I would read only one nibble of the next byte. I've looked at several docs and I can't see why that's happening. The sigio handler simply copies the read bytes to another buffer.
Please Help.

Thank You. 
Robbie

sio_fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
        if(sio_fd < 0) {
                perror(MODEMDEVICE);
                return 0;
        }

        /* installing signal handler */
        saio.sa_handler = signal_handler_IO;
        saio.sa_flags = 0;
        saio.sa_restorer = NULL;
        sigaction(SIGIO, &saio, NULL);

        /* allowing process to receive signal & make async */
        fcntl(sio_fd, F_SETOWN, getpid());
        fcntl(sio_fd, F_SETFL, FNDELAY);
        fcntl(sio_fd, F_SETFL, FASYNC);

        tcgetattr(sio_fd, &oldtio);
        cfsetispeed(&newtio, B9600);
        cfmakeraw(&newtio);
        tcflush(sio_fd, TCIOFLUSH);
        tcsetattr(sio_fd, TCSANOW, &newtio);

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!




Reply to: