/* this functions opens and configure the serial port */ void cfgport(void) { if ((portfd = open(cfg.port, O_RDWR)) == -1) { printFatal("Unable to open serial port"); } /* these functions, declared on sysdep1.c * configure the serial port * these functions are from minicom source */ m_savestate(portfd); m_setparms(portfd, cfg.baudrate, cfg.parity, cfg.databits, 1, 0); m_nohang(portfd); m_hupcl(portfd, 1); m_flush(portfd); }
/* Initialize modem port. */ void port_init(void) { m_setparms(portfd, P_BAUDRATE, P_PARITY, P_BITS, P_STOPB, P_HASRTS[0] == 'Y', P_HASXON[0] == 'Y'); }