author | mickeyl <mickeyl> | 2002-10-12 15:37:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-10-12 15:37:56 (UTC) |
commit | 83aed438ec060307bf5562d91bd8b61fe60f860b (patch) (unidiff) | |
tree | b5156e2be374491e0dbf587b48272c1ae121660d | |
parent | fe2f3c3b72dfcffe0b6ab02cea37f6dcb300b218 (diff) | |
download | opie-83aed438ec060307bf5562d91bd8b61fe60f860b.zip opie-83aed438ec060307bf5562d91bd8b61fe60f860b.tar.gz opie-83aed438ec060307bf5562d91bd8b61fe60f860b.tar.bz2 |
- dhcp renew now really functions
- added dhcp renew support for udhcp
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 649cf20..fb9522a 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -43,25 +43,25 @@ | |||
43 | 43 | ||
44 | #include "connect0.xpm" | 44 | #include "connect0.xpm" |
45 | #include "connect1.xpm" | 45 | #include "connect1.xpm" |
46 | #include "connect2.xpm" | 46 | #include "connect2.xpm" |
47 | #include "connect3.xpm" | 47 | #include "connect3.xpm" |
48 | #include "connect4.xpm" | 48 | #include "connect4.xpm" |
49 | #include "connect5.xpm" | 49 | #include "connect5.xpm" |
50 | #include "nowireless.xpm" | 50 | #include "nowireless.xpm" |
51 | 51 | ||
52 | #define STYLE_BARS 0 | 52 | #define STYLE_BARS 0 |
53 | #define STYLE_ANTENNA 1 | 53 | #define STYLE_ANTENNA 1 |
54 | 54 | ||
55 | //#define MDEBUG 0 | 55 | //#define MDEBUG |
56 | #undef MDEBUG | 56 | #undef MDEBUG |
57 | 57 | ||
58 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) | 58 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) |
59 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) | 59 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) |
60 | { | 60 | { |
61 | 61 | ||
62 | readConfig(); | 62 | readConfig(); |
63 | writeConfigEntry( "UpdateFrequency", updateFrequency ); | 63 | writeConfigEntry( "UpdateFrequency", updateFrequency ); |
64 | writeConfigEntry( "DisplayStyle", displayStyle ); | 64 | writeConfigEntry( "DisplayStyle", displayStyle ); |
65 | 65 | ||
66 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 66 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
67 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); | 67 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); |
@@ -237,39 +237,65 @@ void WirelessApplet::checkInterface() | |||
237 | } | 237 | } |
238 | 238 | ||
239 | void WirelessApplet::renewDHCP() | 239 | void WirelessApplet::renewDHCP() |
240 | { | 240 | { |
241 | #ifdef MDEBUG | 241 | #ifdef MDEBUG |
242 | qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); | 242 | qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); |
243 | #endif | 243 | #endif |
244 | 244 | ||
245 | QString pidfile; | 245 | QString pidfile; |
246 | if ( !interface ) | 246 | if ( !interface ) |
247 | return; | 247 | return; |
248 | QString ifacename( interface->getName() ); | 248 | QString ifacename( interface->getName() ); |
249 | |||
250 | // At first we are trying dhcpcd | ||
251 | |||
249 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); | 252 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); |
250 | #ifdef MDEBUG | 253 | #ifdef MDEBUG |
251 | qDebug( "WIFIAPPLET: pidfile is '%s'", (const char*) pidfile ); | 254 | qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", (const char*) pidfile ); |
252 | #endif | 255 | #endif |
253 | int pid; | 256 | int pid; |
254 | QFile pfile( pidfile ); | 257 | QFile pfile( pidfile ); |
255 | bool hasFile = pfile.open( IO_ReadOnly ); | 258 | bool hasFile = pfile.open( IO_ReadOnly ); |
256 | QTextStream s( &pfile ); | 259 | QTextStream s( &pfile ); |
257 | if ( hasFile ) | 260 | if ( hasFile ) |
261 | { | ||
258 | s >> pid; | 262 | s >> pid; |
259 | #ifdef MDEBUG | 263 | #ifdef MDEBUG |
260 | qDebug( "WIFIAPPLET: sent -14 to pid %d", pid ); | 264 | qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); |
261 | #endif | 265 | #endif |
262 | kill( pid, -14 ); | 266 | kill( pid, SIGALRM ); |
267 | return; | ||
268 | } | ||
263 | 269 | ||
270 | // No dhcpcd, so we are trying udhcpc | ||
271 | #ifdef MDEBUG | ||
272 | qDebug( "WIFIAPPLET: dhcpcd not available." ); | ||
273 | #endif | ||
274 | pidfile.sprintf( "/var/run/udhcpc.%s.pid", (const char*) ifacename ); | ||
275 | #ifdef MDEBUG | ||
276 | qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", (const char*) pidfile ); | ||
277 | #endif | ||
278 | QFile pfile2( pidfile ); | ||
279 | hasFile = pfile2.open( IO_ReadOnly ); | ||
280 | QTextStream s2( &pfile2 ); | ||
281 | if ( hasFile ) | ||
282 | { | ||
283 | s2 >> pid; | ||
284 | #ifdef MDEBUG | ||
285 | qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid ); | ||
286 | #endif | ||
287 | kill( pid, SIGUSR1 ); | ||
288 | return; | ||
289 | } | ||
264 | } | 290 | } |
265 | 291 | ||
266 | void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) | 292 | void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) |
267 | { | 293 | { |
268 | rocESSID = ESSID; | 294 | rocESSID = ESSID; |
269 | rocFREQ = FREQ; | 295 | rocFREQ = FREQ; |
270 | rocAP = AP; | 296 | rocAP = AP; |
271 | rocMODE = MODE; | 297 | rocMODE = MODE; |
272 | } | 298 | } |
273 | 299 | ||
274 | void WirelessApplet::updateDelayChange( int delay ) | 300 | void WirelessApplet::updateDelayChange( int delay ) |
275 | { | 301 | { |