Diffstat (limited to 'noncore/settings/networksettings2/usb/usbrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 0a46642..eb439c1 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -2,15 +2,17 @@ | |||
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "usbrun.h" | 5 | #include "usbrun.h" |
6 | 6 | ||
7 | State_t USBRun::detectState( void ) { | 7 | State_t USBRun::detectState( void ) { |
8 | |||
8 | // unavailable : no card found | 9 | // unavailable : no card found |
9 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
10 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | |||
11 | NodeCollection * NC = nodeCollection(); | 13 | NodeCollection * NC = nodeCollection(); |
12 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
13 | System & Sys = NSResources->system(); | 15 | System & Sys = NSResources->system(); |
14 | InterfaceInfo * Run; | 16 | InterfaceInfo * Run; |
15 | QFile F( S ); | 17 | QFile F( S ); |
16 | Log(("Detecting for %s\n", NC->name().latin1() )); | 18 | Log(("Detecting for %s\n", NC->name().latin1() )); |
@@ -61,32 +63,25 @@ State_t USBRun::detectState( void ) { | |||
61 | 63 | ||
62 | if( handlesInterface( Run->Name ) && | 64 | if( handlesInterface( Run->Name ) && |
63 | Run->CardType == ARPHRD_ETHER && | 65 | Run->CardType == ARPHRD_ETHER && |
64 | ! Run->IsUp | 66 | ! Run->IsUp |
65 | ) { | 67 | ) { |
66 | // proper type, and Not UP -> free | 68 | // proper type, and Not UP -> free |
67 | return Off; | 69 | // usb cables are currently always available when requested |
70 | // until we can detect if we are plugged in | ||
71 | return Available; | ||
68 | } | 72 | } |
69 | } | 73 | } |
70 | 74 | ||
71 | return Unavailable; | 75 | return Unavailable; |
72 | } | 76 | } |
73 | 77 | ||
74 | QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 78 | QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
75 | 79 | ||
76 | // nothing needs to be done to 'activate' or 'deactivate' | 80 | // nothing needs to be done to 'activate' or 'deactivate' |
77 | // a cable | 81 | // a cable |
78 | |||
79 | // perhaps (later) we can figure out if the device is IN the | ||
80 | // cradle | ||
81 | if( A == Activate ) { | ||
82 | NC->setCurrentState( Available ); | ||
83 | } else if ( A == Deactivate ) { | ||
84 | NC->setCurrentState( Unavailable ); | ||
85 | } | ||
86 | |||
87 | return QString(); | 82 | return QString(); |
88 | } | 83 | } |
89 | 84 | ||
90 | // get interface that is free or assigned to us | 85 | // get interface that is free or assigned to us |
91 | InterfaceInfo * USBRun::getInterface( void ) { | 86 | InterfaceInfo * USBRun::getInterface( void ) { |
92 | 87 | ||