15 files changed, 40 insertions, 34 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/config.in b/noncore/settings/networksettings2/bluetooth/config.in index e5155e8..b1a5a58 100644 --- a/noncore/settings/networksettings2/bluetooth/config.in +++ b/noncore/settings/networksettings2/bluetooth/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2BT | 1 | config NS2BT |
2 | boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)" | 2 | boolean "opie-networksettings2plugin-bluetooth (set up BLUETOOTH)" |
3 | default "n" if NS2 | 3 | default "n" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/cable/config.in b/noncore/settings/networksettings2/cable/config.in index 1cdcaa1..9007f14 100644 --- a/noncore/settings/networksettings2/cable/config.in +++ b/noncore/settings/networksettings2/cable/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2CABLE | 1 | config NS2CABLE |
2 | boolean "opie-networksettings2plugin-cable (set up Cable)" | 2 | boolean "opie-networksettings2plugin-cable (set up Cable)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/config.in b/noncore/settings/networksettings2/config.in index 1004ce4..ac38c2f 100644 --- a/noncore/settings/networksettings2/config.in +++ b/noncore/settings/networksettings2/config.in | |||
@@ -1,22 +1,23 @@ | |||
1 | source noncore/settings/networksettings2/networksettings2/config.in | ||
2 | |||
1 | config NS2 | 3 | config NS2 |
2 | boolean "opie-networksettings-2 (TCP/IP network settings)" | 4 | boolean |
3 | default "y" | 5 | default "y" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE | 6 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN |
5 | 7 | ||
6 | config NS2CORE | 8 | config NS2CORE |
7 | boolean | 9 | boolean |
8 | default "y" if NS2 | 10 | default "y" if NS2 |
9 | depends ( LIBQPE || LIBQPE-X11 ) && NS2 | 11 | depends ( LIBQPE || LIBQPE-X11 ) && NS2 |
10 | 12 | ||
11 | source noncore/settings/networksettings2/profile/config.in | 13 | source noncore/settings/networksettings2/profile/config.in |
12 | source noncore/settings/networksettings2/network/config.in | 14 | source noncore/settings/networksettings2/network/config.in |
13 | source noncore/settings/networksettings2/lancard/config.in | 15 | source noncore/settings/networksettings2/lancard/config.in |
14 | source noncore/settings/networksettings2/ppp/config.in | 16 | source noncore/settings/networksettings2/ppp/config.in |
15 | source noncore/settings/networksettings2/wlan/config.in | 17 | source noncore/settings/networksettings2/wlan/config.in |
16 | source noncore/settings/networksettings2/usb/config.in | 18 | source noncore/settings/networksettings2/usb/config.in |
17 | source noncore/settings/networksettings2/irda/config.in | 19 | source noncore/settings/networksettings2/irda/config.in |
18 | source noncore/settings/networksettings2/vpn/config.in | 20 | source noncore/settings/networksettings2/vpn/config.in |
19 | source noncore/settings/networksettings2/bluetooth/config.in | 21 | source noncore/settings/networksettings2/bluetooth/config.in |
20 | source noncore/settings/networksettings2/cable/config.in | 22 | source noncore/settings/networksettings2/cable/config.in |
21 | source noncore/settings/networksettings2/modem/config.in | 23 | source noncore/settings/networksettings2/modem/config.in |
22 | source noncore/settings/networksettings2/networksettings2/config.in | ||
diff --git a/noncore/settings/networksettings2/irda/config.in b/noncore/settings/networksettings2/irda/config.in index dd86b61..0da9a25 100644 --- a/noncore/settings/networksettings2/irda/config.in +++ b/noncore/settings/networksettings2/irda/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2IRDA | 1 | config NS2IRDA |
2 | boolean "opie-networksettings2plugin-irda (set up IRDA)" | 2 | boolean "opie-networksettings2plugin-irda (set up IRDA)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/lancard/config.in b/noncore/settings/networksettings2/lancard/config.in index 71fb83e..c694908 100644 --- a/noncore/settings/networksettings2/lancard/config.in +++ b/noncore/settings/networksettings2/lancard/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2LANCARD | 1 | config NS2LANCARD |
2 | boolean "opie-networksettings2plugin-lancard (regular wired lan card)" | 2 | boolean "opie-networksettings2plugin-lancard (regular wired lan card)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index b32b323..200e31b 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -1,146 +1,147 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "activateprofile.h" | 2 | #include "activateprofile.h" |
3 | #include "activatevpn.h" | 3 | #include "activatevpn.h" |
4 | #include "networksettings.h" | 4 | #include "networksettings.h" |
5 | 5 | ||
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | 7 | ||
8 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
9 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
10 | 10 | ||
11 | #ifdef GONE | 11 | #ifdef GONE |
12 | 12 | ||
13 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | 13 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) |
14 | 14 | ||
15 | #else | 15 | #else |
16 | 16 | ||
17 | // just standard GUI | 17 | // just standard GUI |
18 | #define ACT_GUI 0 | 18 | #define ACT_GUI 0 |
19 | // used by interfaces to request for allow of up/down | 19 | // used by interfaces to request for allow of up/down |
20 | #define ACT_REQUEST 1 | 20 | #define ACT_REQUEST 1 |
21 | // regenerate config files | 21 | // regenerate config files |
22 | #define ACT_REGEN 2 | 22 | #define ACT_REGEN 2 |
23 | // used by interfaces to request user prompt | 23 | // used by interfaces to request user prompt |
24 | #define ACT_PROMPT 3 | 24 | #define ACT_PROMPT 3 |
25 | // used by interfaces to trigger VPN | 25 | // used by interfaces to trigger VPN |
26 | #define ACT_VPN 4 | 26 | #define ACT_VPN 4 |
27 | 27 | ||
28 | int main( int argc, char * argv[] ) { | 28 | int main( int argc, char * argv[] ) { |
29 | int rv = 0; | 29 | int rv = 0; |
30 | int Action = ACT_GUI; | 30 | int Action = ACT_GUI; |
31 | // could be overruled by -qws | 31 | // could be overruled by -qws |
32 | QApplication::Type GuiType = QApplication::GuiClient; | 32 | QApplication::Type GuiType = QApplication::GuiClient; |
33 | 33 | ||
34 | #ifdef _WS_QWS_ | 34 | #ifdef _WS_QWS_ |
35 | QPEApplication * TheApp; | 35 | QPEApplication * TheApp; |
36 | #else | 36 | #else |
37 | QApplication * TheApp; | 37 | QApplication * TheApp; |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | for ( int i = 1; i < argc; i ++ ) { | 40 | for ( int i = 1; i < argc; i ++ ) { |
41 | int rmv; | 41 | int rmv; |
42 | rmv = 0; | 42 | rmv = 0; |
43 | if( strcmp( argv[i], "--regen" ) == 0 ) { | 43 | if( strcmp( argv[i], "--regen" ) == 0 ) { |
44 | Action = ACT_REGEN; | 44 | Action = ACT_REGEN; |
45 | GuiType = QApplication::Tty; | 45 | GuiType = QApplication::Tty; |
46 | rmv = 1; | 46 | rmv = 1; |
47 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { | 47 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { |
48 | Action = ACT_PROMPT; | 48 | Action = ACT_PROMPT; |
49 | rmv = 1; | 49 | rmv = 1; |
50 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { | 50 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { |
51 | Action = ACT_VPN; | 51 | Action = ACT_VPN; |
52 | rmv = 1; | 52 | rmv = 1; |
53 | } | 53 | } |
54 | if( rmv ) { | 54 | if( rmv ) { |
55 | memmove( argv+i, argv+i+rmv, | 55 | memmove( argv+i, argv+i+rmv, |
56 | sizeof( char * ) * (argc-i-rmv) ); | 56 | sizeof( char * ) * (argc-i-rmv) ); |
57 | i --; | 57 | i --; |
58 | argc -= rmv; | 58 | argc -= rmv; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | if( strstr( argv[0], "-request" ) ) { | 62 | if( strstr( argv[0], "-request" ) ) { |
63 | // called from system to request something | 63 | // called from system to request something |
64 | GuiType = QApplication::Tty; | 64 | GuiType = QApplication::Tty; |
65 | Action = ACT_REQUEST; | 65 | Action = ACT_REQUEST; |
66 | Log(("Request : %s\n", argv[1] )); | ||
66 | } | 67 | } |
67 | 68 | ||
68 | // Start Qt | 69 | // Start Qt |
69 | #ifdef _WS_QWS_ | 70 | #ifdef _WS_QWS_ |
70 | // because QPEApplication does not handle GuiType well | 71 | // because QPEApplication does not handle GuiType well |
71 | if( GuiType == QApplication::Tty ) { | 72 | if( GuiType == QApplication::Tty ) { |
72 | // this cast is NOT correct but we do not use | 73 | // this cast is NOT correct but we do not use |
73 | // TheApp anymore ... | 74 | // TheApp anymore ... |
74 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); | 75 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); |
75 | } else { | 76 | } else { |
76 | TheApp = new QPEApplication( argc, argv, GuiType ); | 77 | TheApp = new QPEApplication( argc, argv, GuiType ); |
77 | } | 78 | } |
78 | #else | 79 | #else |
79 | TheApp = new QApplication( argc, argv, GuiType ); | 80 | TheApp = new QApplication( argc, argv, GuiType ); |
80 | #endif | 81 | #endif |
81 | 82 | ||
82 | // init qt with app widget | 83 | // init qt with app widget |
83 | 84 | ||
84 | switch( Action ) { | 85 | switch( Action ) { |
85 | case ACT_REQUEST : | 86 | case ACT_REQUEST : |
86 | { NetworkSettingsData NS; | 87 | { NetworkSettingsData NS; |
87 | if( NS.canStart( argv[1] ) ) { | 88 | if( NS.canStart( argv[1] ) ) { |
88 | QString S; | 89 | QString S; |
89 | S.sprintf( QPEApplication::qpeDir()+ | 90 | S.sprintf( QPEApplication::qpeDir()+ |
90 | "/bin/networksettings2" ); | 91 | "/bin/networksettings2" ); |
91 | char * MyArgv[4]; | 92 | char * MyArgv[4]; |
92 | MyArgv[0] = "networksettings2"; | 93 | MyArgv[0] = "networksettings2"; |
93 | MyArgv[1] = "--prompt"; | 94 | MyArgv[1] = "--prompt"; |
94 | MyArgv[2] = argv[1]; | 95 | MyArgv[2] = argv[1]; |
95 | MyArgv[3] = NULL; | 96 | MyArgv[3] = NULL; |
96 | NSResources->system().execAsUser( S, MyArgv ); | 97 | NSResources->system().execAsUser( S, MyArgv ); |
97 | // if we come here , failed | 98 | // if we come here , failed |
98 | printf( "%s-cNN-disallowed", argv[1] ); | 99 | printf( "%s-cNN-disallowed", argv[1] ); |
99 | } | 100 | } |
100 | } | 101 | } |
101 | break; | 102 | break; |
102 | case ACT_REGEN : | 103 | case ACT_REGEN : |
103 | { NetworkSettingsData NS; | 104 | { NetworkSettingsData NS; |
104 | // regen returns 0 if OK | 105 | // regen returns 0 if OK |
105 | rv = (NS.regenerate()) ? 1 : 0; | 106 | rv = (NS.regenerate()) ? 1 : 0; |
106 | } | 107 | } |
107 | break; | 108 | break; |
108 | case ACT_PROMPT : | 109 | case ACT_PROMPT : |
109 | { ActivateProfile AP(argv[1]); | 110 | { ActivateProfile AP(argv[1]); |
110 | if( AP.exec() == QDialog::Accepted ) { | 111 | if( AP.exec() == QDialog::Accepted ) { |
111 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); | 112 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); |
112 | } else { | 113 | } else { |
113 | printf( "%s-cNN-disallowed", argv[1] ); | 114 | printf( "%s-cNN-disallowed", argv[1] ); |
114 | } | 115 | } |
115 | } | 116 | } |
116 | break; | 117 | break; |
117 | case ACT_VPN : | 118 | case ACT_VPN : |
118 | { ActivateVPN AVPN; | 119 | { ActivateVPN AVPN; |
119 | AVPN.exec(); | 120 | AVPN.exec(); |
120 | } | 121 | } |
121 | break; | 122 | break; |
122 | case ACT_GUI : | 123 | case ACT_GUI : |
123 | { QWidget * W = new NetworkSettings(0); | 124 | { QWidget * W = new NetworkSettings(0); |
124 | TheApp->setMainWidget( W ); | 125 | TheApp->setMainWidget( W ); |
125 | W->show(); | 126 | W->show(); |
126 | #ifdef _WS_QWS_ | 127 | #ifdef _WS_QWS_ |
127 | W->showMaximized(); | 128 | W->showMaximized(); |
128 | #else | 129 | #else |
129 | W->resize( W->sizeHint() ); | 130 | W->resize( W->sizeHint() ); |
130 | #endif | 131 | #endif |
131 | rv = TheApp->exec(); | 132 | rv = TheApp->exec(); |
132 | delete W; | 133 | delete W; |
133 | } | 134 | } |
134 | break; | 135 | break; |
135 | } | 136 | } |
136 | 137 | ||
137 | LogClose(); | 138 | LogClose(); |
138 | 139 | ||
139 | return rv; | 140 | return rv; |
140 | } | 141 | } |
141 | 142 | ||
142 | #endif | 143 | #endif |
143 | 144 | ||
144 | 145 | ||
145 | // main.cpp | 146 | // main.cpp |
146 | 147 | ||
diff --git a/noncore/settings/networksettings2/modem/config.in b/noncore/settings/networksettings2/modem/config.in index 1a36636..a354da0 100644 --- a/noncore/settings/networksettings2/modem/config.in +++ b/noncore/settings/networksettings2/modem/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2MODEM | 1 | config NS2MODEM |
2 | boolean "opie-networksettings2plugin-modem (set up DIALUP)" | 2 | boolean "opie-networksettings2plugin-modem (set up DIALUP)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/network/config.in b/noncore/settings/networksettings2/network/config.in index 4c37974..725b7f0 100644 --- a/noncore/settings/networksettings2/network/config.in +++ b/noncore/settings/networksettings2/network/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2NETWORK | 1 | config NS2NETWORK |
2 | boolean "opie-networksettings2plugin-ipsetup (set up TCP/IP)" | 2 | boolean "opie-networksettings2plugin-ipsetup (set up TCP/IP)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/networksettings2/config.in b/noncore/settings/networksettings2/networksettings2/config.in index 907f1a0..2b4e2f3 100644 --- a/noncore/settings/networksettings2/networksettings2/config.in +++ b/noncore/settings/networksettings2/networksettings2/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2MAIN | 1 | config NS2MAIN |
2 | boolean | 2 | boolean "opie-networksettings2 (TCP/IP network settings)" |
3 | default "y" if NS2 | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE |
diff --git a/noncore/settings/networksettings2/networksettings2/wextensions.cpp b/noncore/settings/networksettings2/networksettings2/wextensions.cpp index 778990c..c10bdc3 100644 --- a/noncore/settings/networksettings2/networksettings2/wextensions.cpp +++ b/noncore/settings/networksettings2/networksettings2/wextensions.cpp | |||
@@ -1,203 +1,207 @@ | |||
1 | #include "wextensions.h" | 1 | #include "wextensions.h" |
2 | 2 | ||
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
5 | 5 | ||
6 | #include <arpa/inet.h> | 6 | #include <arpa/inet.h> |
7 | #include <sys/socket.h> | 7 | #include <sys/socket.h> |
8 | #include <sys/ioctl.h> | 8 | #include <sys/ioctl.h> |
9 | 9 | ||
10 | #include <opie2/odebug.h> | 10 | #include <opie2/odebug.h> |
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | 12 | ||
13 | #include <math.h> | 13 | #include <math.h> |
14 | 14 | ||
15 | #define PROCNETWIRELESS "/proc/net/wireless" | 15 | #define PROCNETWIRELESS "/proc/net/wireless" |
16 | #define IW_LOWER 0 | 16 | #define IW_LOWER 0 |
17 | #define IW_UPPER 256 | 17 | #define IW_UPPER 256 |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Constructor. Sets hasWirelessExtensions | 20 | * Constructor. Sets hasWirelessExtensions |
21 | */ | 21 | */ |
22 | WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { | 22 | WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { |
23 | fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 23 | fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
24 | if(fd == -1) | 24 | if(fd == -1) |
25 | return; | 25 | return; |
26 | 26 | ||
27 | const char* buffer[200]; | 27 | const char* buffer[200]; |
28 | memset( &iwr, 0, sizeof( iwr ) ); | 28 | memset( &iwr, 0, sizeof( iwr ) ); |
29 | iwr.u.essid.pointer = (caddr_t) buffer; | 29 | iwr.u.essid.pointer = (caddr_t) buffer; |
30 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 30 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
31 | iwr.u.essid.flags = 0; | 31 | iwr.u.essid.flags = 0; |
32 | 32 | ||
33 | // check if it is an IEEE 802.11 standard conform | 33 | // check if it is an IEEE 802.11 standard conform |
34 | // wireless device by sending SIOCGIWESSID | 34 | // wireless device by sending SIOCGIWESSID |
35 | // which also gives back the Extended Service Set ID | 35 | // which also gives back the Extended Service Set ID |
36 | // (see IEEE 802.11 for more information) | 36 | // (see IEEE 802.11 for more information) |
37 | 37 | ||
38 | const char* iname = interface.latin1(); | 38 | const char* iname = interface.latin1(); |
39 | strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); | 39 | strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); |
40 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) | 40 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) |
41 | hasWirelessExtensions = true; | 41 | hasWirelessExtensions = true; |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @return QString the station name of the access point. | 45 | * @return QString the station name of the access point. |
46 | */ | 46 | */ |
47 | QString WExtensions::station(){ | 47 | QString WExtensions::station(){ |
48 | if(!hasWirelessExtensions) | 48 | if(!hasWirelessExtensions) |
49 | return QString(); | 49 | return QString(); |
50 | const char* buffer[200]; | 50 | const char* buffer[200]; |
51 | iwr.u.data.pointer = (caddr_t) buffer; | 51 | iwr.u.data.pointer = (caddr_t) buffer; |
52 | iwr.u.data.length = IW_ESSID_MAX_SIZE; | 52 | iwr.u.data.length = IW_ESSID_MAX_SIZE; |
53 | iwr.u.data.flags = 0; | 53 | iwr.u.data.flags = 0; |
54 | if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ | 54 | if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ |
55 | iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; | 55 | buffer[(unsigned int) iwr.u.data.length-1] = '\0'; |
56 | return QString(iwr.u.data.pointer); | 56 | return (const char *)buffer; |
57 | } | 57 | } |
58 | return QString(); | 58 | return QString::null; |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * @return QString the essid of the host 802.11 access point. | 62 | * @return QString the essid of the host 802.11 access point. |
63 | */ | 63 | */ |
64 | QString WExtensions::essid(){ | 64 | QString WExtensions::essid(){ |
65 | if(!hasWirelessExtensions) | 65 | if(!hasWirelessExtensions) |
66 | return QString(); | 66 | return QString(); |
67 | const char* buffer[200]; | ||
68 | iwr.u.data.pointer = (caddr_t) buffer; | ||
69 | iwr.u.data.length = IW_ESSID_MAX_SIZE; | ||
70 | iwr.u.data.flags = 0; | ||
67 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ | 71 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ |
68 | iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0'; | 72 | buffer[(unsigned int) iwr.u.essid.length] = '\0'; |
69 | return QString(iwr.u.essid.pointer); | 73 | return (const char *)buffer; |
70 | } | 74 | } |
71 | return QString(); | 75 | return QString(); |
72 | } | 76 | } |
73 | 77 | ||
74 | /** | 78 | /** |
75 | * @return QString the mode of interface | 79 | * @return QString the mode of interface |
76 | */ | 80 | */ |
77 | QString WExtensions::mode(){ | 81 | QString WExtensions::mode(){ |
78 | if(!hasWirelessExtensions) | 82 | if(!hasWirelessExtensions) |
79 | return QString(); | 83 | return QString(); |
80 | if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) | 84 | if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) |
81 | return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); | 85 | return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); |
82 | return QString(); | 86 | return QString(); |
83 | } | 87 | } |
84 | 88 | ||
85 | /** | 89 | /** |
86 | * Get the frequency that the interface is running at. | 90 | * Get the frequency that the interface is running at. |
87 | * @return int the frequency that the interfacae is running at. | 91 | * @return int the frequency that the interfacae is running at. |
88 | */ | 92 | */ |
89 | double WExtensions::frequency(){ | 93 | double WExtensions::frequency(){ |
90 | if(!hasWirelessExtensions) | 94 | if(!hasWirelessExtensions) |
91 | return 0; | 95 | return 0; |
92 | if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) | 96 | if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) |
93 | return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 97 | return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
94 | return 0; | 98 | return 0; |
95 | } | 99 | } |
96 | 100 | ||
97 | /** | 101 | /** |
98 | * Get the channel that the interface is running at. | 102 | * Get the channel that the interface is running at. |
99 | * @return int the channel that the interfacae is running at. | 103 | * @return int the channel that the interfacae is running at. |
100 | */ | 104 | */ |
101 | int WExtensions::channel(){ | 105 | int WExtensions::channel(){ |
102 | if(!hasWirelessExtensions) | 106 | if(!hasWirelessExtensions) |
103 | return 0; | 107 | return 0; |
104 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) | 108 | if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) |
105 | return 0; | 109 | return 0; |
106 | 110 | ||
107 | // http://www.elanix.com/pdf/an137e.pdf | 111 | // http://www.elanix.com/pdf/an137e.pdf |
108 | 112 | ||
109 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); | 113 | double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); |
110 | double left = 2.401; | 114 | double left = 2.401; |
111 | double right = 2.416; | 115 | double right = 2.416; |
112 | for(int channel = 1; channel<= 15; channel++){ | 116 | for(int channel = 1; channel<= 15; channel++){ |
113 | if( num >= left && num <= right ) | 117 | if( num >= left && num <= right ) |
114 | return channel; | 118 | return channel; |
115 | left += 0.005; | 119 | left += 0.005; |
116 | right += 0.005; | 120 | right += 0.005; |
117 | } | 121 | } |
118 | odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl; | 122 | odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl; |
119 | return -1; | 123 | return -1; |
120 | } | 124 | } |
121 | 125 | ||
122 | /*** | 126 | /*** |
123 | * Get the current rate that the card is transmiting at. | 127 | * Get the current rate that the card is transmiting at. |
124 | * @return double the rate, 0 if error. | 128 | * @return double the rate, 0 if error. |
125 | */ | 129 | */ |
126 | double WExtensions::rate(){ | 130 | double WExtensions::rate(){ |
127 | if(!hasWirelessExtensions) | 131 | if(!hasWirelessExtensions) |
128 | return 0; | 132 | return 0; |
129 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ | 133 | if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ |
130 | return ((double)iwr.u.bitrate.value)/1000000; | 134 | return ((double)iwr.u.bitrate.value)/1000000; |
131 | } | 135 | } |
132 | return 0; | 136 | return 0; |
133 | } | 137 | } |
134 | 138 | ||
135 | 139 | ||
136 | /** | 140 | /** |
137 | * @return QString the AccessPoint that the interface is connected to. | 141 | * @return QString the AccessPoint that the interface is connected to. |
138 | */ | 142 | */ |
139 | QString WExtensions::ap(){ | 143 | QString WExtensions::ap(){ |
140 | if(!hasWirelessExtensions) | 144 | if(!hasWirelessExtensions) |
141 | return QString(); | 145 | return QString(); |
142 | if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ | 146 | if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ |
143 | QString ap; | 147 | QString ap; |
144 | ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", | 148 | ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", |
145 | iwr.u.ap_addr.sa_data[0]&0xff, | 149 | iwr.u.ap_addr.sa_data[0]&0xff, |
146 | iwr.u.ap_addr.sa_data[1]&0xff, | 150 | iwr.u.ap_addr.sa_data[1]&0xff, |
147 | iwr.u.ap_addr.sa_data[2]&0xff, | 151 | iwr.u.ap_addr.sa_data[2]&0xff, |
148 | iwr.u.ap_addr.sa_data[3]&0xff, | 152 | iwr.u.ap_addr.sa_data[3]&0xff, |
149 | iwr.u.ap_addr.sa_data[4]&0xff, | 153 | iwr.u.ap_addr.sa_data[4]&0xff, |
150 | iwr.u.ap_addr.sa_data[5]&0xff ); | 154 | iwr.u.ap_addr.sa_data[5]&0xff ); |
151 | return ap; | 155 | return ap; |
152 | } | 156 | } |
153 | else return QString(); | 157 | else return QString(); |
154 | } | 158 | } |
155 | 159 | ||
156 | /** | 160 | /** |
157 | * Get the stats for interfaces | 161 | * Get the stats for interfaces |
158 | * @param signal the signal strength of interface | 162 | * @param signal the signal strength of interface |
159 | * @param noise the noise level of the interface | 163 | * @param noise the noise level of the interface |
160 | * @param quality the quality level of the interface | 164 | * @param quality the quality level of the interface |
161 | * @return bool true if successful | 165 | * @return bool true if successful |
162 | */ | 166 | */ |
163 | bool WExtensions::stats(int &signal, int &noise, int &quality){ | 167 | bool WExtensions::stats(int &signal, int &noise, int &quality){ |
164 | // gather link quality from /proc/net/wireless | 168 | // gather link quality from /proc/net/wireless |
165 | if(!QFile::exists(PROCNETWIRELESS)) | 169 | if(!QFile::exists(PROCNETWIRELESS)) |
166 | return false; | 170 | return false; |
167 | 171 | ||
168 | char c; | 172 | char c; |
169 | QString status; | 173 | QString status; |
170 | QString name; | 174 | QString name; |
171 | 175 | ||
172 | QFile wfile( PROCNETWIRELESS ); | 176 | QFile wfile( PROCNETWIRELESS ); |
173 | if(!wfile.open( IO_ReadOnly )) | 177 | if(!wfile.open( IO_ReadOnly )) |
174 | return false; | 178 | return false; |
175 | 179 | ||
176 | QTextStream wstream( &wfile ); | 180 | QTextStream wstream( &wfile ); |
177 | wstream.readLine(); // skip the first two lines | 181 | wstream.readLine(); // skip the first two lines |
178 | wstream.readLine(); // because they only contain headers | 182 | wstream.readLine(); // because they only contain headers |
179 | while(!wstream.atEnd()){ | 183 | while(!wstream.atEnd()){ |
180 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; | 184 | wstream >> name >> status >> quality >> c >> signal >> c >> noise; |
181 | if(name == QString("%1:").arg(interface)){ | 185 | if(name == QString("%1:").arg(interface)){ |
182 | if ( quality > 92 ) | 186 | if ( quality > 92 ) |
183 | odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl; | 187 | odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl; |
184 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) | 188 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) |
185 | odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl; | 189 | odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl; |
186 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) | 190 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) |
187 | odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl; | 191 | odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl; |
188 | //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl; | 192 | //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl; |
189 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; | 193 | signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; |
190 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; | 194 | noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; |
191 | quality = ( quality*100 ) / 92; | 195 | quality = ( quality*100 ) / 92; |
192 | return true; | 196 | return true; |
193 | } | 197 | } |
194 | } | 198 | } |
195 | 199 | ||
196 | odebug << "WExtensions::statsCard no longer present." << oendl; | 200 | odebug << "WExtensions::statsCard no longer present." << oendl; |
197 | quality = -1; | 201 | quality = -1; |
198 | signal = IW_LOWER; | 202 | signal = IW_LOWER; |
199 | noise = IW_LOWER; | 203 | noise = IW_LOWER; |
200 | return false; | 204 | return false; |
201 | } | 205 | } |
202 | 206 | ||
203 | // wextensions.cpp | 207 | // wextensions.cpp |
diff --git a/noncore/settings/networksettings2/ppp/config.in b/noncore/settings/networksettings2/ppp/config.in index 9e3cd35..c722a10 100644 --- a/noncore/settings/networksettings2/ppp/config.in +++ b/noncore/settings/networksettings2/ppp/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2PPP | 1 | config NS2PPP |
2 | boolean "opie-networksettings2plugin-ppp (set up PPP)" | 2 | boolean "opie-networksettings2plugin-ppp (set up PPP)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/profile/config.in b/noncore/settings/networksettings2/profile/config.in index c5f2075..f99ef99 100644 --- a/noncore/settings/networksettings2/profile/config.in +++ b/noncore/settings/networksettings2/profile/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2PROFILE | 1 | config NS2PROFILE |
2 | boolean "opie-networksettings2plugin-profiles (User profiles)" | 2 | boolean "opie-networksettings2plugin-profiles (User profiles)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/usb/config.in b/noncore/settings/networksettings2/usb/config.in index 136806d..d0c6cba 100644 --- a/noncore/settings/networksettings2/usb/config.in +++ b/noncore/settings/networksettings2/usb/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2USB | 1 | config NS2USB |
2 | boolean "opie-networksettings2plugin-usb (set up USB)" | 2 | boolean "opie-networksettings2plugin-usb (set up USB)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/vpn/config.in b/noncore/settings/networksettings2/vpn/config.in index fff52c3..0d2cb3a 100644 --- a/noncore/settings/networksettings2/vpn/config.in +++ b/noncore/settings/networksettings2/vpn/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2VPN | 1 | config NS2VPN |
2 | boolean "opie-networksettings2plugin-vpn (set up VPN)" | 2 | boolean "opie-networksettings2plugin-vpn (set up VPN)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |
diff --git a/noncore/settings/networksettings2/wlan/config.in b/noncore/settings/networksettings2/wlan/config.in index 328287b..13ef9da 100644 --- a/noncore/settings/networksettings2/wlan/config.in +++ b/noncore/settings/networksettings2/wlan/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config NS2WLAN | 1 | config NS2WLAN |
2 | boolean "opie-networksettings2plugin-wlan (set up Wireless LAN)" | 2 | boolean "opie-networksettings2plugin-wlan (set up Wireless LAN)" |
3 | default "n" if NS2 | 3 | default "n" if NS2MAIN |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2 && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2MAIN && NS2CORE |