summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb/usbrun.cpp
authorwimpie <wimpie>2004-08-09 02:31:25 (UTC)
committer wimpie <wimpie>2004-08-09 02:31:25 (UTC)
commit0784cfdbd261c43856b45be6ab7439841e69b858 (patch) (unidiff)
treef6a27d6b2e1e6d8dcc908b2ef5836cd320ddfab1 /noncore/settings/networksettings2/usb/usbrun.cpp
parent5e10278e748608766245ff9f59a54d1ae8ff6f7e (diff)
downloadopie-0784cfdbd261c43856b45be6ab7439841e69b858.zip
opie-0784cfdbd261c43856b45be6ab7439841e69b858.tar.gz
opie-0784cfdbd261c43856b45be6ab7439841e69b858.tar.bz2
Many changes :
bluetooth and usb seems to work added preliminary support for VPN on top of any network This version is still very much crippled yet is does DO some things
Diffstat (limited to 'noncore/settings/networksettings2/usb/usbrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp
index beacd7b..b8ac8a8 100644
--- a/noncore/settings/networksettings2/usb/usbrun.cpp
+++ b/noncore/settings/networksettings2/usb/usbrun.cpp
@@ -9,18 +9,20 @@ void USBRun::detectState( NodeCollection * NC ) {
9 // available : card found and assigned to us or free 9 // available : card found and assigned to us or free
10 // up : card found and assigned to us and up 10 // up : card found and assigned to us and up
11 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); 11 QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
12 System & Sys = NSResources->system(); 12 System & Sys = NSResources->system();
13 InterfaceInfo * Run; 13 InterfaceInfo * Run;
14 QFile F( S ); 14 QFile F( S );
15 Log(("Detecting for %s\n", NC->name().latin1() ));
15 16
16 if( F.open( IO_ReadOnly ) ) { 17 if( F.open( IO_ReadOnly ) ) {
17 // could open file -> read interface and assign 18 // could open file -> read interface and assign
18 QString X; 19 QString X;
19 QTextStream TS(&F); 20 QTextStream TS(&F);
20 X = TS.readLine(); 21 X = TS.readLine();
22 Log(("%s exists\n", S.latin1() ));
21 // find interface 23 // find interface
22 if( handlesInterface( X ) ) { 24 if( handlesInterface( X ) ) {
23 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 25 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
24 It.current(); 26 It.current();
25 ++It ) { 27 ++It ) {
26 Run = It.current(); 28 Run = It.current();
@@ -31,13 +33,13 @@ void USBRun::detectState( NodeCollection * NC ) {
31 return; 33 return;
32 } 34 }
33 } 35 }
34 } 36 }
35 } 37 }
36 38
37 fprintf( stderr, "Assigned %p\n", assignedInterface() ); 39 Log(("Assigned %p\n", assignedInterface() ));
38 if( ( Run = assignedInterface() ) ) { 40 if( ( Run = assignedInterface() ) ) {
39 // we already have an interface assigned -> still present ? 41 // we already have an interface assigned -> still present ?
40 if( ! Run->IsUp ) { 42 if( ! Run->IsUp ) {
41 // usb is still free -> keep assignment 43 // usb is still free -> keep assignment
42 NC->setCurrentState( Available ); 44 NC->setCurrentState( Available );
43 return; 45 return;
@@ -50,30 +52,30 @@ void USBRun::detectState( NodeCollection * NC ) {
50 // find possible interface 52 // find possible interface
51 for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); 53 for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
52 It.current(); 54 It.current();
53 ++It ) { 55 ++It ) {
54 Run = It.current(); 56 Run = It.current();
55 57
56 fprintf( stderr, "%s %d %d=%d %d\n", 58 Log(("%s %d %d=%d %d\n",
57 Run->Name.latin1(), 59 Run->Name.latin1(),
58 handlesInterface( Run->Name ), 60 handlesInterface( Run->Name ),
59 Run->CardType, ARPHRD_ETHER, 61 Run->CardType, ARPHRD_ETHER,
60 ! Run->IsUp ); 62 ! Run->IsUp ));
61 63
62 if( handlesInterface( Run->Name ) && 64 if( handlesInterface( Run->Name ) &&
63 Run->CardType == ARPHRD_ETHER && 65 Run->CardType == ARPHRD_ETHER &&
64 ! Run->IsUp 66 ! Run->IsUp
65 ) { 67 ) {
66 fprintf( stderr, "Released(OFF)\n" ); 68 Log(("Released(OFF)\n" ));
67 // proper type, and Not UP -> free 69 // proper type, and Not UP -> free
68 NC->setCurrentState( Off ); 70 NC->setCurrentState( Off );
69 return; 71 return;
70 } 72 }
71 } 73 }
72 // no free found 74 // no free found
73 fprintf( stderr, "UNA\n" ); 75 Log(("UNA\n" ));
74 76
75 NC->setCurrentState( Unavailable ); 77 NC->setCurrentState( Unavailable );
76} 78}
77 79
78bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) { 80bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) {
79 81
@@ -91,13 +93,13 @@ bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) {
91 return 0; 93 return 0;
92 } 94 }
93 // because we were OFF the interface 95 // because we were OFF the interface
94 // we get back is NOT assigned 96 // we get back is NOT assigned
95 N->assignNode( netNode() ); 97 N->assignNode( netNode() );
96 assignInterface( N ); 98 assignInterface( N );
97 fprintf( stderr, "Assing %p\n", N ); 99 Log(("Assing %p\n", N ));
98 NC->setCurrentState( Available ); 100 NC->setCurrentState( Available );
99 return 1; 101 return 1;
100 } 102 }
101 case Deactivate : 103 case Deactivate :
102 if( NC->currentState() == IsUp ) { 104 if( NC->currentState() == IsUp ) {
103 // bring down first 105 // bring down first