author | mickeyl <mickeyl> | 2005-01-23 21:35:29 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-23 21:35:29 (UTC) |
commit | dd410f1eb69e68f04cf26b6d3e6bca88f0987f71 (patch) (unidiff) | |
tree | 0f2b59bae4c326011783e9cdea0754e180ae0e27 /libopie2/opiecore/device/odevice.cpp | |
parent | 78e658cecc7521cf3932f5eb44d3f551d73f3181 (diff) | |
download | opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.zip opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.tar.gz opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.tar.bz2 |
remove setSoftSuspend() from ODevice. this is a left-over from the old days
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index a824392..3d69614 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -209,101 +209,96 @@ ODevice::ODevice() | |||
209 | break; | 209 | break; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
215 | { | 215 | { |
216 | if ( msg == "deviceButtonMappingChanged()" ) { | 216 | if ( msg == "deviceButtonMappingChanged()" ) { |
217 | reloadButtonMapping(); | 217 | reloadButtonMapping(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | void ODevice::init(const QString&) | 221 | void ODevice::init(const QString&) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * This method initialises the button mapping | 226 | * This method initialises the button mapping |
227 | */ | 227 | */ |
228 | void ODevice::initButtons() | 228 | void ODevice::initButtons() |
229 | { | 229 | { |
230 | if ( d->m_buttons ) | 230 | if ( d->m_buttons ) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | qDebug ( "init Buttons" ); | 233 | qDebug ( "init Buttons" ); |
234 | d->m_buttons = new QValueList <ODeviceButton>; | 234 | d->m_buttons = new QValueList <ODeviceButton>; |
235 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 235 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
236 | default_button *db = default_buttons + i; | 236 | default_button *db = default_buttons + i; |
237 | ODeviceButton b; | 237 | ODeviceButton b; |
238 | b. setKeycode ( db->code ); | 238 | b. setKeycode ( db->code ); |
239 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 239 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
243 | d->m_buttons->append ( b ); | 243 | d->m_buttons->append ( b ); |
244 | } | 244 | } |
245 | 245 | ||
246 | reloadButtonMapping(); | 246 | reloadButtonMapping(); |
247 | } | 247 | } |
248 | 248 | ||
249 | ODevice::~ODevice() | 249 | ODevice::~ODevice() |
250 | { | 250 | { |
251 | // we leak m_devicebuttons and m_cpu_frequency | 251 | // we leak m_devicebuttons and m_cpu_frequency |
252 | // but it's a singleton and it is not so importantant | 252 | // but it's a singleton and it is not so importantant |
253 | // -zecke | 253 | // -zecke |
254 | delete d; | 254 | delete d; |
255 | } | 255 | } |
256 | 256 | ||
257 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | ||
258 | { | ||
259 | return false; | ||
260 | } | ||
261 | |||
262 | //#include <linux/apm_bios.h> | 257 | //#include <linux/apm_bios.h> |
263 | 258 | ||
264 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 259 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
265 | 260 | ||
266 | /** | 261 | /** |
267 | * This method will try to suspend the device | 262 | * This method will try to suspend the device |
268 | * It only works if the user is the QWS Server and the apm application | 263 | * It only works if the user is the QWS Server and the apm application |
269 | * is installed. | 264 | * is installed. |
270 | * It tries to suspend and then waits some time cause some distributions | 265 | * It tries to suspend and then waits some time cause some distributions |
271 | * do have asynchronus apm implementations. | 266 | * do have asynchronus apm implementations. |
272 | * This method will either fail and return false or it'll suspend the | 267 | * This method will either fail and return false or it'll suspend the |
273 | * device and return once the device got woken up | 268 | * device and return once the device got woken up |
274 | * | 269 | * |
275 | * @return if the device got suspended | 270 | * @return if the device got suspended |
276 | */ | 271 | */ |
277 | bool ODevice::suspend() | 272 | bool ODevice::suspend() |
278 | { | 273 | { |
279 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 274 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
280 | return false; | 275 | return false; |
281 | 276 | ||
282 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 277 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
283 | return false; | 278 | return false; |
284 | 279 | ||
285 | bool res = false; | 280 | bool res = false; |
286 | ODevice::sendSuspendmsg(); | 281 | ODevice::sendSuspendmsg(); |
287 | 282 | ||
288 | struct timeval tvs, tvn; | 283 | struct timeval tvs, tvn; |
289 | ::gettimeofday ( &tvs, 0 ); | 284 | ::gettimeofday ( &tvs, 0 ); |
290 | 285 | ||
291 | ::sync(); // flush fs caches | 286 | ::sync(); // flush fs caches |
292 | res = ( ::system ( "apm --suspend" ) == 0 ); | 287 | res = ( ::system ( "apm --suspend" ) == 0 ); |
293 | 288 | ||
294 | // This is needed because the iPAQ apm implementation is asynchronous and we | 289 | // This is needed because the iPAQ apm implementation is asynchronous and we |
295 | // can not be sure when exactly the device is really suspended | 290 | // can not be sure when exactly the device is really suspended |
296 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 291 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
297 | 292 | ||
298 | if ( res ) { | 293 | if ( res ) { |
299 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 294 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
300 | ::usleep ( 200 * 1000 ); | 295 | ::usleep ( 200 * 1000 ); |
301 | ::gettimeofday ( &tvn, 0 ); | 296 | ::gettimeofday ( &tvn, 0 ); |
302 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 297 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
303 | } | 298 | } |
304 | 299 | ||
305 | return res; | 300 | return res; |
306 | } | 301 | } |
307 | 302 | ||
308 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 303 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
309 | 304 | ||