author | wimpie <wimpie> | 2005-01-10 16:38:47 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-10 16:38:47 (UTC) |
commit | dd649f98d0010711ed3d0fac433bd9fafa4002db (patch) (side-by-side diff) | |
tree | 7a1f19cf6cf3e64bed58100f19d8427909fc44f2 | |
parent | f7b2f19ecbe3ae9151c1f9dc238bcfd019b3fdbe (diff) | |
download | opie-dd649f98d0010711ed3d0fac433bd9fafa4002db.zip opie-dd649f98d0010711ed3d0fac433bd9fafa4002db.tar.gz opie-dd649f98d0010711ed3d0fac433bd9fafa4002db.tar.bz2 |
Do not assume device is Up based on existance of profile-xx file only
-rw-r--r-- | noncore/settings/networksettings2/lancard/lancardrun.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlanrun.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index 470b797..8157dce 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp @@ -10,49 +10,49 @@ State_t LanCardRun::detectState( void ) { // available : card found and assigned to us or free // up : card found and assigned to us and up NodeCollection * NC = nodeCollection(); QString S = QString( "/tmp/profile-%1.up" ). arg( NC->number()); System & Sys = NSResources->system(); InterfaceInfo * Run; QFile F( S ); if( F.open( IO_ReadOnly ) ) { // could open file -> read interface and assign QString X; QTextStream TS(&F); X = TS.readLine(); // find interface if( handlesInterface( X ) ) { for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); if( X == Run->Name ) { NC->assignInterface( Run ); - return IsUp; + return (Run->IsUp) ? IsUp : Available; } } } } if( ( Run = NC->assignedInterface() ) ) { // we already have an interface assigned -> still present ? if( ! Run->IsUp ) { // usb is still free -> keep assignment return Available; } // else interface is up but NOT us -> some other profile } // nothing (valid) assigned to us NC->assignInterface( 0 ); // find possible interface for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); if( handlesInterface( *Run ) && ( Run->CardType == ARPHRD_ETHER #ifdef ARPHRD_IEEE1394 diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index de8c8a2..763644e 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp @@ -10,49 +10,49 @@ State_t USBRun::detectState( void ) { // available : card found and assigned to us or free // up : card found and assigned to us and up NodeCollection * NC = nodeCollection(); QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); System & Sys = NSResources->system(); InterfaceInfo * Run; QFile F( S ); Log(("Detecting for %s\n", NC->name().latin1() )); if( F.open( IO_ReadOnly ) ) { // could open file -> read interface and assign QString X; QTextStream TS(&F); X = TS.readLine(); Log(("%s exists\n", S.latin1() )); // find interface if( handlesInterface( X ) ) { for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); if( X == Run->Name ) { NC->assignInterface( Run ); - return IsUp; + return (Run->IsUp) ? IsUp : Available; } } } } Log(("Assigned %p\n", NC->assignedInterface() )); if( ( Run = NC->assignedInterface() ) ) { // we already have an interface assigned -> still present ? if( ! Run->IsUp ) { // usb is still free -> keep assignment return Available; } // else interface is up but NOT us -> some other profile } // nothing (valid) assigned to us NC->assignInterface( 0 ); // find possible interface if( getInterface() ) { // proper type, and Not UP -> free // usb cables are currently always available when requested // until we can detect if we are plugged in return Available; diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp index fe49c4e..b15a560 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.cpp +++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp @@ -10,49 +10,49 @@ State_t WLanRun::detectState( void ) { // unavailable : no card found // available : card found and assigned to us or free // up : card found and assigned to us and up NodeCollection * NC = nodeCollection(); QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); System & Sys = NSResources->system(); InterfaceInfo * Run; QFile F( S ); if( F.open( IO_ReadOnly ) ) { // could open file -> read interface and assign QString X; QTextStream TS(&F); X = TS.readLine(); // find interface if( handlesInterface( X ) ) { for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); if( X == Run->Name ) { NC->assignInterface( Run ); - return IsUp; + return (Run->IsUp) ? IsUp : Available; } } } } if( ( Run = NC->assignedInterface() ) ) { // we already have an interface assigned -> still present ? if( ! Run->IsUp ) { // usb is still free -> keep assignment return Available; } // else interface is up but NOT us -> some other profile } // nothing (valid) assigned to us NC->assignInterface( 0 ); // find possible interface for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); if( handlesInterface( *Run ) && ( Run->CardType == ARPHRD_ETHER #ifdef ARPHRD_IEEE1394 |