-rw-r--r-- | noncore/applets/wirelessapplet/networkinfo.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/noncore/applets/wirelessapplet/networkinfo.cpp b/noncore/applets/wirelessapplet/networkinfo.cpp index 2274d99..e0c487b 100644 --- a/noncore/applets/wirelessapplet/networkinfo.cpp +++ b/noncore/applets/wirelessapplet/networkinfo.cpp | |||
@@ -169,74 +169,72 @@ bool MWirelessNetworkInterface::updateStatistics() | |||
169 | 169 | ||
170 | result = ioctl( fd, SIOCGIWFREQ, &iwr ); | 170 | result = ioctl( fd, SIOCGIWFREQ, &iwr ); |
171 | if ( result == 0 ) | 171 | if ( result == 0 ) |
172 | freq = double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000; | 172 | freq = double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000; |
173 | else freq = 0; | 173 | else freq = 0; |
174 | 174 | ||
175 | // gather link quality from /proc/net/wireless | 175 | // gather link quality from /proc/net/wireless |
176 | 176 | ||
177 | char c; | 177 | char c; |
178 | QString status; | 178 | QString status; |
179 | QString name; | 179 | QString name; |
180 | QFile wfile( PROCNETWIRELESS ); | 180 | QFile wfile( PROCNETWIRELESS ); |
181 | bool hasFile = wfile.open( IO_ReadOnly ); | 181 | bool hasFile = wfile.open( IO_ReadOnly ); |
182 | QTextStream wstream( &wfile ); | 182 | QTextStream wstream( &wfile ); |
183 | if ( hasFile ) | 183 | if ( hasFile ) |
184 | { | 184 | { |
185 | wstream.readLine(); // skip the first two lines | 185 | wstream.readLine(); // skip the first two lines |
186 | wstream.readLine(); // because they only contain headers | 186 | wstream.readLine(); // because they only contain headers |
187 | } | 187 | } |
188 | if ( ( !hasFile ) || ( wstream.atEnd() ) ) | 188 | if ( ( !hasFile ) || ( wstream.atEnd() ) ) |
189 | { | 189 | { |
190 | #ifdef MDEBUG | 190 | #ifdef MDEBUG |
191 | qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); | 191 | qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); |
192 | #endif | 192 | #endif |
193 | quality = -1; | 193 | quality = -1; |
194 | signal = IW_LOWER; | 194 | signal = IW_LOWER; |
195 | noise = IW_LOWER; | 195 | noise = IW_LOWER; |
196 | return false; | 196 | return false; |
197 | } | 197 | } |
198 | 198 | ||
199 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; | 199 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; |
200 | 200 | ||
201 | if ( quality > 92 ) | ||
202 | #ifdef MDEBUG | 201 | #ifdef MDEBUG |
202 | if ( quality > 92 ) | ||
203 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); | 203 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); |
204 | #endif | 204 | |
205 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) | 205 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) |
206 | #ifdef MDEBUG | ||
207 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); | 206 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); |
208 | #endif | 207 | |
209 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) | 208 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) |
210 | #ifdef MDEBUG | ||
211 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); | 209 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); |
212 | #endif | 210 | #endif |
213 | 211 | ||
214 | return true; | 212 | return true; |
215 | 213 | ||
216 | } | 214 | } |
217 | 215 | ||
218 | //--------------------------------------------------------------------------- | 216 | //--------------------------------------------------------------------------- |
219 | // class Network | 217 | // class Network |
220 | // | 218 | // |
221 | 219 | ||
222 | MNetwork::MNetwork() | 220 | MNetwork::MNetwork() |
223 | { | 221 | { |
224 | procfile = PROCNETDEV; | 222 | procfile = PROCNETDEV; |
225 | } | 223 | } |
226 | 224 | ||
227 | MNetwork::~MNetwork() | 225 | MNetwork::~MNetwork() |
228 | { | 226 | { |
229 | } | 227 | } |
230 | 228 | ||
231 | //--------------------------------------------------------------------------- | 229 | //--------------------------------------------------------------------------- |
232 | // class WirelessNetwork | 230 | // class WirelessNetwork |
233 | // | 231 | // |
234 | 232 | ||
235 | MWirelessNetwork::MWirelessNetwork() | 233 | MWirelessNetwork::MWirelessNetwork() |
236 | { | 234 | { |
237 | procfile = PROCNETWIRELESS; | 235 | procfile = PROCNETWIRELESS; |
238 | } | 236 | } |
239 | 237 | ||
240 | MWirelessNetwork::~MWirelessNetwork() | 238 | MWirelessNetwork::~MWirelessNetwork() |
241 | { | 239 | { |
242 | } | 240 | } |