summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb
authorwimpie <wimpie>2005-01-07 15:23:23 (UTC)
committer wimpie <wimpie>2005-01-07 15:23:23 (UTC)
commitb4eced64efad35beeb2004243ca26bf7eb20eaba (patch) (unidiff)
tree14caf32705c787a8bffc917ecdf216ad40cfbdc0 /noncore/settings/networksettings2/usb
parent7af7203a51ddcf85f9f60e39157fcad21f7d9e34 (diff)
downloadopie-b4eced64efad35beeb2004243ca26bf7eb20eaba.zip
opie-b4eced64efad35beeb2004243ca26bf7eb20eaba.tar.gz
opie-b4eced64efad35beeb2004243ca26bf7eb20eaba.tar.bz2
All NS2 libraries are now properly working plugins
Diffstat (limited to 'noncore/settings/networksettings2/usb') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp19
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp15
2 files changed, 6 insertions, 28 deletions
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index 9c07b82..6d90ae0 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -1,16 +1,12 @@
1#include <resources.h> 1#include <resources.h>
2#include "usb_NN.h" 2#include "usb_NN.h"
3#include "usb_NNI.h" 3#include "usb_NNI.h"
4 4
5#ifndef MYPLUGIN
6
7#include "netnodeinterface.h" 5#include "netnodeinterface.h"
8 6
9#endif
10
11static const char * USBNeeds[] = 7static const char * USBNeeds[] =
12 { 0 8 { 0
13 }; 9 };
14 10
15static const char * USBProvides[] = 11static const char * USBProvides[] =
16 { "device", 12 { "device",
@@ -58,20 +54,7 @@ QString USBNetNode::genNic( long ) {
58void USBNetNode::setSpecificAttribute( QString & , QString & ) { 54void USBNetNode::setSpecificAttribute( QString & , QString & ) {
59} 55}
60 56
61void USBNetNode::saveSpecificAttribute( QTextStream & ) { 57void USBNetNode::saveSpecificAttribute( QTextStream & ) {
62} 58}
63 59
64#ifdef MYPLUGIN 60OPIE_NS2_PLUGIN( NetNodeInterface_T<USBNetNode> )
65
66extern "C" {
67void create_plugin( QList<ANetNode> & PNN ) {
68 PNN.append( new USBNetNode() );
69}
70
71#else
72
73OPIE_NS2_PLUGIN( NetNodeInterface<USBNetNode> )
74
75#endif
76
77}
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
7State_t USBRun::detectState( void ) { 7State_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
74QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { 78QString 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
91InterfaceInfo * USBRun::getInterface( void ) { 86InterfaceInfo * USBRun::getInterface( void ) {
92 87