Diffstat (limited to 'noncore/settings/networksettings/wlan') (more/less context) (show whitespace changes)
5 files changed, 50 insertions, 50 deletions
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp index bd56678..c558f5e 100644 --- a/noncore/settings/networksettings/wlan/infoimp.cpp +++ b/noncore/settings/networksettings/wlan/infoimp.cpp | |||
@@ -4,40 +4,40 @@ | |||
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qprogressbar.h> | 5 | #include <qprogressbar.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor. If wireless extensions are enabled on device name then | 9 | * Constructor. If wireless extensions are enabled on device name then |
10 | * start a timer that every second will update the information. | 10 | * start a timer that every second will update the information. |
11 | */ | 11 | */ |
12 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ | 12 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ |
13 | WExtensions *wExtensions = new WExtensions(name); | 13 | WExtensions *wExtensions = new WExtensions(name); |
14 | if(!wExtensions->doesHaveWirelessExtensions()){ | 14 | if(!wExtensions->doesHaveWirelessExtensions()){ |
15 | delete wExtensions; | 15 | delete wExtensions; |
16 | qDebug("WlanInfoImp::No wireless extension"); | 16 | odebug << "WlanInfoImp::No wireless extension" << oendl; |
17 | return; | 17 | return; |
18 | } | 18 | } |
19 | delete wExtensions; | 19 | delete wExtensions; |
20 | timer = new QTimer( this ); | 20 | timer = new QTimer( this ); |
21 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); | 21 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); |
22 | timer->start( 1000, false ); | 22 | timer->start( 1000, false ); |
23 | } | 23 | } |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Updates the information about the wireless device. | 26 | * Updates the information about the wireless device. |
27 | */ | 27 | */ |
28 | void WlanInfoImp::update(){ | 28 | void WlanInfoImp::update(){ |
29 | WExtensions *wExtensions = new WExtensions(this->name()); | 29 | WExtensions *wExtensions = new WExtensions(this->name()); |
30 | if(!wExtensions->doesHaveWirelessExtensions()){ | 30 | if(!wExtensions->doesHaveWirelessExtensions()){ |
31 | qDebug("No extension"); | 31 | odebug << "No extension" << oendl; |
32 | delete wExtensions; | 32 | delete wExtensions; |
33 | timer->stop(); | 33 | timer->stop(); |
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | essidLabel->setText(wExtensions->essid()); | 36 | essidLabel->setText(wExtensions->essid()); |
37 | apLabel->setText(wExtensions->ap()); | 37 | apLabel->setText(wExtensions->ap()); |
38 | stationLabel->setText(wExtensions->station()); | 38 | stationLabel->setText(wExtensions->station()); |
39 | modeLabel->setText(wExtensions->mode()); | 39 | modeLabel->setText(wExtensions->mode()); |
40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); | 40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); |
41 | int signal = 0; | 41 | int signal = 0; |
42 | int noise = 0; | 42 | int noise = 0; |
43 | int quality = 0; | 43 | int quality = 0; |
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index d1fff88..9c64323 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp | |||
@@ -103,25 +103,25 @@ int WExtensions::channel(){ | |||
103 | 103 | ||
104 | // http://www.elanix.com/pdf/an137e.pdf | 104 | // http://www.elanix.com/pdf/an137e.pdf |
105 | 105 | ||
106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
107 | double left = 2.401; | 107 | double left = 2.401; |
108 | double right = 2.416; | 108 | double right = 2.416; |
109 | for(int channel = 1; channel<= 15; channel++){ | 109 | for(int channel = 1; channel<= 15; channel++){ |
110 | if( num >= left && num <= right ) | 110 | if( num >= left && num <= right ) |
111 | return channel; | 111 | return channel; |
112 | left += 0.005; | 112 | left += 0.005; |
113 | right += 0.005; | 113 | right += 0.005; |
114 | } | 114 | } |
115 | qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); | 115 | odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl; |
116 | return -1; | 116 | return -1; |
117 | } | 117 | } |
118 | 118 | ||
119 | /*** | 119 | /*** |
120 | * Get the current rate that the card is transmiting at. | 120 | * Get the current rate that the card is transmiting at. |
121 | * @return double the rate, 0 if error. | 121 | * @return double the rate, 0 if error. |
122 | */ | 122 | */ |
123 | double WExtensions::rate(){ | 123 | double WExtensions::rate(){ |
124 | if(!hasWirelessExtensions) | 124 | if(!hasWirelessExtensions) |
125 | return 0; | 125 | return 0; |
126 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ | 126 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ |
127 | return ((double)iwr.u.bitrate.value)/1000000; | 127 | return ((double)iwr.u.bitrate.value)/1000000; |
@@ -168,33 +168,33 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){ | |||
168 | 168 | ||
169 | QFile wfile( PROCNETWIRELESS ); | 169 | QFile wfile( PROCNETWIRELESS ); |
170 | if(!wfile.open( IO_ReadOnly )) | 170 | if(!wfile.open( IO_ReadOnly )) |
171 | return false; | 171 | return false; |
172 | 172 | ||
173 | QTextStream wstream( &wfile ); | 173 | QTextStream wstream( &wfile ); |
174 | wstream.readLine(); // skip the first two lines | 174 | wstream.readLine(); // skip the first two lines |
175 | wstream.readLine(); // because they only contain headers | 175 | wstream.readLine(); // because they only contain headers |
176 | while(!wstream.atEnd()){ | 176 | while(!wstream.atEnd()){ |
177 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; | 177 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; |
178 | if(name == QString("%1:").arg(interface)){ | 178 | if(name == QString("%1:").arg(interface)){ |
179 | if ( quality > 92 ) | 179 | if ( quality > 92 ) |
180 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); | 180 | odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl; |
181 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) | 181 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) |
182 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); | 182 | odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl; |
183 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) | 183 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) |
184 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); | 184 | odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl; |
185 | //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); | 185 | //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl; |
186 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; | 186 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; |
187 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; | 187 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; |
188 | quality = ( quality*100 ) / 92; | 188 | quality = ( quality*100 ) / 92; |
189 | return true; | 189 | return true; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | qDebug("WExtensions::statsCard no longer present."); | 193 | odebug << "WExtensions::statsCard no longer present." << oendl; |
194 | quality = -1; | 194 | quality = -1; |
195 | signal = IW_LOWER; | 195 | signal = IW_LOWER; |
196 | noise = IW_LOWER; | 196 | noise = IW_LOWER; |
197 | return false; | 197 | return false; |
198 | } | 198 | } |
199 | 199 | ||
200 | // wextensions.cpp | 200 | // wextensions.cpp |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 80a9927..fe7941d 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -36,25 +36,25 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W | |||
36 | if (file.open(IO_ReadOnly)){ | 36 | if (file.open(IO_ReadOnly)){ |
37 | QTextStream stream( &file ); | 37 | QTextStream stream( &file ); |
38 | QString line = ""; | 38 | QString line = ""; |
39 | while ( !stream.eof() ) { | 39 | while ( !stream.eof() ) { |
40 | line += stream.readLine(); | 40 | line += stream.readLine(); |
41 | line += "\n"; | 41 | line += "\n"; |
42 | } | 42 | } |
43 | file.close(); | 43 | file.close(); |
44 | settingsFileText = QStringList::split("\n", line, true); | 44 | settingsFileText = QStringList::split("\n", line, true); |
45 | parseSettingFile(); | 45 | parseSettingFile(); |
46 | } | 46 | } |
47 | else | 47 | else |
48 | qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); | 48 | odebug << QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1() << oendl; |
49 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); | 49 | connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); |
50 | } | 50 | } |
51 | 51 | ||
52 | void WLANImp::typeChanged(int mod){ | 52 | void WLANImp::typeChanged(int mod){ |
53 | networkChannel->setEnabled(mod); | 53 | networkChannel->setEnabled(mod); |
54 | channelLabel->setEnabled(mod); | 54 | channelLabel->setEnabled(mod); |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Change the profile for both wireless settings and network settings. | 58 | * Change the profile for both wireless settings and network settings. |
59 | */ | 59 | */ |
60 | void WLANImp::setProfile(const QString &profile){ | 60 | void WLANImp::setProfile(const QString &profile){ |
@@ -137,25 +137,25 @@ void WLANImp::parseSettingFile(){ | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Saves settings to the wireless.opts file using the current profile | 141 | * Saves settings to the wireless.opts file using the current profile |
142 | */ | 142 | */ |
143 | void WLANImp::changeAndSaveSettingFile(){ | 143 | void WLANImp::changeAndSaveSettingFile(){ |
144 | QString wlanFile = WIRELESS_OPTS; | 144 | QString wlanFile = WIRELESS_OPTS; |
145 | QFile::remove(wlanFile); | 145 | QFile::remove(wlanFile); |
146 | QFile file(wlanFile); | 146 | QFile file(wlanFile); |
147 | 147 | ||
148 | if (!file.open(IO_ReadWrite)){ | 148 | if (!file.open(IO_ReadWrite)){ |
149 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); | 149 | odebug << QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1() << oendl; |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | 152 | ||
153 | QTextStream stream( &file ); | 153 | QTextStream stream( &file ); |
154 | bool foundCase = false; | 154 | bool foundCase = false; |
155 | bool found = false; | 155 | bool found = false; |
156 | bool output = true; | 156 | bool output = true; |
157 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { | 157 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
158 | QString line = (*it).simplifyWhiteSpace(); | 158 | QString line = (*it).simplifyWhiteSpace(); |
159 | if(line.contains("case")) | 159 | if(line.contains("case")) |
160 | foundCase = true; | 160 | foundCase = true; |
161 | // See if we found our scheme to write or the sceme couldn't be found | 161 | // See if we found our scheme to write or the sceme couldn't be found |
@@ -227,19 +227,19 @@ void WLANImp::accept(){ | |||
227 | changeAndSaveSettingFile(); | 227 | changeAndSaveSettingFile(); |
228 | 228 | ||
229 | // Try to save the interfaces settings. | 229 | // Try to save the interfaces settings. |
230 | if(!interfaceSetup->saveChanges()) | 230 | if(!interfaceSetup->saveChanges()) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | OProcess insert; | 233 | OProcess insert; |
234 | insert << "sh"; | 234 | insert << "sh"; |
235 | insert << "-c"; | 235 | insert << "-c"; |
236 | insert << "cardctl eject && cardctl insert"; | 236 | insert << "cardctl eject && cardctl insert"; |
237 | 237 | ||
238 | if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { | 238 | if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { |
239 | qWarning("could not start cardctl"); | 239 | owarn << "could not start cardctl" << oendl; |
240 | } | 240 | } |
241 | 241 | ||
242 | // Close out the dialog | 242 | // Close out the dialog |
243 | QDialog::accept(); | 243 | QDialog::accept(); |
244 | } | 244 | } |
245 | 245 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index eeebe7f..e483efe 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -43,25 +43,25 @@ | |||
43 | * Constructor, read in the wireless.opts file for parsing later. | 43 | * Constructor, read in the wireless.opts file for parsing later. |
44 | */ | 44 | */ |
45 | using namespace Opie::Net; | 45 | using namespace Opie::Net; |
46 | using namespace Opie::Core; | 46 | using namespace Opie::Core; |
47 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { | 47 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { |
48 | interfaces = new Interfaces(); | 48 | interfaces = new Interfaces(); |
49 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 49 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
50 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 50 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
51 | 51 | ||
52 | // Check sanity - the existance of the wireless-tools if-pre-up script | 52 | // Check sanity - the existance of the wireless-tools if-pre-up script |
53 | QFile file(QString(PREUP)); | 53 | QFile file(QString(PREUP)); |
54 | if (file.exists()) { | 54 | if (file.exists()) { |
55 | qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); | 55 | owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; |
56 | } | 56 | } |
57 | 57 | ||
58 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); | 58 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); |
59 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); | 59 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); |
60 | netView->setColumnAlignment( col_chn, AlignCenter ); | 60 | netView->setColumnAlignment( col_chn, AlignCenter ); |
61 | netView->setItemMargin( 3 ); | 61 | netView->setItemMargin( 3 ); |
62 | netView->setAllColumnsShowFocus( true ); | 62 | netView->setAllColumnsShowFocus( true ); |
63 | 63 | ||
64 | } | 64 | } |
65 | 65 | ||
66 | WLANImp::~WLANImp() { | 66 | WLANImp::~WLANImp() { |
67 | //FIXME: delete interfaces; | 67 | //FIXME: delete interfaces; |
@@ -224,25 +224,25 @@ void WLANImp::accept() { | |||
224 | // Close out the dialog | 224 | // Close out the dialog |
225 | // FIXME: QDialog::accept(); | 225 | // FIXME: QDialog::accept(); |
226 | } | 226 | } |
227 | 227 | ||
228 | void WLANImp::writeOpts() { | 228 | void WLANImp::writeOpts() { |
229 | // eh can't really do anything about it other then return. :-D | 229 | // eh can't really do anything about it other then return. :-D |
230 | if(!interfaces->isInterfaceSet()){ | 230 | if(!interfaces->isInterfaceSet()){ |
231 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); | 231 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | bool error = false; | 234 | bool error = false; |
235 | 235 | ||
236 | qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() ); | 236 | odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl; |
237 | 237 | ||
238 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); | 238 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); |
239 | 239 | ||
240 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); | 240 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); |
241 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); | 241 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); |
242 | 242 | ||
243 | if (specifyAp->isChecked()) { | 243 | if (specifyAp->isChecked()) { |
244 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); | 244 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); |
245 | } else { | 245 | } else { |
246 | interfaces->removeInterfaceOption(QString("wireless_ap")); | 246 | interfaces->removeInterfaceOption(QString("wireless_ap")); |
247 | } | 247 | } |
248 | 248 | ||
@@ -298,83 +298,83 @@ void WLANImp::writeOpts() { | |||
298 | 298 | ||
299 | QDialog::accept(); | 299 | QDialog::accept(); |
300 | } | 300 | } |
301 | 301 | ||
302 | /* | 302 | /* |
303 | * Scan for possible wireless networks around... | 303 | * Scan for possible wireless networks around... |
304 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> | 304 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> |
305 | */ | 305 | */ |
306 | 306 | ||
307 | void WLANImp::rescanNeighbourhood() | 307 | void WLANImp::rescanNeighbourhood() |
308 | { | 308 | { |
309 | QString name = interface->getInterfaceName(); | 309 | QString name = interface->getInterfaceName(); |
310 | qDebug( "rescanNeighbourhood via '%s'", (const char*) name ); | 310 | odebug << "rescanNeighbourhood via '" << (const char*) name << "'" << oendl; |
311 | 311 | ||
312 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); | 312 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); |
313 | assert( wiface ); | 313 | assert( wiface ); |
314 | 314 | ||
315 | // try to guess device type | 315 | // try to guess device type |
316 | QString devicetype; | 316 | QString devicetype; |
317 | QFile m( "/proc/modules" ); | 317 | QFile m( "/proc/modules" ); |
318 | if ( m.open( IO_ReadOnly ) ) | 318 | if ( m.open( IO_ReadOnly ) ) |
319 | { | 319 | { |
320 | QString line; | 320 | QString line; |
321 | QTextStream modules( &m ); | 321 | QTextStream modules( &m ); |
322 | while( !modules.atEnd() && !devicetype ) | 322 | while( !modules.atEnd() && !devicetype ) |
323 | { | 323 | { |
324 | modules >> line; | 324 | modules >> line; |
325 | if ( line.contains( "cisco" ) ) devicetype = "cisco"; | 325 | if ( line.contains( "cisco" ) ) devicetype = "cisco"; |
326 | else if ( line.contains( "hostap" ) ) devicetype = "hostap"; | 326 | else if ( line.contains( "hostap" ) ) devicetype = "hostap"; |
327 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ | 327 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ |
328 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; | 328 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; |
329 | } | 329 | } |
330 | } | 330 | } |
331 | if ( devicetype.isEmpty() ) | 331 | if ( devicetype.isEmpty() ) |
332 | { | 332 | { |
333 | qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); | 333 | owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl; |
334 | return; | 334 | return; |
335 | } | 335 | } |
336 | else | 336 | else |
337 | { | 337 | { |
338 | qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); | 338 | odebug << "rescanNeighbourhood(): device type seems to be '" << (const char*) devicetype << "'" << oendl; |
339 | } | 339 | } |
340 | 340 | ||
341 | // configure interface to receive 802.11 management frames | 341 | // configure interface to receive 802.11 management frames |
342 | 342 | ||
343 | wiface->setUp( true ); | 343 | wiface->setUp( true ); |
344 | wiface->setPromiscuousMode( true ); | 344 | wiface->setPromiscuousMode( true ); |
345 | 345 | ||
346 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); | 346 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); |
347 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); | 347 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); |
348 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); | 348 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); |
349 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); | 349 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); |
350 | else | 350 | else |
351 | { | 351 | { |
352 | qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); | 352 | odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; |
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | 355 | ||
356 | wiface->setMode( "monitor" ); | 356 | wiface->setMode( "monitor" ); |
357 | if ( wiface->mode() != "monitor" ) | 357 | if ( wiface->mode() != "monitor" ) |
358 | { | 358 | { |
359 | qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); | 359 | owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; |
360 | return; | 360 | return; |
361 | } | 361 | } |
362 | 362 | ||
363 | // open a packet capturer | 363 | // open a packet capturer |
364 | OPacketCapturer* cap = new OPacketCapturer(); | 364 | OPacketCapturer* cap = new OPacketCapturer(); |
365 | cap->open( name ); | 365 | cap->open( name ); |
366 | if ( !cap->isOpen() ) | 366 | if ( !cap->isOpen() ) |
367 | { | 367 | { |
368 | qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); | 368 | owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; |
369 | return; | 369 | return; |
370 | } | 370 | } |
371 | 371 | ||
372 | // display splash screen | 372 | // display splash screen |
373 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); | 373 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); |
374 | splash->setLineWidth( 2 ); | 374 | splash->setLineWidth( 2 ); |
375 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); | 375 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); |
376 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); | 376 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); |
377 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); | 377 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); |
378 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); | 378 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); |
379 | vbox->addWidget( lab ); | 379 | vbox->addWidget( lab ); |
380 | vbox->addWidget( pb ); | 380 | vbox->addWidget( pb ); |
@@ -389,33 +389,33 @@ void WLANImp::rescanNeighbourhood() | |||
389 | splash->show(); | 389 | splash->show(); |
390 | splash->raise(); | 390 | splash->raise(); |
391 | qApp->processEvents(); | 391 | qApp->processEvents(); |
392 | 392 | ||
393 | // set capturer to non-blocking mode | 393 | // set capturer to non-blocking mode |
394 | cap->setBlocking( false ); | 394 | cap->setBlocking( false ); |
395 | 395 | ||
396 | for ( int i = 1; i <= wiface->channels(); ++i ) | 396 | for ( int i = 1; i <= wiface->channels(); ++i ) |
397 | { | 397 | { |
398 | wiface->setChannel( i ); | 398 | wiface->setChannel( i ); |
399 | pb->setProgress( i ); | 399 | pb->setProgress( i ); |
400 | qApp->processEvents(); | 400 | qApp->processEvents(); |
401 | qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); | 401 | odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; |
402 | OPacket* p = cap->next( 1000 ); | 402 | OPacket* p = cap->next( 1000 ); |
403 | if ( !p ) | 403 | if ( !p ) |
404 | { | 404 | { |
405 | qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); | 405 | odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; |
406 | } | 406 | } |
407 | else | 407 | else |
408 | { | 408 | { |
409 | qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); | 409 | odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; |
410 | handlePacket( p ); | 410 | handlePacket( p ); |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | cap->close(); | 414 | cap->close(); |
415 | wiface->setMode( "managed" ); // TODO: use previous mode | 415 | wiface->setMode( "managed" ); // TODO: use previous mode |
416 | wiface->setPromiscuousMode( false ); | 416 | wiface->setPromiscuousMode( false ); |
417 | 417 | ||
418 | splash->hide(); | 418 | splash->hide(); |
419 | delete splash; | 419 | delete splash; |
420 | 420 | ||
421 | } | 421 | } |
@@ -430,25 +430,25 @@ void WLANImp::handlePacket( OPacket* p ) | |||
430 | 430 | ||
431 | QString type; | 431 | QString type; |
432 | if ( beacon->canIBSS() ) | 432 | if ( beacon->canIBSS() ) |
433 | { | 433 | { |
434 | type = "adhoc"; | 434 | type = "adhoc"; |
435 | } | 435 | } |
436 | else if ( beacon->canESS() ) | 436 | else if ( beacon->canESS() ) |
437 | { | 437 | { |
438 | type = "managed"; | 438 | type = "managed"; |
439 | } | 439 | } |
440 | else | 440 | else |
441 | { | 441 | { |
442 | qWarning( "handlePacket(): invalid frame [possibly noise] detected!" ); | 442 | owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; |
443 | return; | 443 | return; |
444 | } | 444 | } |
445 | 445 | ||
446 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 446 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
447 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 447 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
448 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 448 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
449 | int channel = ds ? ds->channel() : -1; | 449 | int channel = ds ? ds->channel() : -1; |
450 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 450 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
451 | displayFoundNetwork( type, channel, essid, header->macAddress2() ); | 451 | displayFoundNetwork( type, channel, essid, header->macAddress2() ); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 74d7f8e..886af10 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -113,71 +113,71 @@ Interface *WLANModule::addNewInterface(const QString &){ | |||
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Attempts to remove the interface, doesn't delete i | 115 | * Attempts to remove the interface, doesn't delete i |
116 | * @return bool true if successful, false otherwise. | 116 | * @return bool true if successful, false otherwise. |
117 | */ | 117 | */ |
118 | bool WLANModule::remove(Interface*){ | 118 | bool WLANModule::remove(Interface*){ |
119 | // Can't remove a hardware device, you can stop it though. | 119 | // Can't remove a hardware device, you can stop it though. |
120 | return false; | 120 | return false; |
121 | } | 121 | } |
122 | 122 | ||
123 | void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | 123 | void WLANModule::receive(const QCString ¶m, const QByteArray &arg) |
124 | { | 124 | { |
125 | qDebug("WLANModule::receive "+param); | 125 | odebug << "WLANModule::receive "+param << oendl; |
126 | QStringList params = QStringList::split(",",param); | 126 | QStringList params = QStringList::split(",",param); |
127 | int count = params.count(); | 127 | int count = params.count(); |
128 | qDebug("WLANModule got %i params", count ); | 128 | odebug << "WLANModule got " << count << " params" << oendl; |
129 | if (count < 2){ | 129 | if (count < 2){ |
130 | qDebug("Erorr less than 2 parameter"); | 130 | odebug << "Erorr less than 2 parameter" << oendl; |
131 | qDebug("RETURNING"); | 131 | odebug << "RETURNING" << oendl; |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
135 | QDataStream stream(arg,IO_ReadOnly); | 135 | QDataStream stream(arg,IO_ReadOnly); |
136 | QString interface; | 136 | QString interface; |
137 | QString action; | 137 | QString action; |
138 | int countMsgs = 0; | 138 | int countMsgs = 0; |
139 | stream >> interface; | 139 | stream >> interface; |
140 | qDebug("got count? >%s<",interface.latin1()); | 140 | odebug << "got count? >" << interface.latin1() << "<" << oendl; |
141 | if (interface == "count"){ | 141 | if (interface == "count"){ |
142 | qDebug("got count"); | 142 | odebug << "got count" << oendl; |
143 | stream >> action; | 143 | stream >> action; |
144 | qDebug("Got count num >%s<", action.latin1()); | 144 | odebug << "Got count num >" << action.latin1() << "<" << oendl; |
145 | countMsgs = action.toInt(); | 145 | countMsgs = action.toInt(); |
146 | } | 146 | } |
147 | 147 | ||
148 | QDialog *toShow; | 148 | QDialog *toShow; |
149 | //while (! stream.atEnd() ){ | 149 | //while (! stream.atEnd() ){ |
150 | for (int i = 0; i < countMsgs; i++){ | 150 | for (int i = 0; i < countMsgs; i++){ |
151 | qDebug("start stream %d/%d",i,countMsgs); | 151 | odebug << "start stream " << i << "/" << countMsgs << "" << oendl; |
152 | if (stream.atEnd()){ | 152 | if (stream.atEnd()){ |
153 | qDebug("end of stream"); | 153 | odebug << "end of stream" << oendl; |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | stream >> interface; | 156 | stream >> interface; |
157 | qDebug("got iface"); | 157 | odebug << "got iface" << oendl; |
158 | stream >> action; | 158 | stream >> action; |
159 | qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); | 159 | odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl; |
160 | // find interfaces | 160 | // find interfaces |
161 | Interface *ifa=0; | 161 | Interface *ifa=0; |
162 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ | 162 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ |
163 | if (i->getInterfaceName() == interface){ | 163 | if (i->getInterfaceName() == interface){ |
164 | qDebug("WLANModule found interface %s",interface.latin1()); | 164 | odebug << "WLANModule found interface " << interface.latin1() << "" << oendl; |
165 | ifa = i; | 165 | ifa = i; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | if (ifa == 0){ | 169 | if (ifa == 0){ |
170 | qDebug("WLANModule Did not find %s",interface.latin1()); | 170 | odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl; |
171 | qDebug("skipping"); | 171 | odebug << "skipping" << oendl; |
172 | count = 0; | 172 | count = 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | if (count == 2){ | 175 | if (count == 2){ |
176 | // those should call the interface directly | 176 | // those should call the interface directly |
177 | QWidget *info = getInfo( ifa ); | 177 | QWidget *info = getInfo( ifa ); |
178 | QPEApplication::showWidget( info ); | 178 | QPEApplication::showWidget( info ); |
179 | 179 | ||
180 | if ( action.contains("start" ) ){ | 180 | if ( action.contains("start" ) ){ |
181 | ifa->start(); | 181 | ifa->start(); |
182 | } else if ( action.contains("restart" ) ){ | 182 | } else if ( action.contains("restart" ) ){ |
183 | ifa->restart(); | 183 | ifa->restart(); |
@@ -186,70 +186,70 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | |||
186 | }else if ( action.contains("refresh" ) ){ | 186 | }else if ( action.contains("refresh" ) ){ |
187 | ifa->refresh(); | 187 | ifa->refresh(); |
188 | } | 188 | } |
189 | }else if (count == 3){ | 189 | }else if (count == 3){ |
190 | QString value; | 190 | QString value; |
191 | if (!wlanconfigWiget){ | 191 | if (!wlanconfigWiget){ |
192 | //FIXME: what if it got closed meanwhile? | 192 | //FIXME: what if it got closed meanwhile? |
193 | wlanconfigWiget = (WLANImp*) configure(ifa); | 193 | wlanconfigWiget = (WLANImp*) configure(ifa); |
194 | toShow = (QDialog*) wlanconfigWiget; | 194 | toShow = (QDialog*) wlanconfigWiget; |
195 | } | 195 | } |
196 | QPEApplication::showWidget( wlanconfigWiget ); | 196 | QPEApplication::showWidget( wlanconfigWiget ); |
197 | stream >> value; | 197 | stream >> value; |
198 | qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); | 198 | odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl; |
199 | if (value.isEmpty()){ | 199 | if (value.isEmpty()){ |
200 | qDebug("value is empty!!!\nreturning"); | 200 | odebug << "value is empty!!!\nreturning" << oendl; |
201 | return; | 201 | return; |
202 | } | 202 | } |
203 | if ( action.contains("ESSID") ){ | 203 | if ( action.contains("ESSID") ){ |
204 | QComboBox *combo = wlanconfigWiget->essid; | 204 | QComboBox *combo = wlanconfigWiget->essid; |
205 | bool found = false; | 205 | bool found = false; |
206 | for ( int i = 0; i < combo->count(); i++) | 206 | for ( int i = 0; i < combo->count(); i++) |
207 | if ( combo->text( i ) == value ){ | 207 | if ( combo->text( i ) == value ){ |
208 | combo->setCurrentItem( i ); | 208 | combo->setCurrentItem( i ); |
209 | found = true; | 209 | found = true; |
210 | } | 210 | } |
211 | if (!found) combo->insertItem( value, 0 ); | 211 | if (!found) combo->insertItem( value, 0 ); |
212 | }else if ( action.contains("Mode") ){ | 212 | }else if ( action.contains("Mode") ){ |
213 | QComboBox *combo = wlanconfigWiget->mode; | 213 | QComboBox *combo = wlanconfigWiget->mode; |
214 | for ( int i = 0; i < combo->count(); i++) | 214 | for ( int i = 0; i < combo->count(); i++) |
215 | if ( combo->text( i ) == value ){ | 215 | if ( combo->text( i ) == value ){ |
216 | combo->setCurrentItem( i ); | 216 | combo->setCurrentItem( i ); |
217 | } | 217 | } |
218 | 218 | ||
219 | }else if (action.contains("Channel")){ | 219 | }else if (action.contains("Channel")){ |
220 | bool ok; | 220 | bool ok; |
221 | qDebug("converting channel"); | 221 | odebug << "converting channel" << oendl; |
222 | int chan = value.toInt( &ok ); | 222 | int chan = value.toInt( &ok ); |
223 | if (ok){ | 223 | if (ok){ |
224 | qDebug("ok setting channel"); | 224 | odebug << "ok setting channel" << oendl; |
225 | wlanconfigWiget->specifyChan->setChecked( true ); | 225 | wlanconfigWiget->specifyChan->setChecked( true ); |
226 | wlanconfigWiget->networkChannel->setValue( chan ); | 226 | wlanconfigWiget->networkChannel->setValue( chan ); |
227 | } | 227 | } |
228 | }else if (action.contains("MacAddr")){ | 228 | }else if (action.contains("MacAddr")){ |
229 | wlanconfigWiget->specifyAp->setChecked( true ); | 229 | wlanconfigWiget->specifyAp->setChecked( true ); |
230 | wlanconfigWiget->macEdit->setText( value ); | 230 | wlanconfigWiget->macEdit->setText( value ); |
231 | }else | 231 | }else |
232 | qDebug("wlan plugin has no clue"); | 232 | odebug << "wlan plugin has no clue" << oendl; |
233 | } | 233 | } |
234 | qDebug("next stream"); | 234 | odebug << "next stream" << oendl; |
235 | }// while stream | 235 | }// while stream |
236 | qDebug("end of stream"); | 236 | odebug << "end of stream" << oendl; |
237 | if (toShow) toShow->exec(); | 237 | if (toShow) toShow->exec(); |
238 | qDebug("returning"); | 238 | odebug << "returning" << oendl; |
239 | } | 239 | } |
240 | 240 | ||
241 | QWidget *WLANModule::getInfo( Interface *i) | 241 | QWidget *WLANModule::getInfo( Interface *i) |
242 | { | 242 | { |
243 | qDebug("WLANModule::getInfo start"); | 243 | odebug << "WLANModule::getInfo start" << oendl; |
244 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); | 244 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); |
245 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); | 245 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); |
246 | info->tabWidget->insertTab(information, "TCP/IP", 0); | 246 | info->tabWidget->insertTab(information, "TCP/IP", 0); |
247 | info->tabWidget->setCurrentPage( 0 ); | 247 | info->tabWidget->setCurrentPage( 0 ); |
248 | info->tabWidget->showPage( information ); | 248 | info->tabWidget->showPage( information ); |
249 | if (info->tabWidget->currentPage() == information ) qDebug("infotab OK"); | 249 | if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl; |
250 | else qDebug("infotab NOT OK"); | 250 | else odebug << "infotab NOT OK" << oendl; |
251 | qDebug("current idx %d", info->tabWidget->currentPageIndex()); | 251 | odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl; |
252 | qDebug("WLANModule::getInfo return"); | 252 | odebug << "WLANModule::getInfo return" << oendl; |
253 | return info; | 253 | return info; |
254 | } | 254 | } |
255 | 255 | ||