summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/linux/opcmciasystem.cpp15
-rw-r--r--libopie2/opiecore/linux/opcmciasystem.h9
2 files changed, 23 insertions, 1 deletions
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp
index c4b5316..c310b85 100644
--- a/libopie2/opiecore/linux/opcmciasystem.cpp
+++ b/libopie2/opiecore/linux/opcmciasystem.cpp
@@ -145,61 +145,74 @@ OPcmciaSocket::OPcmciaSocket( int socket, QObject* parent, const char* name )
145 odebug << "OPcmciaSocket::OPcmciaSocket()" << oendl; 145 odebug << "OPcmciaSocket::OPcmciaSocket()" << oendl;
146 init(); 146 init();
147} 147}
148 148
149 149
150OPcmciaSocket::~OPcmciaSocket() 150OPcmciaSocket::~OPcmciaSocket()
151{ 151{
152} 152}
153 153
154 154
155/* internal */ void OPcmciaSocket::init() 155/* internal */ void OPcmciaSocket::init()
156{ 156{
157} 157}
158 158
159/* internal */ bool OPcmciaSocket::command( const QString& cmd ) 159/* internal */ bool OPcmciaSocket::command( const QString& cmd )
160{ 160{
161 QString cmdline = QString().sprintf( "cardctl %s %d &", (const char*) cmd, _socket ); 161 QString cmdline = QString().sprintf( "cardctl %s %d &", (const char*) cmd, _socket );
162 ::system( (const char*) cmdline ); 162 ::system( (const char*) cmdline );
163} 163}
164 164
165int OPcmciaSocket::number() const 165int OPcmciaSocket::number() const
166{ 166{
167 return _socket; 167 return _socket;
168} 168}
169 169
170 170
171QString OPcmciaSocket::identity() const 171QString OPcmciaSocket::identity() const
172{ 172{
173 return ( strcmp( name(), "empty" ) == 0 ) ? "<Empty Socket>" : name(); 173 return ( strcmp( name(), "empty" ) == 0 ) ? "<Empty Socket>" : name();
174} 174}
175 175
176 176
177bool OPcmciaSocket::isUnsupported() const
178{
179 return ( strcmp( name(), "unsupported card" ) == 0 );
180}
181
182
177bool OPcmciaSocket::isEmpty() const 183bool OPcmciaSocket::isEmpty() const
178{ 184{
179 return ( strcmp( name(), "empty" ) == 0 ); 185 return ( strcmp( name(), "empty" ) == 0 );
180} 186}
181 187
182 188
183bool OPcmciaSocket::isSuspended() const 189bool OPcmciaSocket::isSuspended() const
184{ 190{
191 //FIXME
192 return false;
185} 193}
186 194
187bool OPcmciaSocket::eject() 195bool OPcmciaSocket::eject()
188{ 196{
189 return command( "eject" ); 197 return command( "eject" );
190} 198}
191 199
192bool OPcmciaSocket::insert() 200bool OPcmciaSocket::insert()
193{ 201{
194 return command( "insert" ); 202 return command( "insert" );
195} 203}
196 204
197bool OPcmciaSocket::suspend() 205bool OPcmciaSocket::suspend()
198{ 206{
199 return command( "suspend" ); 207 return command( "suspend" );
200} 208}
201 209
202bool OPcmciaSocket::resume() 210bool OPcmciaSocket::resume()
203{ 211{
204 return command( "resume "); 212 return command( "resume");
213}
214
215bool OPcmciaSocket::reset()
216{
217 return command( "reset");
205} 218}
diff --git a/libopie2/opiecore/linux/opcmciasystem.h b/libopie2/opiecore/linux/opcmciasystem.h
index 4b445aa..630a434 100644
--- a/libopie2/opiecore/linux/opcmciasystem.h
+++ b/libopie2/opiecore/linux/opcmciasystem.h
@@ -95,77 +95,86 @@ class OPcmciaSystem : public QObject
95 class Private; 95 class Private;
96 Private *d; 96 Private *d;
97}; 97};
98 98
99 99
100/*====================================================================================== 100/*======================================================================================
101 * OPcmciaSocket 101 * OPcmciaSocket
102 *======================================================================================*/ 102 *======================================================================================*/
103 103
104class OPcmciaSocket : public QObject 104class OPcmciaSocket : public QObject
105{ 105{
106 Q_OBJECT 106 Q_OBJECT
107 107
108 public: 108 public:
109 /** 109 /**
110 * Constructor. Normally you don't create @ref OPcmciaSocket objects yourself, 110 * Constructor. Normally you don't create @ref OPcmciaSocket objects yourself,
111 * but access them via @ref OPcmciaSystem::card(). 111 * but access them via @ref OPcmciaSystem::card().
112 */ 112 */
113 OPcmciaSocket( int socket, QObject* parent, const char* name ); 113 OPcmciaSocket( int socket, QObject* parent, const char* name );
114 /** 114 /**
115 * Destructor. 115 * Destructor.
116 */ 116 */
117 virtual ~OPcmciaSocket(); 117 virtual ~OPcmciaSocket();
118 /** 118 /**
119 * @returns the corresponding socket number 119 * @returns the corresponding socket number
120 */ 120 */
121 int number() const; 121 int number() const;
122 /** 122 /**
123 * @returns the identification string of the card in this socket, or "<Empty Socket>" 123 * @returns the identification string of the card in this socket, or "<Empty Socket>"
124 */ 124 */
125 QString identity() const; 125 QString identity() const;
126 /** 126 /**
127 * @returns true, if the card is unsupported by the cardmgr
128 */
129 bool isUnsupported() const;
130 /**
127 * @returns true, if the socket is empty 131 * @returns true, if the socket is empty
128 */ 132 */
129 bool isEmpty() const; 133 bool isEmpty() const;
130 /** 134 /**
131 * @returns true, if the socket is suspended 135 * @returns true, if the socket is suspended
132 */ 136 */
133 bool isSuspended() const; 137 bool isSuspended() const;
134 /** 138 /**
135 * Eject card. @returns true, if operation succeeded 139 * Eject card. @returns true, if operation succeeded
136 * @note: This operation needs root privileges 140 * @note: This operation needs root privileges
137 */ 141 */
138 bool eject(); 142 bool eject();
139 /** 143 /**
140 * Insert card. @returns true, if operation succeeded 144 * Insert card. @returns true, if operation succeeded
141 * @note: This operation needs root privileges 145 * @note: This operation needs root privileges
142 */ 146 */
143 bool insert(); 147 bool insert();
144 /** 148 /**
145 * Suspend card. @returns true, if operation succeeded 149 * Suspend card. @returns true, if operation succeeded
146 * @note: This operation needs root privileges 150 * @note: This operation needs root privileges
147 */ 151 */
148 bool suspend(); 152 bool suspend();
149 /** 153 /**
150 * Resume card. @returns true, if operation succeeded 154 * Resume card. @returns true, if operation succeeded
151 * @note: This operation needs root privileges 155 * @note: This operation needs root privileges
152 */ 156 */
153 bool resume(); 157 bool resume();
158 /**
159 * Reset card. @returns true, if operation succeeded
160 * @note: This operation needs root privileges
161 */
162 bool reset();
154 163
155 protected: 164 protected:
156 165
157 private: 166 private:
158 void init(); 167 void init();
159 bool command( const QString& cmd ); 168 bool command( const QString& cmd );
160 int _socket; 169 int _socket;
161 170
162 private: 171 private:
163 class Private; 172 class Private;
164 Private *d; 173 Private *d;
165}; 174};
166 175
167 176
168} 177}
169} 178}
170 179
171#endif // OPCMCIASYSTEM_H 180#endif // OPCMCIASYSTEM_H