/* Open the serial port that we'll be communicating with the Freakduino (sniffer) through.  */
static int serial_open(char *portname)
/* Open the serial port that we'll be communicating with the Freakduino (sniffer) through.  */
static int serial_open(char *portname)
{
    int FD_com;
    struct termios term;
    FD_com = open(portname, O_RDONLY | O_NOCTTY | O_NDELAY);
    if(FD_com == -1)
    {
        printf("serial_open: Unable to open %s.\n", portname);
    }
    else
    {
        cfsetspeed(&term, BAUDRATE);
        term.c_cflag &= ~PARENB;
        term.c_cflag &= ~CSTOPB;
        term.c_cflag &= ~CSIZE;
        term.c_cflag |= CS8;
        term.c_cflag |= (CLOCAL | CREAD);
        tcsetattr(FD_com, TCSANOW, &term);
    }
    return(FD_com);
}