Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 97 |
1 files changed, 35 insertions, 62 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4ee9a35..4c1c972 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -69,5 +69,5 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
69 | // construct manufacturer database | 69 | // construct manufacturer database |
70 | // | 70 | // |
71 | 71 | ||
72 | QString manufile; | 72 | QString manufile; |
73 | #ifdef QWS | 73 | #ifdef QWS |
@@ -90,5 +90,5 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
90 | logwindow->log( sys ); | 90 | logwindow->log( sys ); |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | // | 93 | // |
94 | // setup socket for daemon communication, register socket notifier | 94 | // setup socket for daemon communication, register socket notifier |
@@ -115,5 +115,5 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
115 | // button->setEnabled( false ); | 115 | // button->setEnabled( false ); |
116 | netview->setColumnWidthMode( 1, QListView::Manual ); | 116 | netview->setColumnWidthMode( 1, QListView::Manual ); |
117 | 117 | ||
118 | if ( manufacturerdb ) | 118 | if ( manufacturerdb ) |
119 | netview->setManufacturerDB( manufacturerdb ); | 119 | netview->setManufacturerDB( manufacturerdb ); |
@@ -152,5 +152,5 @@ void Wellenreiter::handleMessage() | |||
152 | 152 | ||
153 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); | 153 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); |
154 | 154 | ||
155 | if ( result == -1 ) | 155 | if ( result == -1 ) |
156 | { | 156 | { |
@@ -158,7 +158,7 @@ void Wellenreiter::handleMessage() | |||
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | 160 | ||
161 | int command = buffer[1] - 48; | 161 | int command = buffer[1] - 48; |
162 | 162 | ||
163 | /* | 163 | /* |
164 | typedef struct { | 164 | typedef struct { |
@@ -209,5 +209,5 @@ void Wellenreiter::dataReceived() | |||
209 | { | 209 | { |
210 | logwindow->log( "(d) Received data from daemon" ); | 210 | logwindow->log( "(d) Received data from daemon" ); |
211 | handleMessage(); | 211 | handleMessage(); |
212 | } | 212 | } |
213 | 213 | ||
@@ -227,86 +227,59 @@ void Wellenreiter::buttonClicked() | |||
227 | { | 227 | { |
228 | daemonRunning = false; | 228 | daemonRunning = false; |
229 | 229 | ||
230 | logwindow->log( "(i) Daemon has been stopped." ); | 230 | logwindow->log( "(i) Daemon has been stopped." ); |
231 | button->setText( "Start Scanning" ); | 231 | button->setText( "Start Scanning" ); |
232 | 232 | ||
233 | // Stop daemon - ugly for now... later better | 233 | // Stop daemon - ugly for now... later better |
234 | 234 | ||
235 | system( "killall orinoco_hopper" ); | ||
236 | system( "killall wellenreiterd" ); | 235 | system( "killall wellenreiterd" ); |
237 | 236 | ||
238 | // get configuration from config window | 237 | // get configuration from config window |
239 | 238 | ||
240 | const QString& interface = configwindow->interfaceName->currentText(); | 239 | const QString& interface = configwindow->interfaceName->currentText(); |
241 | const QString& cardtype = configwindow->deviceType->currentText(); | 240 | const QString& cardtype = configwindow->deviceType->currentText(); |
242 | const QString& interval = configwindow->hopInterval->cleanText(); | 241 | //const QString& interval = configwindow->hopInterval->cleanText(); |
243 | 242 | ||
244 | // reset the card trying to get into a usable state again | 243 | // reset the card trying to get into a usable state again |
245 | 244 | ||
246 | QString cmdline; | 245 | QString cmdline; |
247 | cmdline.sprintf( "iwpriv %s monitor 1", (const char*) interface ); | 246 | cmdline.sprintf( "cardctl eject; cardctl insert" ); |
248 | system( cmdline ); | ||
249 | cmdline.sprintf( "iwpriv %s monitor 1 6", (const char*) interface ); | ||
250 | system( cmdline ); | ||
251 | cmdline.sprintf( "ifconfig %s -promisc", (const char*) interface ); | ||
252 | system( cmdline ); | 247 | system( cmdline ); |
253 | cmdline.sprintf( "killall -14 dhcpcd" ); | 248 | cmdline.sprintf( "killall -14 dhcpcd" ); |
254 | system( cmdline ); | 249 | system( cmdline ); |
255 | cmdline.sprintf( "killall -10 udhcpc" ); | 250 | cmdline.sprintf( "killall -10 udhcpc" ); |
256 | 251 | ||
257 | // message the user | 252 | // message the user |
258 | 253 | ||
259 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); | 254 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); |
260 | } | 255 | } |
261 | 256 | ||
262 | else | 257 | else |
263 | { | 258 | { |
264 | 259 | ||
265 | logwindow->log( "(i) Daemon has been started." ); | ||
266 | daemonRunning = true; | ||
267 | button->setText( "Stop Scanning" ); | ||
268 | |||
269 | // get configuration from config window | 260 | // get configuration from config window |
270 | 261 | ||
271 | const QString& interface = configwindow->interfaceName->currentText(); | 262 | const QString& interface = configwindow->interfaceName->currentText(); |
272 | const QString& cardtype = configwindow->deviceType->currentText(); | 263 | const int cardtype = configwindow->daemonDeviceType(); |
273 | const QString& interval = configwindow->hopInterval->cleanText(); | 264 | const int interval = configwindow->daemonHopInterval(); |
274 | 265 | ||
275 | if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) | 266 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) |
276 | { | 267 | { |
277 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); | 268 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); |
278 | return; | 269 | return; |
279 | } | 270 | } |
280 | 271 | ||
281 | // set interface into monitor mode | 272 | // start wellenreiterd |
282 | /* Global::Execute definitely does not work very well with non-gui stuff! :( */ | 273 | |
283 | |||
284 | QString cmdline; | 274 | QString cmdline; |
285 | cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); | 275 | cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); |
286 | system( cmdline ); | ||
287 | cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); | ||
288 | system( cmdline ); | ||
289 | |||
290 | // start channel hopper | ||
291 | |||
292 | cmdline = "orinoco_hopper "; | ||
293 | cmdline += interface; | ||
294 | cmdline += " -i "; | ||
295 | cmdline += interval; | ||
296 | cmdline += " &"; | ||
297 | qDebug( "execute: %s", (const char*) cmdline ); | ||
298 | system( cmdline ); | ||
299 | qDebug( "done" ); | ||
300 | |||
301 | // start daemon | ||
302 | |||
303 | cmdline = "wellenreiterd "; | ||
304 | cmdline += interface; | ||
305 | cmdline += " 3"; | ||
306 | cmdline += " &"; | ||
307 | 276 | ||
308 | qDebug( "execute: %s", (const char*) cmdline ); | 277 | qDebug( "about to execute '%s' ...", (const char*) cmdline ); |
309 | system( cmdline ); | 278 | system( cmdline ); |
310 | qDebug( "done" ); | 279 | qDebug( "done!" ); |
280 | |||
281 | logwindow->log( "(i) Daemon has been started." ); | ||
282 | daemonRunning = true; | ||
283 | button->setText( "Stop Scanning" ); | ||
311 | 284 | ||
312 | } | 285 | } |