author | zecke <zecke> | 2004-10-14 01:44:27 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-14 01:44:27 (UTC) |
commit | 474150327729d63706b89a54414ead68acd83fc9 (patch) (side-by-side diff) | |
tree | 633f60754361699393e484c4ef774947f46aafa8 /noncore/settings/networksettings/ppp/modem.cpp | |
parent | a1aed5edd5ccef77d79ccdd2d74f5c029d037617 (diff) | |
download | opie-474150327729d63706b89a54414ead68acd83fc9.zip opie-474150327729d63706b89a54414ead68acd83fc9.tar.gz opie-474150327729d63706b89a54414ead68acd83fc9.tar.bz2 |
-FlowControl and LineTermination are saved and activated by numerical
value now. This makes it work across different translations
-Switch code to use new PPPData::enter() and PPPData::flowcontrol()
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 @@ -216,26 +216,26 @@ bool Modem::opentty() { tty.c_cc[VTIME] = 0; tty.c_oflag = 0; tty.c_lflag = 0; tty.c_cflag &= ~(CSIZE | CSTOPB | PARENB); tty.c_cflag |= CS8 | CREAD; 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 */ } } else { tty.c_cflag &= ~CRTSCTS; tty.c_iflag &= ~(IXON | IXOFF); } @@ -346,33 +346,37 @@ bool Modem::writeChar(unsigned char c) { } } while(s == 0); return true; } 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; delete[] b; return false; } l -= wr; } delete[] b; |