Changeset 2895

Show
Ignore:
Timestamp:
10/11/08 06:46:46 (17 months ago)
Author:
kris
Message:

Updated the wifi selection dialog to fix a few bugs.

1. Fixed issues with long SSIDs and SSID's with multiple spaces in the name
being detected and used properly.

2. Fixed an issue of connecting to non-WEP wlans, when using ssid with a space in the name.

Needs a bit of testing still :)

Location:
pcbsd
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • pcbsd/branches/7.0/wificonfig/wificonfigwidgetbase.cpp

    r2669 r2895  
    7878     if ( radioSecurityDisabled->isChecked() ) 
    7979    { 
    80         if ( checkBSSID->isChecked() ) { 
    81              saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " bssid " + lineBSSID->text() + "\"", -1); 
    82         } else { 
    83                     saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " ssid " + lineSSID->text() + "\"", -1); 
    84               } 
     80        saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
     81 
     82        // Now create the wpa_supplicant file based on saved configuration 
     83        QFile fileout( "/etc/wpa_supplicant.conf" ); 
     84        if ( fileout.open( IO_WriteOnly ) ) { 
     85 
     86          QTextStream streamout( &fileout ); 
     87          if ( checkBSSID->isChecked() ) { 
     88            streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n"; 
     89          } else { 
     90            streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n"; 
     91          } 
     92 
     93          streamout << " scan_ssid=1\n"; 
     94          streamout << " key_mgmt=NONE\n"; 
     95          streamout << "}\n"; 
     96          fileout.close(); 
     97 
     98        } 
    8599     } else if (radioSecurityWEP->isChecked() ) { 
    86100        // Write the settings with WEP enabled 
     
    10051019                   } 
    10061020         
    1007                    if ( line.find("key_mgmt=") != -1 ) 
    1008                    { 
    1009                         tmp2 = line.remove(0, line.find("=") +1 ); 
    1010                         if ( tmp2 == "NONE" ) { 
    1011                                 radioSecurityWEP->setChecked(TRUE); 
    1012                         } 
    1013                          
    1014                    } 
     1021                   // Check if we are using a WEP key for this network 
    10151022                   if ( line.find("wep_key") != -1 ) 
    10161023                   {                    
     
    10201027                        radioSecurityWEP->setChecked(TRUE);      
    10211028                   } 
    1022                     if ( line.find("wep_tx_keyidx") != -1 ) 
     1029 
     1030                   // Check for the WEP tx key id 
     1031                   if ( line.find("wep_tx_keyidx") != -1 ) 
    10231032                   {                    
    10241033                        tmp2 = line.remove(0, line.find("wep_tx_keyidx") +1 ); 
  • pcbsd/branches/7.0/wificonfig/wifiselectiondialog.cpp

    r2669 r2895  
    4646     
    4747    // Start the scan and get the output 
    48     line = getLineFromCommandOutput("ifconfig " + DeviceName + " up list scan >/tmp/.wifilist 2>/tmp/.wifilist"); 
     48    line = getLineFromCommandOutput("ifconfig -v " + DeviceName + " up list scan >/tmp/.wifilist 2>/tmp/.wifilist"); 
    4949 
    5050    // Now read the output file 
     
    6060                 tmp = line; 
    6161                 tmp = tmp.simplified(); 
    62                  tmp.truncate(tmp.find(":")); 
    63                  tmp.truncate(tmp.findRev(" ")); 
     62                 tmp.remove(0, tmp.indexOf("SSID<") + 5); 
     63                 tmp.truncate(tmp.indexOf(">")); 
    6464                 ssid = tmp; 
    65                   
     65 
    6666                 // Get the signal strength of this device 
    6767                 tmp = line; 
     
    7272                   
    7373                 // Now find the strength section 
    74                  tmp = tmp.section(" ", 3, 3); 
    75                  tmp.truncate(tmp.find(":")); 
     74                 tmp.truncate(tmp.findRev("SSID<")); 
     75                 tmp.truncate(tmp.findRev(":")); 
     76                 tmp.remove(0, tmp.findRev(" ")); 
    7677                 strength = tmp; 
    7778                                 
     79                 //QMessageBox::warning( this, "Testing", "SSID:" + ssid + " STR:" + strength ); 
    7880                 // Add the device to the list box 
    7981                 strength.toInt(&ok); 
    80                  if ( ok ) { 
     82                 if ( ok && !ssid.isEmpty() && ssid != " " ) { 
    8183                     newStrength = tmp.toInt(&ok); 
    8284                     if ( newStrength < 25 ) 
     
    100102                  
    101103             } else { 
     104                  if ( ! ssid.isEmpty() && ssid != " " ) { 
    102105                       // If we didn't get the signal strength, still display the SSID 
    103106                       FileLoad="/PCBSD/networkmanager/pics/tray_wifi.png"; 
     
    108111                        
    109112                       foundItem = 1; 
     113                  } 
    110114             } 
    111115             
  • pcbsd/branches/7.0/wificonfig/wifiselectiondialog.ui

    r2166 r2895  
    66    <x>0</x> 
    77    <y>0</y> 
    8     <width>292</width> 
    9     <height>274</height> 
     8    <width>420</width> 
     9    <height>314</height> 
    1010   </rect> 
    1111  </property> 
  • pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp

    r2669 r2895  
    7878     if ( radioSecurityDisabled->isChecked() ) 
    7979    { 
    80         if ( checkBSSID->isChecked() ) { 
    81              saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " bssid " + lineBSSID->text() + "\"", -1); 
    82         } else { 
    83                     saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"" + ifConfigLine + " ssid " + lineSSID->text() + "\"", -1); 
    84               } 
     80        saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
     81 
     82        // Now create the wpa_supplicant file based on saved configuration 
     83        QFile fileout( "/etc/wpa_supplicant.conf" ); 
     84        if ( fileout.open( IO_WriteOnly ) ) { 
     85 
     86          QTextStream streamout( &fileout ); 
     87          if ( checkBSSID->isChecked() ) { 
     88            streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n"; 
     89          } else { 
     90            streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n"; 
     91          } 
     92 
     93          streamout << " scan_ssid=1\n"; 
     94          streamout << " key_mgmt=NONE\n"; 
     95          streamout << "}\n"; 
     96          fileout.close(); 
     97 
     98        } 
    8599     } else if (radioSecurityWEP->isChecked() ) { 
    86100        // Write the settings with WEP enabled 
     
    10051019                   } 
    10061020         
    1007                    if ( line.find("key_mgmt=") != -1 ) 
    1008                    { 
    1009                         tmp2 = line.remove(0, line.find("=") +1 ); 
    1010                         if ( tmp2 == "NONE" ) { 
    1011                                 radioSecurityWEP->setChecked(TRUE); 
    1012                         } 
    1013                          
    1014                    } 
     1021                   // Check if we are using a WEP key for this network 
    10151022                   if ( line.find("wep_key") != -1 ) 
    10161023                   {                    
     
    10201027                        radioSecurityWEP->setChecked(TRUE);      
    10211028                   } 
    1022                     if ( line.find("wep_tx_keyidx") != -1 ) 
     1029 
     1030                   // Check for the WEP tx key id 
     1031                   if ( line.find("wep_tx_keyidx") != -1 ) 
    10231032                   {                    
    10241033                        tmp2 = line.remove(0, line.find("wep_tx_keyidx") +1 ); 
  • pcbsd/trunk/wificonfig/wifiselectiondialog.cpp

    r2669 r2895  
    4646     
    4747    // Start the scan and get the output 
    48     line = getLineFromCommandOutput("ifconfig " + DeviceName + " up list scan >/tmp/.wifilist 2>/tmp/.wifilist"); 
     48    line = getLineFromCommandOutput("ifconfig -v " + DeviceName + " up list scan >/tmp/.wifilist 2>/tmp/.wifilist"); 
    4949 
    5050    // Now read the output file 
     
    6060                 tmp = line; 
    6161                 tmp = tmp.simplified(); 
    62                  tmp.truncate(tmp.find(":")); 
    63                  tmp.truncate(tmp.findRev(" ")); 
     62                 tmp.remove(0, tmp.indexOf("SSID<") + 5); 
     63                 tmp.truncate(tmp.indexOf(">")); 
    6464                 ssid = tmp; 
    65                   
     65 
    6666                 // Get the signal strength of this device 
    6767                 tmp = line; 
     
    7272                   
    7373                 // Now find the strength section 
    74                  tmp = tmp.section(" ", 3, 3); 
    75                  tmp.truncate(tmp.find(":")); 
     74                 tmp.truncate(tmp.findRev("SSID<")); 
     75                 tmp.truncate(tmp.findRev(":")); 
     76                 tmp.remove(0, tmp.findRev(" ")); 
    7677                 strength = tmp; 
    7778                                 
     79                 //QMessageBox::warning( this, "Testing", "SSID:" + ssid + " STR:" + strength ); 
    7880                 // Add the device to the list box 
    7981                 strength.toInt(&ok); 
    80                  if ( ok ) { 
     82                 if ( ok && !ssid.isEmpty() && ssid != " " ) { 
    8183                     newStrength = tmp.toInt(&ok); 
    8284                     if ( newStrength < 25 ) 
     
    100102                  
    101103             } else { 
     104                  if ( ! ssid.isEmpty() && ssid != " " ) { 
    102105                       // If we didn't get the signal strength, still display the SSID 
    103106                       FileLoad="/PCBSD/networkmanager/pics/tray_wifi.png"; 
     
    108111                        
    109112                       foundItem = 1; 
     113                  } 
    110114             } 
    111115             
  • pcbsd/trunk/wificonfig/wifiselectiondialog.ui

    r2166 r2895  
    66    <x>0</x> 
    77    <y>0</y> 
    8     <width>292</width> 
    9     <height>274</height> 
     8    <width>420</width> 
     9    <height>314</height> 
    1010   </rect> 
    1111  </property>