[PC-BSD Commits] r2669 - pcbsd/trunk/wificonfig

svn at pcbsd.org svn at pcbsd.org
Tue Sep 2 07:50:25 PDT 2008


Author: kris
Date: 2008-09-02 07:50:25 -0700 (Tue, 02 Sep 2008)
New Revision: 2669

Modified:
   pcbsd/trunk/wificonfig/wificonfig.pro
   pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp
   pcbsd/trunk/wificonfig/wifiselectiondialog.cpp
Log:

Fixed the wifi tool to now properly work with SSID's that have a space in the
name



Modified: pcbsd/trunk/wificonfig/wificonfig.pro
===================================================================
--- pcbsd/trunk/wificonfig/wificonfig.pro	2008-09-02 13:33:54 UTC (rev 2668)
+++ pcbsd/trunk/wificonfig/wificonfig.pro	2008-09-02 14:50:25 UTC (rev 2669)
@@ -32,6 +32,8 @@
 
 TARGET  = wificonfig
 
+QMAKE_LIBDIR	= /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
+
 DESTDIR = /PCBSD/networkmanager/bin/
 
 QT += qt3support

Modified: pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp
===================================================================
--- pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp	2008-09-02 13:33:54 UTC (rev 2668)
+++ pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp	2008-09-02 14:50:25 UTC (rev 2669)
@@ -93,24 +93,27 @@
 	return;
       }    
 	    
-	    
-    // If we are using WEP security, write the ifconfig line
-      QString confLine = "ifconfig_" + DeviceName + "=\"";
-      confLine += ifConfigLine;
-      if ( checkBSSID->isChecked() ) {
-          confLine += " bssid " + lineBSSID->text() + " wepmode on";  
-      } else {
-          confLine += " ssid \"" + lineSSID->text() + "\" wepmode on";
-      }
+     // Indicate that we are using WPA supplicant
+     saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1);
 
-      if ( WEPHex ) {
-      confLine += " wepkey 0x" + WEPKey + " weptxkey " + tmp.setNum(WEPIndex);
-      } else {
-      confLine += " wepkey \"" + WEPKey + "\" weptxkey " + tmp.setNum(WEPIndex);
-      }
+     // Now create the wpa_supplicant file based on saved configuration
+    QFile fileout( "/etc/wpa_supplicant.conf" );
+    if ( fileout.open( IO_WriteOnly ) ) {
+        QTextStream streamout( &fileout );
+        if ( checkBSSID->isChecked() ) {
+            streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n";
+        } else {
+            streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n";
+        }
 
-      confLine += "\"";
-     saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, confLine, -1);
+        streamout << " scan_ssid=1\n";
+        streamout << " key_mgmt=NONE\n";
+        streamout << " wep_tx_keyidx=" + tmp.setNum(WEPIndex -1) + "\n";
+        streamout << " wep_key" + tmp.setNum(WEPIndex -1) + "=" + WEPKey + "\n";
+        streamout << "}\n";
+        fileout.close();
+    }
+
 	    
     } else if (radioSecurityWPAPersonal->isChecked() ) {
       // Write the settings with WPA-Personal enabled
@@ -1024,6 +1027,7 @@
 			ok = tmp2.toInt(&ok);
 			if ( ok ) {
 			    WEPIndex = tmp2.toInt(&ok);
+			    WEPIndex++;
 			}
 			radioSecurityWEP->setChecked(TRUE);	
 		   }

Modified: pcbsd/trunk/wificonfig/wifiselectiondialog.cpp
===================================================================
--- pcbsd/trunk/wificonfig/wifiselectiondialog.cpp	2008-09-02 13:33:54 UTC (rev 2668)
+++ pcbsd/trunk/wificonfig/wifiselectiondialog.cpp	2008-09-02 14:50:25 UTC (rev 2669)
@@ -59,13 +59,19 @@
 		 // Get the ssid of the network
 		 tmp = line;
 		 tmp = tmp.simplified();
-		 tmp.truncate(tmp.find(" "));
+		 tmp.truncate(tmp.find(":"));
+                 tmp.truncate(tmp.findRev(" "));
 		 ssid = tmp;
 		 
 		 // Get the signal strength of this device
 		 tmp = line;
 		 tmp = tmp.simplified();
-                 tmp = tmp.section(" ", 4, 4);
+
+                 // First remove the SSID which may have spaces in it
+		 tmp.remove(0, tmp.find(":"));
+                  
+                 // Now find the strength section
+                 tmp = tmp.section(" ", 3, 3);
 		 tmp.truncate(tmp.find(":"));
                  strength = tmp;
                  		
@@ -165,7 +171,7 @@
     
     
     selectedSSID = listWifi->text(sel);
-    selectedSSID.truncate( selectedSSID.find(" ") );
+    selectedSSID.truncate( selectedSSID.find("(") - 1 );
     
     // Emit the new network SSID the user selected
     emit saved(selectedSSID);



More information about the Commits mailing list