Diffstat (limited to 'noncore/settings/networksettings2/lancard') (more/less context) (ignore whitespace changes)
6 files changed, 44 insertions, 7 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index a45496d..7d36918 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp @@ -43,6 +43,6 @@ bool LanCardNetNode::generateProperFilesFor( } -bool LanCardNetNode::hasDataFor( const QString & ) { - return 0; +bool LanCardNetNode::hasDataFor( const QString & S, bool DS ) { + return DS && S == "interfaces"; } @@ -54,4 +54,11 @@ bool LanCardNetNode::generateDataForCommonFile( } +bool LanCardNetNode::generateDeviceDataForCommonFile( + SystemFile & S , + long DevNr , + ANetNodeInstance * NNI ) { + return ((ALanCard *)NNI)->generateDeviceDataForCommonFile(S, DevNr); +} + extern "C" { void create_plugin( QList<ANetNode> & PNN ) { diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index 71b49d0..9690c76 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h @@ -29,7 +29,9 @@ public: virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); - virtual bool hasDataFor( const QString & S ); + virtual bool hasDataFor( const QString & S, bool DS ); virtual bool generateDataForCommonFile( SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); + virtual bool generateDeviceDataForCommonFile( + SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); private: diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp index 9595e2e..a6401db 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp @@ -43,2 +43,16 @@ void ALanCard::commit( void ) { setModified( 1 ); } + +bool ALanCard::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { + AsDevice * Dev = runtime()->device(); + QString NIC = Dev->genNic( DevNr ); + + if( S.name() == "interfaces" ) { + // generate mapping stanza for this interface + S << "# check if " << NIC << " can be brought UP" << endl; + S << "mapping " << NIC << endl; + S << " script networksettings2-request" << endl << endl; + } + return 0; +} + diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.h b/noncore/settings/networksettings2/lancard/lancard_NNI.h index 8fc8868..16f5f56 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NNI.h +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.h @@ -28,4 +28,6 @@ public : { return (void *)&Data; } + bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr ); + protected : diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index b3b592b..951756d 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp @@ -37,5 +37,14 @@ void LanCardRun::detectState( NodeCollection * NC ) { } - // we are certainly not UP + 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 ); @@ -88,6 +97,5 @@ bool LanCardRun::setState( NodeCollection * NC, Action_t A ) { // could not ... return 0; - } - if( NC->currentState() != Available ) { + } else if( NC->currentState() != Available ) { return 1; } diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h index 5f004e0..8dbd1b1 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.h +++ b/noncore/settings/networksettings2/lancard/lancardrun.h @@ -19,6 +19,10 @@ public : virtual QString genNic( long nr ) { QString S; return S.sprintf( "eth%ld", nr ); } + virtual AsDevice * device( void ) - { return asDevice(); } + { return (AsDevice *)this; } + + virtual AsDevice * asDevice( void ) + { return (AsDevice *)this; } protected : |