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 | |||
@@ -21,25 +21,25 @@ USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { | |||
21 | "interfaces", "/etc/network/interfaces", 1 ); | 21 | "interfaces", "/etc/network/interfaces", 1 ); |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Delete any interfaces that we own. | 25 | * Delete any interfaces that we own. |
26 | */ | 26 | */ |
27 | USBNetNode::~USBNetNode(){ | 27 | USBNetNode::~USBNetNode(){ |
28 | } | 28 | } |
29 | 29 | ||
30 | const QString USBNetNode::nodeDescription(){ | 30 | const QString USBNetNode::nodeDescription(){ |
31 | return tr("\ | 31 | return tr("\ |
32 | <p>Configure Ethernet over USB.</p>\ | 32 | <p>Configure Ethernet over USB.</p>\ |
33 | <p>Use this for a computer to computer USB cable connection</p>\ | 33 | <p>Use this for a computer to computer USB cable NetworkSetup</p>\ |
34 | " | 34 | " |
35 | ); | 35 | ); |
36 | } | 36 | } |
37 | 37 | ||
38 | ANetNodeInstance * USBNetNode::createInstance( void ) { | 38 | ANetNodeInstance * USBNetNode::createInstance( void ) { |
39 | return new AUSB( this ); | 39 | return new AUSB( this ); |
40 | } | 40 | } |
41 | 41 | ||
42 | const char ** USBNetNode::needs( void ) { | 42 | const char ** USBNetNode::needs( void ) { |
43 | return USBNeeds; | 43 | return USBNeeds; |
44 | } | 44 | } |
45 | 45 | ||
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,25 +1,25 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
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 | ||
9 | // unavailable : no card found | 9 | // unavailable : no card found |
10 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
11 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | 12 | ||
13 | NodeCollection * NC = nodeCollection(); | 13 | NetworkSetup * NC = networkSetup(); |
14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
15 | System & Sys = NSResources->system(); | 15 | System & Sys = NSResources->system(); |
16 | InterfaceInfo * Run; | 16 | InterfaceInfo * Run; |
17 | QFile F( S ); | 17 | QFile F( S ); |
18 | Log(("Detecting for %s\n", NC->name().latin1() )); | 18 | Log(("Detecting for %s\n", NC->name().latin1() )); |
19 | 19 | ||
20 | if( F.open( IO_ReadOnly ) ) { | 20 | if( F.open( IO_ReadOnly ) ) { |
21 | // could open file -> read interface and assign | 21 | // could open file -> read interface and assign |
22 | QString X; | 22 | QString X; |
23 | QTextStream TS(&F); | 23 | QTextStream TS(&F); |
24 | X = TS.readLine(); | 24 | X = TS.readLine(); |
25 | Log(("%s exists\n", S.latin1() )); | 25 | Log(("%s exists\n", S.latin1() )); |
@@ -52,25 +52,25 @@ State_t USBRun::detectState( void ) { | |||
52 | 52 | ||
53 | // find possible interface | 53 | // find possible interface |
54 | if( getInterface() ) { | 54 | if( getInterface() ) { |
55 | // proper type, and Not UP -> free | 55 | // proper type, and Not UP -> free |
56 | // usb cables are currently always available when requested | 56 | // usb cables are currently always available when requested |
57 | // until we can detect if we are plugged in | 57 | // until we can detect if we are plugged in |
58 | return Available; | 58 | return Available; |
59 | } | 59 | } |
60 | 60 | ||
61 | return Unavailable; | 61 | return Unavailable; |
62 | } | 62 | } |
63 | 63 | ||
64 | QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 64 | QString USBRun::setMyState( NetworkSetup * NC, Action_t, bool ) { |
65 | 65 | ||
66 | InterfaceInfo * I = getInterface(); | 66 | InterfaceInfo * I = getInterface(); |
67 | 67 | ||
68 | if( ! I ) { | 68 | if( ! I ) { |
69 | return QString("No usb device available"); | 69 | return QString("No usb device available"); |
70 | } | 70 | } |
71 | 71 | ||
72 | Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); | 72 | Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); |
73 | // grab this interface | 73 | // grab this interface |
74 | NC->assignInterface( I ); | 74 | NC->assignInterface( I ); |
75 | 75 | ||
76 | return QString(); | 76 | return QString(); |
@@ -88,29 +88,29 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
88 | Run = It.current(); | 88 | Run = It.current(); |
89 | 89 | ||
90 | Log(("%s %d %d=%d %d\n", | 90 | Log(("%s %d %d=%d %d\n", |
91 | Run->Name.latin1(), | 91 | Run->Name.latin1(), |
92 | handlesInterface( Run->Name ), | 92 | handlesInterface( Run->Name ), |
93 | Run->CardType, ARPHRD_ETHER, | 93 | Run->CardType, ARPHRD_ETHER, |
94 | ! Run->IsUp )); | 94 | ! Run->IsUp )); |
95 | 95 | ||
96 | if( handlesInterface( Run->Name ) && | 96 | if( handlesInterface( Run->Name ) && |
97 | Run->CardType == ARPHRD_ETHER | 97 | Run->CardType == ARPHRD_ETHER |
98 | ) { | 98 | ) { |
99 | // this is a USB card | 99 | // this is a USB card |
100 | if( Run->assignedConnection() == netNode()->connection() ) { | 100 | if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { |
101 | // assigned to us | 101 | // assigned to us |
102 | return Run; | 102 | return Run; |
103 | } else if( ! Run->IsUp && | 103 | } else if( ! Run->IsUp && |
104 | Run->assignedConnection() == 0 ) { | 104 | Run->assignedToNetworkSetup() == 0 ) { |
105 | // free | 105 | // free |
106 | best = Run; | 106 | best = Run; |
107 | } // UP or not assigned to us | 107 | } // UP or not assigned to us |
108 | } | 108 | } |
109 | } | 109 | } |
110 | return best; // can be 0 | 110 | return best; // can be 0 |
111 | } | 111 | } |
112 | 112 | ||
113 | bool USBRun::handlesInterface( const QString & S ) { | 113 | bool USBRun::handlesInterface( const QString & S ) { |
114 | return Pat.match( S ) >= 0; | 114 | return Pat.match( S ) >= 0; |
115 | } | 115 | } |
116 | 116 | ||
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 | |||
@@ -16,21 +16,21 @@ public : | |||
16 | } | 16 | } |
17 | 17 | ||
18 | virtual RuntimeInfo * device( void ) | 18 | virtual RuntimeInfo * device( void ) |
19 | { return this; } | 19 | { return this; } |
20 | 20 | ||
21 | bool handlesInterface( const QString & I ); | 21 | bool handlesInterface( const QString & I ); |
22 | bool handlesInterface( InterfaceInfo * ); | 22 | bool handlesInterface( InterfaceInfo * ); |
23 | 23 | ||
24 | State_t detectState( void ); | 24 | State_t detectState( void ); |
25 | 25 | ||
26 | protected : | 26 | protected : |
27 | 27 | ||
28 | QString setMyState( NodeCollection * , Action_t, bool ); | 28 | QString setMyState( NetworkSetup * , Action_t, bool ); |
29 | 29 | ||
30 | private : | 30 | private : |
31 | 31 | ||
32 | InterfaceInfo * getInterface( void ); | 32 | InterfaceInfo * getInterface( void ); |
33 | QRegExp Pat; | 33 | QRegExp Pat; |
34 | 34 | ||
35 | }; | 35 | }; |
36 | #endif | 36 | #endif |