summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/interface.cpp
authorbenmeyer <benmeyer>2002-10-02 18:52:50 (UTC)
committer benmeyer <benmeyer>2002-10-02 18:52:50 (UTC)
commit56a0a990842a5b57b961c064809aae27f087562d (patch) (unidiff)
treee16ec644bff60c88c710ef6beedc5b033b39624c /noncore/net/networksetup/interface.cpp
parent527e77d8244fb25d0bab39857eebbdfbcbfb807a (diff)
downloadopie-56a0a990842a5b57b961c064809aae27f087562d.zip
opie-56a0a990842a5b57b961c064809aae27f087562d.tar.gz
opie-56a0a990842a5b57b961c064809aae27f087562d.tar.bz2
DHCP works, addProfile works
Diffstat (limited to 'noncore/net/networksetup/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interface.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/noncore/net/networksetup/interface.cpp b/noncore/net/networksetup/interface.cpp
index 5b21364..1f32093 100644
--- a/noncore/net/networksetup/interface.cpp
+++ b/noncore/net/networksetup/interface.cpp
@@ -1,6 +1,7 @@
1#include "interface.h" 1#include "interface.h"
2#include <qdatetime.h> 2#include <qdatetime.h>
3#include <qfile.h> 3#include <qfile.h>
4#include <qdir.h>
4#include <qfileinfo.h> 5#include <qfileinfo.h>
5#include <qtextstream.h> 6#include <qtextstream.h>
6 7
@@ -127,9 +128,14 @@ bool Interface::refresh(){
127 leaseObtained = ""; 128 leaseObtained = "";
128 leaseExpires = ""; 129 leaseExpires = "";
129 dhcp = false; 130 dhcp = false;
130 131
132 QString dhcpDirectory(HDCP_INFO_DIR);
133 QDir d(dhcpDirectory);
134 if(!d.exists(dhcpDirectory))
135 dhcpDirectory = "/var/run";
136
131 // See if we have 137 // See if we have
132 QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); 138 QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName));
133 // If there is no DHCP information then exit now with no errors. 139 // If there is no DHCP information then exit now with no errors.
134 if(!QFile::exists(dhcpFile)){ 140 if(!QFile::exists(dhcpFile)){
135 return true; 141 return true;
@@ -148,8 +154,8 @@ bool Interface::refresh(){
148 stream.setDevice( &file ); 154 stream.setDevice( &file );
149 while ( !stream.eof() ) { 155 while ( !stream.eof() ) {
150 line = stream.readLine(); 156 line = stream.readLine();
151 if(line.contains("DHCPSID=")) 157 if(line.contains("DHCPSIADDR="))
152 dhcpServerIp = line.mid(8, line.length()); 158 dhcpServerIp = line.mid(11, line.length());
153 if(line.contains("LEASETIME=")) 159 if(line.contains("LEASETIME="))
154 leaseTime = line.mid(10, line.length()).toInt(); 160 leaseTime = line.mid(10, line.length()).toInt();
155 if(line.contains("RENEWALTIME=")) 161 if(line.contains("RENEWALTIME="))
@@ -160,7 +166,7 @@ bool Interface::refresh(){
160 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); 166 //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
161 167
162 // Get the pid of the deamond 168 // Get the pid of the deamond
163 dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); 169 dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName));
164 file.setName(dhcpFile); 170 file.setName(dhcpFile);
165 if (!file.open(IO_ReadOnly)){ 171 if (!file.open(IO_ReadOnly)){
166 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); 172 qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());