summaryrefslogtreecommitdiff
path: root/noncore
authorwimpie <wimpie>2005-01-10 16:38:47 (UTC)
committer wimpie <wimpie>2005-01-10 16:38:47 (UTC)
commitdd649f98d0010711ed3d0fac433bd9fafa4002db (patch) (unidiff)
tree7a1f19cf6cf3e64bed58100f19d8427909fc44f2 /noncore
parentf7b2f19ecbe3ae9151c1f9dc238bcfd019b3fdbe (diff)
downloadopie-dd649f98d0010711ed3d0fac433bd9fafa4002db.zip
opie-dd649f98d0010711ed3d0fac433bd9fafa4002db.tar.gz
opie-dd649f98d0010711ed3d0fac433bd9fafa4002db.tar.bz2
Do not assume device is Up based on existance of profile-xx file only
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.cpp2
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp2
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.cpp2
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 ) {
10 // available : card found and assigned to us or free 10 // available : card found and assigned to us or free
11 // up : card found and assigned to us and up 11 // up : card found and assigned to us and up
12 12
13 NodeCollection * NC = nodeCollection(); 13 NodeCollection * NC = nodeCollection();
14 QString S = QString( "/tmp/profile-%1.up" ). 14 QString S = QString( "/tmp/profile-%1.up" ).
15 arg( NC->number()); 15 arg( NC->number());
16 System & Sys = NSResources->system(); 16 System & Sys = NSResources->system();
17 InterfaceInfo * Run; 17 InterfaceInfo * Run;
18 18
19 QFile F( S ); 19 QFile F( S );
20 20
21 if( F.open( IO_ReadOnly ) ) { 21 if( F.open( IO_ReadOnly ) ) {
22 // could open file -> read interface and assign 22 // could open file -> read interface and assign
23 QString X; 23 QString X;
24 QTextStream TS(&F); 24 QTextStream TS(&F);
25 X = TS.readLine(); 25 X = TS.readLine();
26 // find interface 26 // find interface
27 if( handlesInterface( X ) ) { 27 if( handlesInterface( X ) ) {
28 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 28 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
29 It.current(); 29 It.current();
30 ++It ) { 30 ++It ) {
31 Run = It.current(); 31 Run = It.current();
32 if( X == Run->Name ) { 32 if( X == Run->Name ) {
33 NC->assignInterface( Run ); 33 NC->assignInterface( Run );
34 return IsUp; 34 return (Run->IsUp) ? IsUp : Available;
35 } 35 }
36 } 36 }
37 } 37 }
38 } 38 }
39 39
40 if( ( Run = NC->assignedInterface() ) ) { 40 if( ( Run = NC->assignedInterface() ) ) {
41 // we already have an interface assigned -> still present ? 41 // we already have an interface assigned -> still present ?
42 if( ! Run->IsUp ) { 42 if( ! Run->IsUp ) {
43 // usb is still free -> keep assignment 43 // usb is still free -> keep assignment
44 return Available; 44 return Available;
45 } // else interface is up but NOT us -> some other profile 45 } // else interface is up but NOT us -> some other profile
46 } 46 }
47 47
48 // nothing (valid) assigned to us 48 // nothing (valid) assigned to us
49 NC->assignInterface( 0 ); 49 NC->assignInterface( 0 );
50 50
51 // find possible interface 51 // find possible interface
52 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 52 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
53 It.current(); 53 It.current();
54 ++It ) { 54 ++It ) {
55 Run = It.current(); 55 Run = It.current();
56 if( handlesInterface( *Run ) && 56 if( handlesInterface( *Run ) &&
57 ( Run->CardType == ARPHRD_ETHER 57 ( Run->CardType == ARPHRD_ETHER
58#ifdef ARPHRD_IEEE1394 58#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 ) {
10 // available : card found and assigned to us or free 10 // available : card found and assigned to us or free
11 // up : card found and assigned to us and up 11 // up : card found and assigned to us and up
12 12
13 NodeCollection * NC = nodeCollection(); 13 NodeCollection * NC = nodeCollection();
14 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 14 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
15 System & Sys = NSResources->system(); 15 System & Sys = NSResources->system();
16 InterfaceInfo * Run; 16 InterfaceInfo * Run;
17 QFile F( S ); 17 QFile F( S );
18 Log(("Detecting for %s\n", NC->name().latin1() )); 18 Log(("Detecting for %s\n", NC->name().latin1() ));
19 19
20 if( F.open( IO_ReadOnly ) ) { 20 if( F.open( IO_ReadOnly ) ) {
21 // could open file -> read interface and assign 21 // could open file -> read interface and assign
22 QString X; 22 QString X;
23 QTextStream TS(&F); 23 QTextStream TS(&F);
24 X = TS.readLine(); 24 X = TS.readLine();
25 Log(("%s exists\n", S.latin1() )); 25 Log(("%s exists\n", S.latin1() ));
26 // find interface 26 // find interface
27 if( handlesInterface( X ) ) { 27 if( handlesInterface( X ) ) {
28 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 28 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
29 It.current(); 29 It.current();
30 ++It ) { 30 ++It ) {
31 Run = It.current(); 31 Run = It.current();
32 if( X == Run->Name ) { 32 if( X == Run->Name ) {
33 NC->assignInterface( Run ); 33 NC->assignInterface( Run );
34 return IsUp; 34 return (Run->IsUp) ? IsUp : Available;
35 } 35 }
36 } 36 }
37 } 37 }
38 } 38 }
39 39
40 Log(("Assigned %p\n", NC->assignedInterface() )); 40 Log(("Assigned %p\n", NC->assignedInterface() ));
41 41
42 if( ( Run = NC->assignedInterface() ) ) { 42 if( ( Run = NC->assignedInterface() ) ) {
43 // we already have an interface assigned -> still present ? 43 // we already have an interface assigned -> still present ?
44 if( ! Run->IsUp ) { 44 if( ! Run->IsUp ) {
45 // usb is still free -> keep assignment 45 // usb is still free -> keep assignment
46 return Available; 46 return Available;
47 } // else interface is up but NOT us -> some other profile 47 } // else interface is up but NOT us -> some other profile
48 } 48 }
49 49
50 // nothing (valid) assigned to us 50 // nothing (valid) assigned to us
51 NC->assignInterface( 0 ); 51 NC->assignInterface( 0 );
52 52
53 // find possible interface 53 // find possible interface
54 if( getInterface() ) { 54 if( getInterface() ) {
55 // proper type, and Not UP -> free 55 // proper type, and Not UP -> free
56 // usb cables are currently always available when requested 56 // usb cables are currently always available when requested
57 // until we can detect if we are plugged in 57 // until we can detect if we are plugged in
58 return Available; 58 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 ) {
10 // unavailable : no card found 10 // unavailable : no card found
11 // available : card found and assigned to us or free 11 // available : card found and assigned to us or free
12 // up : card found and assigned to us and up 12 // up : card found and assigned to us and up
13 13
14 NodeCollection * NC = nodeCollection(); 14 NodeCollection * NC = nodeCollection();
15 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 15 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
16 System & Sys = NSResources->system(); 16 System & Sys = NSResources->system();
17 InterfaceInfo * Run; 17 InterfaceInfo * Run;
18 18
19 QFile F( S ); 19 QFile F( S );
20 20
21 if( F.open( IO_ReadOnly ) ) { 21 if( F.open( IO_ReadOnly ) ) {
22 // could open file -> read interface and assign 22 // could open file -> read interface and assign
23 QString X; 23 QString X;
24 QTextStream TS(&F); 24 QTextStream TS(&F);
25 X = TS.readLine(); 25 X = TS.readLine();
26 // find interface 26 // find interface
27 if( handlesInterface( X ) ) { 27 if( handlesInterface( X ) ) {
28 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 28 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
29 It.current(); 29 It.current();
30 ++It ) { 30 ++It ) {
31 Run = It.current(); 31 Run = It.current();
32 if( X == Run->Name ) { 32 if( X == Run->Name ) {
33 NC->assignInterface( Run ); 33 NC->assignInterface( Run );
34 return IsUp; 34 return (Run->IsUp) ? IsUp : Available;
35 } 35 }
36 } 36 }
37 } 37 }
38 } 38 }
39 39
40 if( ( Run = NC->assignedInterface() ) ) { 40 if( ( Run = NC->assignedInterface() ) ) {
41 // we already have an interface assigned -> still present ? 41 // we already have an interface assigned -> still present ?
42 if( ! Run->IsUp ) { 42 if( ! Run->IsUp ) {
43 // usb is still free -> keep assignment 43 // usb is still free -> keep assignment
44 return Available; 44 return Available;
45 } // else interface is up but NOT us -> some other profile 45 } // else interface is up but NOT us -> some other profile
46 } 46 }
47 47
48 // nothing (valid) assigned to us 48 // nothing (valid) assigned to us
49 NC->assignInterface( 0 ); 49 NC->assignInterface( 0 );
50 50
51 // find possible interface 51 // find possible interface
52 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 52 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
53 It.current(); 53 It.current();
54 ++It ) { 54 ++It ) {
55 Run = It.current(); 55 Run = It.current();
56 if( handlesInterface( *Run ) && 56 if( handlesInterface( *Run ) &&
57 ( Run->CardType == ARPHRD_ETHER 57 ( Run->CardType == ARPHRD_ETHER
58#ifdef ARPHRD_IEEE1394 58#ifdef ARPHRD_IEEE1394