Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 8bff770..9d23a12 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,48 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_zaurus.h" | 30 | #include "odevice_zaurus.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
@@ -545,48 +545,49 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
545 | } | 545 | } |
546 | } | 546 | } |
547 | else | 547 | else |
548 | { | 548 | { |
549 | // special treatment for the OpenZaurus unified interface | 549 | // special treatment for the OpenZaurus unified interface |
550 | #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ | 550 | #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ |
551 | if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { | 551 | if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { |
552 | res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); | 552 | res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); |
553 | ::close ( fd ); | 553 | ::close ( fd ); |
554 | } | 554 | } |
555 | } | 555 | } |
556 | return res; | 556 | return res; |
557 | } | 557 | } |
558 | 558 | ||
559 | bool Zaurus::suspend() | 559 | bool Zaurus::suspend() |
560 | { | 560 | { |
561 | qDebug("ODevice::suspend"); | 561 | qDebug("ODevice::suspend"); |
562 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 562 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
563 | return false; | 563 | return false; |
564 | 564 | ||
565 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 565 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
566 | return false; | 566 | return false; |
567 | 567 | ||
568 | bool res = false; | 568 | bool res = false; |
569 | ODevice::sendSuspendmsg(); | ||
569 | 570 | ||
570 | struct timeval tvs, tvn; | 571 | struct timeval tvs, tvn; |
571 | ::gettimeofday ( &tvs, 0 ); | 572 | ::gettimeofday ( &tvs, 0 ); |
572 | 573 | ||
573 | ::sync(); // flush fs caches | 574 | ::sync(); // flush fs caches |
574 | res = ( ::system ( "apm --suspend" ) == 0 ); | 575 | res = ( ::system ( "apm --suspend" ) == 0 ); |
575 | 576 | ||
576 | // This is needed because the iPAQ apm implementation is asynchronous and we | 577 | // This is needed because the iPAQ apm implementation is asynchronous and we |
577 | // can not be sure when exactly the device is really suspended | 578 | // can not be sure when exactly the device is really suspended |
578 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 579 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
579 | 580 | ||
580 | if ( res ) { | 581 | if ( res ) { |
581 | do { // Yes, wait 15 seconds. This APM bug sucks big time. | 582 | do { // Yes, wait 15 seconds. This APM bug sucks big time. |
582 | ::usleep ( 200 * 1000 ); | 583 | ::usleep ( 200 * 1000 ); |
583 | ::gettimeofday ( &tvn, 0 ); | 584 | ::gettimeofday ( &tvn, 0 ); |
584 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); | 585 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); |
585 | } | 586 | } |
586 | 587 | ||
587 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); | 588 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); |
588 | return res; | 589 | return res; |
589 | } | 590 | } |
590 | 591 | ||
591 | 592 | ||
592 | Transformation Zaurus::rotation() const | 593 | Transformation Zaurus::rotation() const |