BUGFIX#5730 : finally fixed
[wifihood] / wifiscand / wifiscand.c
index c0e29d8..0ee874e 100644 (file)
@@ -211,6 +211,9 @@ struct _AppData {
     osso_context_t *osso_context;
 };
 
+static GMainLoop *event_loop = NULL;
+static short int start_flags = 0;
+
 /* Callback for normal D-BUS messages */
 gint dbus_req_handler(const gchar * interface, const gchar * method,
                       GArray * arguments, gpointer data,
@@ -229,6 +232,12 @@ gint dbus_req_handler(const gchar * interface, const gchar * method,
     }
 
     if ( strcmp(method,"stop")==0 ) {
+       struct ifreq frq;
+       strncpy(frq.ifr_name, appdata->iface.ifname, IFNAMSIZ);
+       if(!ioctl(appdata->iface.sock, SIOCGIFFLAGS, &frq)) {
+           frq.ifr_flags = start_flags;
+           ioctl(appdata->iface.sock, SIOCSIFFLAGS, &frq);
+       }
         iw_sockets_close(appdata->iface.sock);
        appdata->iface.sock = 0;
     //    osso_system_note_infoprint(appdata->osso_context, "Stopping WifiScan", NULL);
@@ -266,8 +275,6 @@ gint dbus_req_handler(const gchar * interface, const gchar * method,
     return OSSO_ERROR;
 }
 
-static GMainLoop *event_loop = NULL;
-static short int start_flags = 0;
 
 int main( void ) {