author | wimpie <wimpie> | 2004-04-04 15:23:16 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-04 15:23:16 (UTC) |
commit | fd9146de7698a796659b68606429da490f817138 (patch) (unidiff) | |
tree | f026bf2a7adcaaa3a0dd0429e7474f536787253d /noncore/settings/networksettings2/usb | |
parent | 5b52572e2ec9f0f6f39706aceb9ec1e98440fd3d (diff) | |
download | opie-fd9146de7698a796659b68606429da490f817138.zip opie-fd9146de7698a796659b68606429da490f817138.tar.gz opie-fd9146de7698a796659b68606429da490f817138.tar.bz2 |
Many changes
Diffstat (limited to 'noncore/settings/networksettings2/usb') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/usb/usb_NN.cpp | 24 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usb_NN.h | 8 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usb_NNI.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usb_NNI.h | 5 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings2/usb/usbrun.h | 4 |
6 files changed, 31 insertions, 41 deletions
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index be4a2bc..30c72db 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -33,35 +33,39 @@ const char ** USBNetNode::needs( void ) { | |||
33 | return USBNeeds; | 33 | return USBNeeds; |
34 | } | 34 | } |
35 | 35 | ||
36 | const char * USBNetNode::provides( void ) { | 36 | const char * USBNetNode::provides( void ) { |
37 | return "device"; | 37 | return "device"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool USBNetNode::generateProperFilesFor( | 40 | bool USBNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool USBNetNode::hasDataFor( const QString & S, bool ) { | 45 | bool USBNetNode::hasDataFor( const QString & S ) { |
46 | return (S== "interfaces"); | 46 | return (S== "interfaces"); |
47 | } | 47 | } |
48 | 48 | ||
49 | bool USBNetNode::generateDataForCommonFile( | 49 | bool USBNetNode::generateDeviceDataForCommonFile( |
50 | SystemFile & S , | 50 | SystemFile & S , |
51 | long DevNr, | 51 | long DevNr ) { |
52 | ANetNodeInstance * NNI) { | 52 | QString NIC = genNic( DevNr ); |
53 | return ((AUSB *)NNI)->generateDataForCommonFile(S, DevNr); | 53 | |
54 | if( S.name() == "interfaces" ) { | ||
55 | // generate mapping stanza for this interface | ||
56 | S << "# check if " << NIC << " can be brought UP" << endl; | ||
57 | S << "mapping " << NIC << endl; | ||
58 | S << " script networksettings2-request" << endl << endl; | ||
59 | } | ||
60 | return 0; | ||
54 | } | 61 | } |
55 | 62 | ||
56 | bool USBNetNode::generateDeviceDataForCommonFile( | 63 | QString USBNetNode::genNic( long ) { |
57 | SystemFile & S , | 64 | return QString( "usbf" ); |
58 | long DevNr, | ||
59 | ANetNodeInstance * NNI) { | ||
60 | return ((AUSB *)NNI)->generateDeviceDataForCommonFile(S, DevNr); | ||
61 | } | 65 | } |
62 | 66 | ||
63 | extern "C" { | 67 | extern "C" { |
64 | void create_plugin( QList<ANetNode> & PNN ) { | 68 | void create_plugin( QList<ANetNode> & PNN ) { |
65 | PNN.append( new USBNetNode() ); | 69 | PNN.append( new USBNetNode() ); |
66 | } | 70 | } |
67 | } | 71 | } |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index 8ff5289..ba22b1c 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -19,28 +19,28 @@ public: | |||
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("USB Cable Connect"); } | 21 | { return tr("USB Cable Connect"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S, bool DeviceSpec ); | 31 | virtual bool hasDataFor( const QString & S); |
32 | virtual bool generateDataForCommonFile( | ||
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | ||
34 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
35 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr ); |
34 | |||
35 | virtual QString genNic( long nr ); | ||
36 | 36 | ||
37 | private: | 37 | private: |
38 | 38 | ||
39 | }; | 39 | }; |
40 | 40 | ||
41 | extern "C" | 41 | extern "C" |
42 | { | 42 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 43 | void create_plugin( QList<ANetNode> & PNN ); |
44 | }; | 44 | }; |
45 | 45 | ||
46 | #endif | 46 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp index 6fcd6d5..e90204c 100644 --- a/noncore/settings/networksettings2/usb/usb_NNI.cpp +++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp | |||
@@ -23,35 +23,30 @@ QWidget * AUSB::edit( QWidget * parent ) { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | QString AUSB::acceptable( void ) { | 25 | QString AUSB::acceptable( void ) { |
26 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 26 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void AUSB::commit( void ) { | 29 | void AUSB::commit( void ) { |
30 | if( GUI && GUI->commit( Data ) ) { | 30 | if( GUI && GUI->commit( Data ) ) { |
31 | setModified( 1 ); | 31 | setModified( 1 ); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) { | 35 | bool AUSB::hasDataFor( const QString & S ) { |
36 | AsDevice * Dev = runtime()->device(); | 36 | return (S== "interfaces"); |
37 | QString NIC = Dev->genNic( DevNr ); | ||
38 | |||
39 | if( S.name() == "interfaces" ) { | ||
40 | // generate mapping stanza for this interface | ||
41 | S << " pre-up " << QPEApplication::qpeDir() << "bin/setmacaddress.sh " << NIC << " || true" << endl; | ||
42 | } | ||
43 | return 0; | ||
44 | } | 37 | } |
45 | 38 | ||
46 | bool AUSB::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { | 39 | bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) { |
47 | AsDevice * Dev = runtime()->device(); | 40 | QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
48 | QString NIC = Dev->genNic( DevNr ); | ||
49 | 41 | ||
50 | if( S.name() == "interfaces" ) { | 42 | if( S.name() == "interfaces" ) { |
51 | // generate mapping stanza for this interface | 43 | // generate mapping stanza for this interface |
52 | S << "# check if " << NIC << " can be brought UP" << endl; | 44 | S << " pre-up " |
53 | S << "mapping " << NIC << endl; | 45 | << QPEApplication::qpeDir() |
54 | S << " script networksettings2-request" << endl << endl; | 46 | << "bin/setmacaddress.sh " |
47 | << NIC | ||
48 | << " || true" | ||
49 | << endl; | ||
55 | } | 50 | } |
56 | return 0; | 51 | return 0; |
57 | } | 52 | } |
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.h b/noncore/settings/networksettings2/usb/usb_NNI.h index 5dead36..d2ee217 100644 --- a/noncore/settings/networksettings2/usb/usb_NNI.h +++ b/noncore/settings/networksettings2/usb/usb_NNI.h | |||
@@ -18,26 +18,27 @@ public : | |||
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new USBRun( this, Data ); | 23 | RT = new USBRun( this, Data ); |
24 | return RT; | 24 | return RT; |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | bool generateDataForCommonFile( SystemFile & S, long DevNr ); | 30 | virtual bool hasDataFor( const QString & S); |
31 | bool generateDeviceDataForCommonFile( SystemFile & S, long DevNr ); | 31 | virtual bool generateDataForCommonFile( |
32 | SystemFile & SF, long DevNr ); | ||
32 | 33 | ||
33 | protected : | 34 | protected : |
34 | 35 | ||
35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
36 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
37 | 38 | ||
38 | private : | 39 | private : |
39 | 40 | ||
40 | USBEdit * GUI; | 41 | USBEdit * GUI; |
41 | USBData Data; | 42 | USBData Data; |
42 | USBRun * RT; | 43 | USBRun * RT; |
43 | }; | 44 | }; |
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 3007e79..4ce6721 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -165,18 +165,12 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
165 | // free | 165 | // free |
166 | best = Run; | 166 | best = Run; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | } | 169 | } |
170 | return best; // can be 0 | 170 | return best; // can be 0 |
171 | } | 171 | } |
172 | 172 | ||
173 | bool USBRun::handlesInterface( const QString & S ) { | 173 | bool USBRun::handlesInterface( const QString & S ) { |
174 | return Pat.match( S ) >= 0; | 174 | return Pat.match( S ) >= 0; |
175 | } | 175 | } |
176 | 176 | ||
177 | QString USBRun::genNic( long nr ) { | ||
178 | QString S; | ||
179 | S.sprintf( "usbf" ); | ||
180 | return S; | ||
181 | } | ||
182 | |||
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h index 60f9fe8..6c6e4e4 100644 --- a/noncore/settings/networksettings2/usb/usbrun.h +++ b/noncore/settings/networksettings2/usb/usbrun.h | |||
@@ -6,28 +6,24 @@ | |||
6 | #include "usbdata.h" | 6 | #include "usbdata.h" |
7 | 7 | ||
8 | class USBRun : public AsDevice { | 8 | class USBRun : public AsDevice { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | USBRun( ANetNodeInstance * NNI, | 12 | USBRun( ANetNodeInstance * NNI, |
13 | USBData & Data ) : | 13 | USBData & Data ) : |
14 | AsDevice( NNI ), | 14 | AsDevice( NNI ), |
15 | Pat( "usb[0-9abcdef]" ) | 15 | Pat( "usb[0-9abcdef]" ) |
16 | { } | 16 | { } |
17 | 17 | ||
18 | virtual long count( void ) | ||
19 | { return 1; } | ||
20 | virtual QString genNic( long nr ); | ||
21 | |||
22 | virtual AsDevice * device( void ) | 18 | virtual AsDevice * device( void ) |
23 | { return (AsDevice *)this; } | 19 | { return (AsDevice *)this; } |
24 | 20 | ||
25 | virtual AsDevice * asDevice( void ) | 21 | virtual AsDevice * asDevice( void ) |
26 | { return (AsDevice *)this; } | 22 | { return (AsDevice *)this; } |
27 | protected : | 23 | protected : |
28 | 24 | ||
29 | void detectState( NodeCollection * ); | 25 | void detectState( NodeCollection * ); |
30 | bool setState( NodeCollection * , Action_t A ); | 26 | bool setState( NodeCollection * , Action_t A ); |
31 | bool canSetState( State_t , Action_t A ); | 27 | bool canSetState( State_t , Action_t A ); |
32 | 28 | ||
33 | bool handlesInterface( const QString & I ); | 29 | bool handlesInterface( const QString & I ); |