author | zecke <zecke> | 2004-09-21 16:47:16 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-21 16:47:16 (UTC) |
commit | 8d63da87b471780142f0d0431bbcb37c1afba646 (patch) (unidiff) | |
tree | 5cd367a8e33a5261fa3d9fe4397303967c13b0ab | |
parent | 2e877b93064d149ccafbbd86da55fbd244c3af4a (diff) | |
download | opie-8d63da87b471780142f0d0431bbcb37c1afba646.zip opie-8d63da87b471780142f0d0431bbcb37c1afba646.tar.gz opie-8d63da87b471780142f0d0431bbcb37c1afba646.tar.bz2 |
QT_NO_SOUND is defined at least on MacOS
so don't fail with error for them
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp index c75ea3a..a060695 100644 --- a/libopie2/opiecore/device/odevice_ramses.cpp +++ b/libopie2/opiecore/device/odevice_ramses.cpp | |||
@@ -1,170 +1,168 @@ | |||
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_ramses.h" | 30 | #include "odevice_ramses.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> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie::Core; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Internal; | 57 | using namespace Opie::Core::Internal; |
58 | 58 | ||
59 | 59 | ||
60 | void Ramses::init(const QString&) | 60 | void Ramses::init(const QString&) |
61 | { | 61 | { |
62 | d->m_vendorstr = "M und N"; | 62 | d->m_vendorstr = "M und N"; |
63 | d->m_vendor = Vendor_MundN; | 63 | d->m_vendor = Vendor_MundN; |
64 | 64 | ||
65 | // with old Prototype-LCD, /proc/sys/board/lcd_type = 1 | 65 | // with old Prototype-LCD, /proc/sys/board/lcd_type = 1 |
66 | //d->m_modelstr = "Ramses"; | 66 | //d->m_modelstr = "Ramses"; |
67 | //d->m_model = Model_Ramses_MNCI; | 67 | //d->m_model = Model_Ramses_MNCI; |
68 | //d->m_rotation = Rot0; | 68 | //d->m_rotation = Rot0; |
69 | 69 | ||
70 | // all current Hardware, with /proc/sys/board/lcd_type = 2 | 70 | // all current Hardware, with /proc/sys/board/lcd_type = 2 |
71 | d->m_modelstr = "MNCIRX"; | 71 | d->m_modelstr = "MNCIRX"; |
72 | d->m_model = Model_Ramses_MNCIRX; | 72 | d->m_model = Model_Ramses_MNCIRX; |
73 | d->m_rotation = Rot90; | 73 | d->m_rotation = Rot90; |
74 | 74 | ||
75 | d->m_holdtime = 500; | 75 | d->m_holdtime = 500; |
76 | 76 | ||
77 | 77 | ||
78 | // This table is true for a Intel XScale PXA 255 | 78 | // This table is true for a Intel XScale PXA 255 |
79 | 79 | ||
80 | #ifdef QT_QWS_ALLOW_OVERCLOCK | 80 | #ifdef QT_QWS_ALLOW_OVERCLOCK |
81 | #define OC(x...) x | 81 | #define OC(x...) x |
82 | #else | 82 | #else |
83 | #define OC(x...) | 83 | #define OC(x...) |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 | 86 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 |
87 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem | 87 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem |
88 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 | 88 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 |
89 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem | 89 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem |
90 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 | 90 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 |
91 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem | 91 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem |
92 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 | 92 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 |
93 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 | 93 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 |
94 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus | 94 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | void Ramses::playAlarmSound() | 98 | void Ramses::playAlarmSound() |
99 | { | 99 | { |
100 | #ifndef QT_NO_SOUND | 100 | #ifndef QT_NO_SOUND |
101 | static Sound snd ( "alarm" ); | 101 | static Sound snd ( "alarm" ); |
102 | if(!snd.isFinished()) | 102 | if(!snd.isFinished()) |
103 | return; | 103 | return; |
104 | 104 | ||
105 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); | 105 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); |
106 | snd.play(); | 106 | snd.play(); |
107 | #else | ||
108 | #error QT_NO_SOUND defined | ||
109 | #endif | 107 | #endif |
110 | } | 108 | } |
111 | 109 | ||
112 | 110 | ||
113 | bool Ramses::suspend() | 111 | bool Ramses::suspend() |
114 | { | 112 | { |
115 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 113 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
116 | return false; | 114 | return false; |
117 | 115 | ||
118 | sendSuspendmsg(); | 116 | sendSuspendmsg(); |
119 | ::sync(); | 117 | ::sync(); |
120 | 118 | ||
121 | int fd; | 119 | int fd; |
122 | if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { | 120 | if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) { |
123 | char writeCommand[] = "1\n"; | 121 | char writeCommand[] = "1\n"; |
124 | ::write(fd, writeCommand, sizeof(writeCommand) ); | 122 | ::write(fd, writeCommand, sizeof(writeCommand) ); |
125 | ::close(fd); | 123 | ::close(fd); |
126 | } | 124 | } |
127 | 125 | ||
128 | ::usleep ( 200 * 1000 ); | 126 | ::usleep ( 200 * 1000 ); |
129 | return true; | 127 | return true; |
130 | } | 128 | } |
131 | 129 | ||
132 | 130 | ||
133 | bool Ramses::setDisplayBrightness(int bright) | 131 | bool Ramses::setDisplayBrightness(int bright) |
134 | { | 132 | { |
135 | //qDebug("Ramses::setDisplayBrightness(%d)", bright); | 133 | //qDebug("Ramses::setDisplayBrightness(%d)", bright); |
136 | bool res = false; | 134 | bool res = false; |
137 | int fd; | 135 | int fd; |
138 | 136 | ||
139 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) | 137 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) |
140 | 138 | ||
141 | if (bright > 255 ) | 139 | if (bright > 255 ) |
142 | bright = 255; | 140 | bright = 255; |
143 | if (bright < 0) | 141 | if (bright < 0) |
144 | bright = 0; | 142 | bright = 0; |
145 | 143 | ||
146 | // Turn backlight completely off if brightness=0 | 144 | // Turn backlight completely off if brightness=0 |
147 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { | 145 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { |
148 | char writeCommand[10]; | 146 | char writeCommand[10]; |
149 | const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); | 147 | const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); |
150 | res = (::write(fd, writeCommand, count) != -1); | 148 | res = (::write(fd, writeCommand, count) != -1); |
151 | ::close(fd); | 149 | ::close(fd); |
152 | } | 150 | } |
153 | 151 | ||
154 | if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) { | 152 | if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) { |
155 | char writeCommand[10]; | 153 | char writeCommand[10]; |
156 | const int count = sprintf(writeCommand, "%d\n", bright); | 154 | const int count = sprintf(writeCommand, "%d\n", bright); |
157 | res = (::write(fd, writeCommand, count) != -1); | 155 | res = (::write(fd, writeCommand, count) != -1); |
158 | ::close(fd); | 156 | ::close(fd); |
159 | } | 157 | } |
160 | return res; | 158 | return res; |
161 | } | 159 | } |
162 | 160 | ||
163 | 161 | ||
164 | int Ramses::displayBrightnessResolution() const | 162 | int Ramses::displayBrightnessResolution() const |
165 | { | 163 | { |
166 | return 32; | 164 | return 32; |
167 | } | 165 | } |
168 | 166 | ||
169 | 167 | ||
170 | // TODO: add displayContrast for old MNCI | 168 | // TODO: add displayContrast for old MNCI |