author | wimpie <wimpie> | 2005-01-09 00:32:10 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-09 00:32:10 (UTC) |
commit | e54346d28b19d3ac671802a25e8c03f346693291 (patch) (unidiff) | |
tree | 0f8d6561e24a7ba36fd8a6ab1869aa470e1fdb36 /noncore/settings/networksettings2/usb/usbrun.cpp | |
parent | 60a617583d0ccc793d9ea4465998d90ec208db58 (diff) | |
download | opie-e54346d28b19d3ac671802a25e8c03f346693291.zip opie-e54346d28b19d3ac671802a25e8c03f346693291.tar.gz opie-e54346d28b19d3ac671802a25e8c03f346693291.tar.bz2 |
Updated dependencies
NS2->app requires OT2Lib and NS2Lib
OT2Lib requires NS2Lib
Most plugins only require NS2Lib
Except
BTPlugin which requires als OT2Lib
Also renamed owarn -> odebug
Diffstat (limited to 'noncore/settings/networksettings2/usb/usbrun.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index eb439c1..de8c8a2 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -39,4 +39,5 @@ State_t USBRun::detectState( void ) { | |||
39 | 39 | ||
40 | Log(("Assigned %p\n", NC->assignedInterface() )); | 40 | Log(("Assigned %p\n", NC->assignedInterface() )); |
41 | |||
41 | if( ( Run = NC->assignedInterface() ) ) { | 42 | if( ( Run = NC->assignedInterface() ) ) { |
42 | // we already have an interface assigned -> still present ? | 43 | // we already have an interface assigned -> still present ? |
@@ -51,19 +52,5 @@ State_t USBRun::detectState( void ) { | |||
51 | 52 | ||
52 | // find possible interface | 53 | // find possible interface |
53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 54 | if( getInterface() ) { |
54 | It.current(); | ||
55 | ++It ) { | ||
56 | Run = It.current(); | ||
57 | |||
58 | Log(("%s %d %d=%d %d\n", | ||
59 | Run->Name.latin1(), | ||
60 | handlesInterface( Run->Name ), | ||
61 | Run->CardType, ARPHRD_ETHER, | ||
62 | ! Run->IsUp )); | ||
63 | |||
64 | if( handlesInterface( Run->Name ) && | ||
65 | Run->CardType == ARPHRD_ETHER && | ||
66 | ! Run->IsUp | ||
67 | ) { | ||
68 | // proper type, and Not UP -> free | 55 | // proper type, and Not UP -> free |
69 | // usb cables are currently always available when requested | 56 | // usb cables are currently always available when requested |
@@ -71,5 +58,4 @@ State_t USBRun::detectState( void ) { | |||
71 | return Available; | 58 | return Available; |
72 | } | 59 | } |
73 | } | ||
74 | 60 | ||
75 | return Unavailable; | 61 | return Unavailable; |
@@ -78,6 +64,14 @@ State_t USBRun::detectState( void ) { | |||
78 | QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 64 | QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
79 | 65 | ||
80 | // nothing needs to be done to 'activate' or 'deactivate' | 66 | InterfaceInfo * I = getInterface(); |
81 | // a cable | 67 | |
68 | if( ! I ) { | ||
69 | return QString("No usb device available"); | ||
70 | } | ||
71 | |||
72 | Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); | ||
73 | // grab this interface | ||
74 | NC->assignInterface( I ); | ||
75 | |||
82 | return QString(); | 76 | return QString(); |
83 | } | 77 | } |
@@ -88,5 +82,4 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
88 | System & S = NSResources->system(); | 82 | System & S = NSResources->system(); |
89 | InterfaceInfo * best = 0, * Run; | 83 | InterfaceInfo * best = 0, * Run; |
90 | QRegExp R( "usb[0-9abcdef]" ); | ||
91 | 84 | ||
92 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 85 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
@@ -94,4 +87,11 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
94 | ++It ) { | 87 | ++It ) { |
95 | Run = It.current(); | 88 | Run = It.current(); |
89 | |||
90 | Log(("%s %d %d=%d %d\n", | ||
91 | Run->Name.latin1(), | ||
92 | handlesInterface( Run->Name ), | ||
93 | Run->CardType, ARPHRD_ETHER, | ||
94 | ! Run->IsUp )); | ||
95 | |||
96 | if( handlesInterface( Run->Name ) && | 96 | if( handlesInterface( Run->Name ) && |
97 | Run->CardType == ARPHRD_ETHER | 97 | Run->CardType == ARPHRD_ETHER |
@@ -101,8 +101,9 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
101 | // assigned to us | 101 | // assigned to us |
102 | return Run; | 102 | return Run; |
103 | } else if( Run->assignedConnection() == 0 ) { | 103 | } else if( ! Run->IsUp && |
104 | Run->assignedConnection() == 0 ) { | ||
104 | // free | 105 | // free |
105 | best = Run; | 106 | best = Run; |
106 | } | 107 | } // UP or not assigned to us |
107 | } | 108 | } |
108 | } | 109 | } |