Diffstat (limited to 'noncore/settings/networksettings/ppp/modem.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index a2f77c5..cd5d21c 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -101,7 +101,7 @@ speed_t Modem::modemspeed() { | |||
101 | // convert the string modem speed int the gpppdata object to a t_speed type | 101 | // convert the string modem speed int the gpppdata object to a t_speed type |
102 | // to set the modem. The constants here should all be ifdef'd because | 102 | // to set the modem. The constants here should all be ifdef'd because |
103 | // other systems may not have them | 103 | // other systems may not have them |
104 | int i = gpppdata.speed().toInt()/100; | 104 | int i = PPPData::data()->speed().toInt()/100; |
105 | 105 | ||
106 | switch(i) { | 106 | switch(i) { |
107 | case 24: | 107 | case 24: |
@@ -151,7 +151,7 @@ bool Modem::opentty() { | |||
151 | 151 | ||
152 | //begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { | 152 | //begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { |
153 | close(modemfd); | 153 | close(modemfd); |
154 | // device = "/dev/modem";//deviceByIndex(request.modem.deviceNum); | 154 | device = PPPData::data()->modemDevice(); |
155 | if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { | 155 | if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { |
156 | qDebug("error opening modem device !"); | 156 | qDebug("error opening modem device !"); |
157 | errmsg = i18n("Unable to open modem."); | 157 | errmsg = i18n("Unable to open modem."); |
@@ -161,7 +161,7 @@ bool Modem::opentty() { | |||
161 | //} | 161 | //} |
162 | 162 | ||
163 | #if 0 | 163 | #if 0 |
164 | if(gpppdata.UseCDLine()) { | 164 | if(PPPData::data()->UseCDLine()) { |
165 | if(ioctl(modemfd, TIOCMGET, &flags) == -1) { | 165 | if(ioctl(modemfd, TIOCMGET, &flags) == -1) { |
166 | errmsg = i18n("Unable to detect state of CD line."); | 166 | errmsg = i18n("Unable to detect state of CD line."); |
167 | ::close(modemfd); | 167 | ::close(modemfd); |
@@ -209,8 +209,8 @@ bool Modem::opentty() { | |||
209 | tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); | 209 | tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); |
210 | 210 | ||
211 | 211 | ||
212 | if(gpppdata.flowcontrol() != "None") { | 212 | if(PPPData::data()->flowcontrol() != "None") { |
213 | if(gpppdata.flowcontrol() == "CRTSCTS") { | 213 | if(PPPData::data()->flowcontrol() == "CRTSCTS") { |
214 | tty.c_cflag |= CRTSCTS; | 214 | tty.c_cflag |= CRTSCTS; |
215 | } | 215 | } |
216 | else { | 216 | else { |
@@ -339,7 +339,7 @@ bool Modem::writeLine(const char *buf) { | |||
339 | char *b = new char[len+2]; | 339 | char *b = new char[len+2]; |
340 | memcpy(b, buf, len); | 340 | memcpy(b, buf, len); |
341 | // different modems seem to need different line terminations | 341 | // different modems seem to need different line terminations |
342 | QString term = gpppdata.enter(); | 342 | QString term = PPPData::data()->enter(); |
343 | if(term == "LF") | 343 | if(term == "LF") |
344 | b[len++]='\n'; | 344 | b[len++]='\n'; |
345 | else if(term == "CR") | 345 | else if(term == "CR") |
@@ -379,9 +379,9 @@ bool Modem::hangup() { | |||
379 | if (data_mode) escape_to_command_mode(); | 379 | if (data_mode) escape_to_command_mode(); |
380 | 380 | ||
381 | // Then hangup command | 381 | // Then hangup command |
382 | writeLine(gpppdata.modemHangupStr().local8Bit()); | 382 | writeLine(PPPData::data()->modemHangupStr().local8Bit()); |
383 | 383 | ||
384 | usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec | 384 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec |
385 | 385 | ||
386 | #ifndef DEBUG_WO_DIALING | 386 | #ifndef DEBUG_WO_DIALING |
387 | if (sigsetjmp(jmp_buffer, 1) == 0) { | 387 | if (sigsetjmp(jmp_buffer, 1) == 0) { |
@@ -417,7 +417,7 @@ bool Modem::hangup() { | |||
417 | ioctl(modemfd, TIOCMSET, &modemstat); | 417 | ioctl(modemfd, TIOCMSET, &modemstat); |
418 | #endif | 418 | #endif |
419 | 419 | ||
420 | usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 secs | 420 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 secs |
421 | 421 | ||
422 | cfsetospeed(&temptty, modemspeed()); | 422 | cfsetospeed(&temptty, modemspeed()); |
423 | cfsetispeed(&temptty, modemspeed()); | 423 | cfsetispeed(&temptty, modemspeed()); |
@@ -440,11 +440,11 @@ void Modem::escape_to_command_mode() { | |||
440 | tcflush(modemfd, TCIOFLUSH); | 440 | tcflush(modemfd, TCIOFLUSH); |
441 | 441 | ||
442 | // +3 because quiet time must be greater than guard time. | 442 | // +3 because quiet time must be greater than guard time. |
443 | usleep((gpppdata.modemEscapeGuardTime()+3)*20000); | 443 | usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); |
444 | QCString tmp = gpppdata.modemEscapeStr().local8Bit(); | 444 | QCString tmp = PPPData::data()->modemEscapeStr().local8Bit(); |
445 | write(modemfd, tmp.data(), tmp.length()); | 445 | write(modemfd, tmp.data(), tmp.length()); |
446 | tcflush(modemfd, TCIOFLUSH); | 446 | tcflush(modemfd, TCIOFLUSH); |
447 | usleep((gpppdata.modemEscapeGuardTime()+3)*20000); | 447 | usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); |
448 | 448 | ||
449 | data_mode = false; | 449 | data_mode = false; |
450 | } | 450 | } |
@@ -560,7 +560,7 @@ int Modem::lockdevice() { | |||
560 | int fd; | 560 | int fd; |
561 | char newlock[80]=""; // safe | 561 | char newlock[80]=""; // safe |
562 | 562 | ||
563 | if(!gpppdata.modemLockFile()) { | 563 | if(!PPPData::data()->modemLockFile()) { |
564 | qDebug("The user doesn't want a lockfile."); | 564 | qDebug("The user doesn't want a lockfile."); |
565 | return 0; | 565 | return 0; |
566 | } | 566 | } |
@@ -569,7 +569,7 @@ int Modem::lockdevice() { | |||
569 | return 1; | 569 | return 1; |
570 | 570 | ||
571 | QString lockfile = LOCK_DIR"/LCK.."; | 571 | QString lockfile = LOCK_DIR"/LCK.."; |
572 | lockfile += gpppdata.modemDevice().mid(5); // append everything after /dev/ | 572 | lockfile += PPPData::data()->modemDevice().mid(5); // append everything after /dev/ |
573 | 573 | ||
574 | if(access(QFile::encodeName(lockfile), F_OK) == 0) { | 574 | if(access(QFile::encodeName(lockfile), F_OK) == 0) { |
575 | // if ((fd = Requester::rq-> | 575 | // if ((fd = Requester::rq-> |
@@ -600,7 +600,7 @@ if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { | |||
600 | } | 600 | } |
601 | } | 601 | } |
602 | 602 | ||
603 | fd = openLockfile(gpppdata.modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); | 603 | fd = openLockfile(PPPData::data()->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); |
604 | if(fd >= 0) { | 604 | if(fd >= 0) { |
605 | sprintf(newlock,"%010d\n", getpid()); | 605 | sprintf(newlock,"%010d\n", getpid()); |
606 | qDebug("Locking Device: %s", newlock); | 606 | qDebug("Locking Device: %s", newlock); |