Diffstat (limited to 'noncore/settings/networksettings2/usb') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/usb/usb_NN.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index 6d90ae0..6e2597c 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp @@ -9,49 +9,49 @@ static const char * USBNeeds[] = }; static const char * USBProvides[] = { "device", 0 }; /** * Constructor, find all of the possible interfaces */ USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { NSResources->addSystemFile( "interfaces", "/etc/network/interfaces", 1 ); } /** * Delete any interfaces that we own. */ USBNetNode::~USBNetNode(){ } const QString USBNetNode::nodeDescription(){ return tr("\ <p>Configure Ethernet over USB.</p>\ -<p>Use this for a computer to computer USB cable connection</p>\ +<p>Use this for a computer to computer USB cable NetworkSetup</p>\ " ); } ANetNodeInstance * USBNetNode::createInstance( void ) { return new AUSB( this ); } const char ** USBNetNode::needs( void ) { return USBNeeds; } const char ** USBNetNode::provides( void ) { return USBProvides; } QString USBNetNode::genNic( long ) { return QString( "usbf" ); } void USBNetNode::setSpecificAttribute( QString & , QString & ) { } void USBNetNode::saveSpecificAttribute( QTextStream & ) { diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 763644e..4082f7f 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp @@ -1,37 +1,37 @@ #include <qfile.h> #include <qfileinfo.h> #include <qtextstream.h> #include <resources.h> #include "usbrun.h" State_t USBRun::detectState( void ) { // unavailable : no card found // available : card found and assigned to us or free // up : card found and assigned to us and up - NodeCollection * NC = nodeCollection(); + NetworkSetup * NC = networkSetup(); QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); System & Sys = NSResources->system(); InterfaceInfo * Run; QFile F( S ); Log(("Detecting for %s\n", NC->name().latin1() )); if( F.open( IO_ReadOnly ) ) { // could open file -> read interface and assign QString X; QTextStream TS(&F); X = TS.readLine(); Log(("%s exists\n", S.latin1() )); // find interface if( handlesInterface( X ) ) { for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); It.current(); ++It ) { Run = It.current(); if( X == Run->Name ) { NC->assignInterface( Run ); return (Run->IsUp) ? IsUp : Available; } } } @@ -40,81 +40,81 @@ 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 return Available; } // else interface is up but NOT us -> some other profile } // nothing (valid) assigned to us NC->assignInterface( 0 ); // find possible interface 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 ) { +QString USBRun::setMyState( NetworkSetup * NC, Action_t, bool ) { 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; 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() ) { + if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { // assigned to us return Run; } else if( ! Run->IsUp && - Run->assignedConnection() == 0 ) { + Run->assignedToNetworkSetup() == 0 ) { // free best = Run; } // UP or not assigned to us } } return best; // can be 0 } bool USBRun::handlesInterface( const QString & S ) { return Pat.match( S ) >= 0; } bool USBRun::handlesInterface( InterfaceInfo * I ) { return handlesInterface( I->Name ); } diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h index 6ce4fa2..0872f3d 100644 --- a/noncore/settings/networksettings2/usb/usbrun.h +++ b/noncore/settings/networksettings2/usb/usbrun.h @@ -4,33 +4,33 @@ #include <netnode.h> #include <qregexp.h> #include "usbdata.h" class USBRun : public RuntimeInfo { public : USBRun( ANetNodeInstance * NNI, USBData & Data ) : RuntimeInfo( NNI ), Pat( "usb[0-9abcdef]" ) { } virtual RuntimeInfo * device( void ) { return this; } bool handlesInterface( const QString & I ); bool handlesInterface( InterfaceInfo * ); State_t detectState( void ); protected : - QString setMyState( NodeCollection * , Action_t, bool ); + QString setMyState( NetworkSetup * , Action_t, bool ); private : InterfaceInfo * getInterface( void ); QRegExp Pat; }; #endif |