summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/usb') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp24
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.h8
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp25
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.h5
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp6
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.h4
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
@@ -42,22 +42,26 @@ bool USBNetNode::generateProperFilesFor(
42 return 1; 42 return 1;
43} 43}
44 44
45bool USBNetNode::hasDataFor( const QString & S, bool ) { 45bool USBNetNode::hasDataFor( const QString & S ) {
46 return (S== "interfaces"); 46 return (S== "interfaces");
47} 47}
48 48
49bool USBNetNode::generateDataForCommonFile( 49bool 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
56bool USBNetNode::generateDeviceDataForCommonFile( 63QString 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
63extern "C" { 67extern "C" {
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
@@ -28,11 +28,11 @@ public:
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
37private: 37private:
38 38
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
@@ -32,26 +32,21 @@ void AUSB::commit( void ) {
32 } 32 }
33} 33}
34 34
35bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) { 35bool 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
46bool AUSB::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) { 39bool 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
@@ -27,8 +27,9 @@ public :
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
33protected : 34protected :
34 35
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
@@ -174,9 +174,3 @@ bool USBRun::handlesInterface( const QString & S ) {
174 return Pat.match( S ) >= 0; 174 return Pat.match( S ) >= 0;
175} 175}
176 176
177QString 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
@@ -15,10 +15,6 @@ public :
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