Diffstat (limited to 'noncore/settings/networksettings/ppp/modem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 79f015b..7b2e2a3 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp @@ -222,14 +222,14 @@ bool Modem::opentty() { tty.c_cflag |= CLOCAL; // ignore modem status lines tty.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ; tty.c_lflag &= ~ICANON; // non-canonical mode tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); - if(_pppdata->flowcontrol() != "None") { - if(_pppdata->flowcontrol() == "CRTSCTS") { + if(_pppdata->flowcontrol() != PPPData::FlowNone) { + if(_pppdata->flowcontrol() == PPPData::FlowHardware) { tty.c_cflag |= CRTSCTS; } else { tty.c_iflag |= IXON | IXOFF; tty.c_cc[VSTOP] = 0x13; /* DC3 = XOFF = ^S */ tty.c_cc[VSTART] = 0x11; /* DC1 = XON = ^Q */ @@ -352,21 +352,25 @@ bool Modem::writeChar(unsigned char c) { bool Modem::writeLine(const char *buf) { int len = strlen(buf); char *b = new char[len+2]; memcpy(b, buf, len); // different modems seem to need different line terminations - QString term = _pppdata->enter(); - if(term == "LF") + switch( _pppdata->enter() ) { + case PPPData::EndLF: b[len++]='\n'; - else if(term == "CR") + break; + case PPPData::EndCR: b[len++]='\r'; - else if(term == "CR/LF") { + break; + case PPPData::EndCRLF: b[len++]='\r'; b[len++]='\n'; + break; } + int l = len; while(l) { int wr = write(modemfd, &b[len-l], l); if(wr < 0) { // TODO do something meaningful with the error code (or ignore it oerr << "write() in Modem::writeLine failed" << oendl; |