Diffstat (limited to 'noncore/settings/networksettings2/usb/usbrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 49b5a77..3007e79 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp @@ -36,4 +36,13 @@ void USBRun::detectState( NodeCollection * NC ) { - fprintf( stderr, "NUP\n" ); - // definitively not up + fprintf( stderr, "Assigned %p\n", assignedInterface() ); + if( ( Run = assignedInterface() ) ) { + // we already have an interface assigned -> still present ? + if( ! Run->IsUp ) { + // usb is still free -> keep assignment + NC->setCurrentState( Available ); + return; + } // else interface is up but NOT us -> some other profile + } + + // nothing (valid) assigned to us assignInterface( 0 ); @@ -45,7 +54,9 @@ void USBRun::detectState( NodeCollection * NC ) { Run = It.current(); + fprintf( stderr, "%s %d %d=%d %d\n", - Run->Name.latin1(), - handlesInterface( Run->Name ), - Run->CardType, ARPHRD_ETHER, - ! Run->IsUp ); + Run->Name.latin1(), + handlesInterface( Run->Name ), + Run->CardType, ARPHRD_ETHER, + ! Run->IsUp ); + if( handlesInterface( Run->Name ) && @@ -54,3 +65,3 @@ void USBRun::detectState( NodeCollection * NC ) { ) { - fprintf( stderr, "OFF\n" ); + fprintf( stderr, "Released(OFF)\n" ); // proper type, and Not UP -> free @@ -85,2 +96,3 @@ bool USBRun::setState( NodeCollection * NC, Action_t A ) { assignInterface( N ); + fprintf( stderr, "Assing %p\n", N ); NC->setCurrentState( Available ); @@ -94,4 +106,3 @@ bool USBRun::setState( NodeCollection * NC, Action_t A ) { return 0; - } - if( NC->currentState() != Available ) { + } else if( NC->currentState() != Available ) { return 1; |