-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wextensions.cpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index 16654bb..827d075 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp | |||
@@ -97,12 +97,15 @@ double WExtensions::frequency(){ | |||
97 | */ | 97 | */ |
98 | int WExtensions::channel(){ | 98 | int WExtensions::channel(){ |
99 | if(!hasWirelessExtensions) | 99 | if(!hasWirelessExtensions) |
100 | return 0; | 100 | return 0; |
101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | 101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) |
102 | return 0; | 102 | return 0; |
103 | |||
104 | // http://www.elanix.com/pdf/an137e.pdf | ||
105 | |||
103 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
104 | double left = 2.401; | 107 | double left = 2.401; |
105 | double right = 2.416; | 108 | double right = 2.416; |
106 | for(int channel = 1; channel<= 15; channel++){ | 109 | for(int channel = 1; channel<= 15; channel++){ |
107 | if( num >= left && num <= right ) | 110 | if( num >= left && num <= right ) |
108 | return channel; | 111 | return channel; |
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index 16654bb..827d075 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp | |||
@@ -97,12 +97,15 @@ double WExtensions::frequency(){ | |||
97 | */ | 97 | */ |
98 | int WExtensions::channel(){ | 98 | int WExtensions::channel(){ |
99 | if(!hasWirelessExtensions) | 99 | if(!hasWirelessExtensions) |
100 | return 0; | 100 | return 0; |
101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | 101 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) |
102 | return 0; | 102 | return 0; |
103 | |||
104 | // http://www.elanix.com/pdf/an137e.pdf | ||
105 | |||
103 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 106 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
104 | double left = 2.401; | 107 | double left = 2.401; |
105 | double right = 2.416; | 108 | double right = 2.416; |
106 | for(int channel = 1; channel<= 15; channel++){ | 109 | for(int channel = 1; channel<= 15; channel++){ |
107 | if( num >= left && num <= right ) | 110 | if( num >= left && num <= right ) |
108 | return channel; | 111 | return channel; |