summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb/usbrun.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/usb/usbrun.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp43
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
@@ -40,2 +40,3 @@ State_t USBRun::detectState( void ) {
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() ) ) {
@@ -52,17 +53,3 @@ State_t USBRun::detectState( void ) {
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
@@ -72,3 +59,2 @@ State_t USBRun::detectState( void ) {
72 } 59 }
73 }
74 60
@@ -79,4 +65,12 @@ 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();
@@ -89,3 +83,2 @@ InterfaceInfo * USBRun::getInterface( void ) {
89 InterfaceInfo * best = 0, * Run; 83 InterfaceInfo * best = 0, * Run;
90 QRegExp R( "usb[0-9abcdef]" );
91 84
@@ -95,2 +88,9 @@ InterfaceInfo * USBRun::getInterface( void ) {
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 ) &&
@@ -102,6 +102,7 @@ InterfaceInfo * USBRun::getInterface( void ) {
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 }