author | mickeyl <mickeyl> | 2005-01-11 21:08:00 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-11 21:08:00 (UTC) |
commit | f89120a7a1a3d0bf9c0805456490906ca914e560 (patch) (unidiff) | |
tree | 23c184e6c2111b7870ef9eccffc11ae8bf225de2 | |
parent | f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc (diff) | |
download | opie-f89120a7a1a3d0bf9c0805456490906ca914e560.zip opie-f89120a7a1a3d0bf9c0805456490906ca914e560.tar.gz opie-f89120a7a1a3d0bf9c0805456490906ca914e560.tar.bz2 |
workaround a quirk in the linux kernel semantics
echo 1 >power actually powers off a device *cough*
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 269f6c9..d3ab63a 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -475,49 +475,49 @@ bool Zaurus::setDisplayBrightness( int bright ) | |||
475 | } | 475 | } |
476 | } | 476 | } |
477 | return res; | 477 | return res; |
478 | } | 478 | } |
479 | 479 | ||
480 | bool Zaurus::setDisplayStatus( bool on ) | 480 | bool Zaurus::setDisplayStatus( bool on ) |
481 | { | 481 | { |
482 | bool res = false; | 482 | bool res = false; |
483 | if ( m_embedix ) | 483 | if ( m_embedix ) |
484 | { | 484 | { |
485 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 485 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
486 | if ( fd ) | 486 | if ( fd ) |
487 | { | 487 | { |
488 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 488 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
489 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 489 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
490 | ::close ( fd ); | 490 | ::close ( fd ); |
491 | } | 491 | } |
492 | } | 492 | } |
493 | else | 493 | else |
494 | { | 494 | { |
495 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); | 495 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); |
496 | if ( fd ) | 496 | if ( fd ) |
497 | { | 497 | { |
498 | char buf[10]; | 498 | char buf[10]; |
499 | buf[0] = on ? '0' : '1'; | 499 | buf[0] = on ? '1' : '0'; |
500 | buf[1] = '\0'; | 500 | buf[1] = '\0'; |
501 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 501 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
502 | ::close( fd ); | 502 | ::close( fd ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | return res; | 505 | return res; |
506 | } | 506 | } |
507 | 507 | ||
508 | bool Zaurus::suspend() | 508 | bool Zaurus::suspend() |
509 | { | 509 | { |
510 | qDebug("ODevice::suspend"); | 510 | qDebug("ODevice::suspend"); |
511 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 511 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
512 | return false; | 512 | return false; |
513 | 513 | ||
514 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 514 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
515 | return false; | 515 | return false; |
516 | 516 | ||
517 | bool res = false; | 517 | bool res = false; |
518 | ODevice::sendSuspendmsg(); | 518 | ODevice::sendSuspendmsg(); |
519 | 519 | ||
520 | struct timeval tvs, tvn; | 520 | struct timeval tvs, tvn; |
521 | ::gettimeofday ( &tvs, 0 ); | 521 | ::gettimeofday ( &tvs, 0 ); |
522 | 522 | ||
523 | ::sync(); // flush fs caches | 523 | ::sync(); // flush fs caches |