[PC-BSD Commits] r1424 - pcbsd/trunk/wificonfig
svn at pcbsd.org
svn at pcbsd.org
Thu Feb 21 12:31:22 PST 2008
Author: kris
Date: 2008-02-21 12:31:22 -0800 (Thu, 21 Feb 2008)
New Revision: 1424
Modified:
pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h
Log:
Added support for BSSID to the wificonfig tool
Modified: pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h
===================================================================
--- pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h 2008-02-21 19:05:50 UTC (rev 1423)
+++ pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui.h 2008-02-21 20:31:22 UTC (rev 1424)
@@ -74,7 +74,11 @@
// Check if we are not using security and write the entry
if ( radioSecurityDisabled->isChecked() )
{
- saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " ssid " + lineSSID->text() + "\"", -1);
+ if ( checkBSSID->isChecked() ) {
+ saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " bssid " + lineBSSID->text() + "\"", -1);
+ } else {
+ saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " ssid " + lineSSID->text() + "\"", -1);
+ }
} else if (radioSecurityWEP->isChecked() ) {
// Write the settings with WEP enabled
@@ -90,7 +94,11 @@
// If we are using WEP security, write the ifconfig line
QString confLine = "ifconfig_" + DeviceName + "=\"";
confLine += ifConfigLine;
- confLine += " ssid \"" + lineSSID->text() + "\" wepmode on";
+ if ( checkBSSID->isChecked() ) {
+ confLine += " bssid " + lineBSSID->text() + " wepmode on";
+ } else {
+ confLine += " ssid \"" + lineSSID->text() + "\" wepmode on";
+ }
confLine += " wepkey 0x" + WEPKey + " weptxkey " + tmp.setNum(WEPIndex);
confLine += "\"";
saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, confLine, -1);
@@ -113,7 +121,12 @@
QFile fileout( "/etc/wpa_supplicant.conf" );
if ( fileout.open( IO_WriteOnly ) ) {
QTextStream streamout( &fileout );
- streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n ";
+ if ( checkBSSID->isChecked() ) {
+ streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n ";
+ } else {
+ streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n ";
+ }
+
streamout << " psk=\"" + WPAPersonalKey + "\"\n}\n";
fileout.close();
}
@@ -415,7 +428,7 @@
if ( line.find('"') != -1 )
{
- line.truncate(line.find('"'));
+ line.truncate(line.findRev('"'));
}
return line;
@@ -886,13 +899,35 @@
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 );
}
+ if ( tmp2.find("\"") != -1)
+ {
+ tmp2 = tmp2.remove(0, tmp2.find("\"") +1 );
+ tmp2.truncate(tmp2.findRev("\"") );
+ }
lineSSID->setText(tmp2);
}
+
+
+ // Look for the BSSID
+ if ( tmp.find("bssid") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("bssid") + 5 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+ lineBSSID->setText(tmp2);
+ lineSSID->setText("");
+ checkBSSID->setChecked(TRUE);
+ slotBSSIDChecked();
+ }
+
// Look for the WEP Encryption
if ( tmp.find("wepkey") != -1 ) {
tmp2 = tmp;
@@ -930,11 +965,32 @@
tmp2 = tmp;
tmp2 = tmp2.remove(0, tmp.find("ssid") + 4 );
tmp2.simplifyWhiteSpace();
+
if ( tmp2.find(" ") != -1 ) {
tmp2 = tmp2.section( " " , 1, 1 );
}
+ if ( tmp2.find("\"") != -1)
+ {
+ tmp2 = tmp2.remove(0, tmp2.find("\"") +1 );
+ tmp2.truncate(tmp2.findRev("\"") );
+ }
+
lineSSID->setText(tmp2);
}
+
+ // Look for the BSSID
+ if ( tmp.find("bssid") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.find("bssid") + 5 );
+ tmp2.simplifyWhiteSpace();
+ if ( tmp2.find(" ") != -1 ) {
+ tmp2 = tmp2.section( " " , 1, 1 );
+ }
+ lineBSSID->setText(tmp2);
+ lineSSID->setText("");
+ checkBSSID->setChecked(TRUE);
+ slotBSSIDChecked();
+ }
// Get the IP address first
tmp2 = tmp;
@@ -1207,3 +1263,17 @@
}
+
+
+void wificonfigWidgetBase::slotBSSIDChecked()
+{
+ if ( checkBSSID->isChecked() )
+ {
+ groupBSSID->setEnabled(TRUE);
+ lineBSSID->setEnabled(TRUE);
+ } else {
+ groupBSSID->setEnabled(FALSE);
+ lineBSSID->setEnabled(FALSE);
+ }
+ pushApply->setEnabled(TRUE);
+}
More information about the Commits
mailing list