[PC-BSD Commits] r372 - pcbsd/trunk/wificonfig
svn at pcbsd.org
svn at pcbsd.org
Fri Jun 22 11:38:58 PDT 2007
Author: kris
Date: 2007-06-22 19:38:58 +0100 (Fri, 22 Jun 2007)
New Revision: 372
Modified:
pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h
Log:
Made some more changes to wifi rc.conf file saving / loading. Now it works
100% on my laptop, including setting the mode on the fly
Modified: pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h
===================================================================
--- pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h 2007-06-21 21:11:23 UTC (rev 371)
+++ pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h 2007-06-22 18:38:58 UTC (rev 372)
@@ -66,14 +66,14 @@
} else {
- ifConfigLine="DHCP ssid " + lineSSID->text();
+ ifConfigLine="DHCP";
}
// Check if we are not using security and write the entry
if ( radioSecurityDisabled->isChecked() )
{
- saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + "\"", -1);
+ saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " ssid " + lineSSID->text() + "\"", -1);
} else if (radioSecurityWEP->isChecked() ) {
// Write the settings with WEP enabled
@@ -88,9 +88,10 @@
// If we are using WEP security, write the ifconfig line
QString confLine = "ifconfig_" + DeviceName + "=\"";
- confLine += "authmode shared wepmode on weptxkey " + tmp.setNum(WEPIndex);
- confLine += " wepkey " + WEPKey;
- confLine += " " + ifConfigLine + "\"";
+ confLine += ifConfigLine;
+ confLine += " ssid " + lineSSID->text() + " wepmode on";
+ confLine += " wepkey 0x" + WEPKey + " weptxkey " + tmp.setNum(WEPIndex);
+ confLine += "\"";
saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, confLine, -1);
} else if (radioSecurityWPAPersonal->isChecked() ) {
@@ -883,15 +884,57 @@
// Look for the SSID
if ( tmp.find("ssid") != -1 ) {
tmp2 = tmp;
- tmp2 = tmp2.remove(0, tmp.find("ssid") + 5 );
+ tmp2 = tmp2.remove(0, tmp.find("ssid") + 4 );
tmp2.simplifyWhiteSpace();
if ( tmp2.find(" ") != -1 ) {
- tmp2.truncate(tmp.find(" ") );
+ tmp2 = tmp2.section( " " , 1, 1 );
}
- lineSSID->setText(tmp2);
+ lineSSID->setText(tmp2);
}
+
+ // Look for the WEP Encryption
+ if ( tmp.find("wepkey") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("wepkey") + 6 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+ tmp2.remove(0, 2);
+ WEPKey = tmp2;
+ radioSecurityWEP->setChecked(TRUE);
+ }
+
+ // Look for the WEP transmit key
+ if ( tmp.find("weptxkey") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("weptxkey") + 8 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+
+ ok = tmp2.toInt(&ok);
+ if ( ok ) {
+ WEPIndex = tmp2.toInt(&ok);
+ }
+ radioSecurityWEP->setChecked(TRUE);
+ }
+
} else {
+
+ // Look for the SSID
+ if ( tmp.find("ssid") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("ssid") + 4 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+ lineSSID->setText(tmp2);
+ }
+
// Get the IP address first
tmp2 = tmp;
tmp2 = tmp2.remove(0, tmp.find("inet") + 5 );
@@ -922,6 +965,35 @@
checkMAC->setChecked(FALSE);
groupMAC->setEnabled(TRUE);
}
+
+ // Look for the WEP Encryption
+ if ( tmp.find("wepkey") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("wepkey") + 7 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+ tmp2.remove(0, 2);
+ WEPKey = tmp2;
+ radioSecurityWEP->setChecked(TRUE);
+ }
+
+ // Look for the WEP transmit key
+ if ( tmp.find("weptxkey") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("weptxkey") + 9 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+
+ ok = tmp2.toInt(&ok);
+ if ( ok ) {
+ WEPIndex = tmp2.toInt(&ok);
+ }
+ radioSecurityWEP->setChecked(TRUE);
+ }
}
More information about the Commits
mailing list