author | wimpie <wimpie> | 2005-01-09 00:32:10 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-09 00:32:10 (UTC) |
commit | e54346d28b19d3ac671802a25e8c03f346693291 (patch) (side-by-side diff) | |
tree | 0f8d6561e24a7ba36fd8a6ab1869aa470e1fdb36 /noncore/settings/networksettings2/usb | |
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') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 51 |
1 files changed, 26 insertions, 25 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 @@ -37,8 +37,9 @@ State_t USBRun::detectState( void ) { } } 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 @@ -49,62 +50,62 @@ State_t USBRun::detectState( void ) { // nothing (valid) assigned to us NC->assignInterface( 0 ); // find possible interface - for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); - It.current(); - ++It ) { - Run = It.current(); - - Log(("%s %d %d=%d %d\n", - Run->Name.latin1(), - handlesInterface( Run->Name ), - Run->CardType, ARPHRD_ETHER, - ! Run->IsUp )); - - if( handlesInterface( Run->Name ) && - Run->CardType == ARPHRD_ETHER && - ! Run->IsUp - ) { - // 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; - } + 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; } return Unavailable; } QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { - // nothing needs to be done to 'activate' or 'deactivate' - // a cable + InterfaceInfo * I = getInterface(); + + if( ! I ) { + return QString("No usb device available"); + } + + Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); + // grab this interface + NC->assignInterface( I ); + return QString(); } // get interface that is free or assigned to us InterfaceInfo * USBRun::getInterface( void ) { System & S = NSResources->system(); InterfaceInfo * best = 0, * Run; - QRegExp R( "usb[0-9abcdef]" ); for( QDictIterator<InterfaceInfo> It(S.interfaces()); It.current(); ++It ) { Run = It.current(); + + Log(("%s %d %d=%d %d\n", + Run->Name.latin1(), + handlesInterface( Run->Name ), + Run->CardType, ARPHRD_ETHER, + ! Run->IsUp )); + if( handlesInterface( Run->Name ) && Run->CardType == ARPHRD_ETHER ) { // this is a USB card if( Run->assignedConnection() == netNode()->connection() ) { // assigned to us return Run; - } else if( Run->assignedConnection() == 0 ) { + } else if( ! Run->IsUp && + Run->assignedConnection() == 0 ) { // free best = Run; - } + } // UP or not assigned to us } } return best; // can be 0 } |