author | paule <paule> | 2007-06-13 08:44:48 (UTC) |
---|---|---|
committer | paule <paule> | 2007-06-13 08:44:48 (UTC) |
commit | 4b3ffb4d533f034513d5bd9cae497aa117b2afaf (patch) (unidiff) | |
tree | 42d2d51f93eac1b0d53f626327f472a9a71de7b5 | |
parent | 85dfcf4f5e7fb28990606b83a02043af19a8c15d (diff) | |
download | opie-4b3ffb4d533f034513d5bd9cae497aa117b2afaf.zip opie-4b3ffb4d533f034513d5bd9cae497aa117b2afaf.tar.gz opie-4b3ffb4d533f034513d5bd9cae497aa117b2afaf.tar.bz2 |
Set vendor for HTC ODevice - patch by Marex (see bug #1855)
-rw-r--r-- | libopie2/opiecore/device/odevice_htc.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp index 7f82369..4bc8c49 100644 --- a/libopie2/opiecore/device/odevice_htc.cpp +++ b/libopie2/opiecore/device/odevice_htc.cpp | |||
@@ -1,607 +1,608 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
4 | =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 4 | =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
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; version 2 of the License. | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 12 | ._= =} : |
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_htc.h" | 30 | #include "odevice_htc.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/oinputsystem.h> | 33 | #include <opie2/oinputsystem.h> |
34 | #include <opie2/oresource.h> | 34 | #include <opie2/oresource.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/sound.h> | 37 | #include <qpe/sound.h> |
38 | 38 | ||
39 | /* QT */ | 39 | /* QT */ |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | #include <qwindowsystem_qws.h> | 43 | #include <qwindowsystem_qws.h> |
44 | #include <qcopchannel_qws.h> | 44 | #include <qcopchannel_qws.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | #include <string.h> | 47 | #include <string.h> |
48 | #include <errno.h> | 48 | #include <errno.h> |
49 | #include <fcntl.h> | 49 | #include <fcntl.h> |
50 | #include <math.h> | 50 | #include <math.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <signal.h> | 52 | #include <signal.h> |
53 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
54 | #include <sys/time.h> | 54 | #include <sys/time.h> |
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | #ifndef QT_NO_SOUND | 56 | #ifndef QT_NO_SOUND |
57 | #include <linux/soundcard.h> | 57 | #include <linux/soundcard.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | using namespace Opie::Core; | 60 | using namespace Opie::Core; |
61 | using namespace Opie::Core::Internal; | 61 | using namespace Opie::Core::Internal; |
62 | 62 | ||
63 | struct htc_button htc_buttons [] = { | 63 | struct htc_button htc_buttons [] = { |
64 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 64 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
65 | "devicebuttons/z_calendar", | 65 | "devicebuttons/z_calendar", |
66 | "datebook", "nextView()", | 66 | "datebook", "nextView()", |
67 | "today", "raise()" }, | 67 | "today", "raise()" }, |
68 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 68 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
69 | "devicebuttons/z_contact", | 69 | "devicebuttons/z_contact", |
70 | "addressbook", "raise()", | 70 | "addressbook", "raise()", |
71 | "addressbook", "beamBusinessCard()" }, | 71 | "addressbook", "beamBusinessCard()" }, |
72 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 72 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
73 | "devicebuttons/z_home", | 73 | "devicebuttons/z_home", |
74 | "QPE/Launcher", "home()", | 74 | "QPE/Launcher", "home()", |
75 | "buttonsettings", "raise()" }, | 75 | "buttonsettings", "raise()" }, |
76 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 76 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
77 | "devicebuttons/z_menu", | 77 | "devicebuttons/z_menu", |
78 | "QPE/TaskBar", "toggleMenu()", | 78 | "QPE/TaskBar", "toggleMenu()", |
79 | "QPE/TaskBar", "toggleStartMenu()" }, | 79 | "QPE/TaskBar", "toggleStartMenu()" }, |
80 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 80 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
81 | "devicebuttons/z_mail", | 81 | "devicebuttons/z_mail", |
82 | "opiemail", "raise()", | 82 | "opiemail", "raise()", |
83 | "opiemail", "newMail()" }, | 83 | "opiemail", "newMail()" }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct htc_button htc_buttons_universal [] = { | 86 | struct htc_button htc_buttons_universal [] = { |
87 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 87 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
88 | "devicebuttons/z_calendar", | 88 | "devicebuttons/z_calendar", |
89 | "datebook", "nextView()", | 89 | "datebook", "nextView()", |
90 | "today", "raise()" }, | 90 | "today", "raise()" }, |
91 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 91 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
92 | "devicebuttons/z_contact", | 92 | "devicebuttons/z_contact", |
93 | "addressbook", "raise()", | 93 | "addressbook", "raise()", |
94 | "addressbook", "beamBusinessCard()" }, | 94 | "addressbook", "beamBusinessCard()" }, |
95 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 95 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
96 | "devicebuttons/z_home", | 96 | "devicebuttons/z_home", |
97 | "QPE/Launcher", "home()", | 97 | "QPE/Launcher", "home()", |
98 | "buttonsettings", "raise()" }, | 98 | "buttonsettings", "raise()" }, |
99 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 99 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
100 | "devicebuttons/z_menu", | 100 | "devicebuttons/z_menu", |
101 | "QPE/TaskBar", "toggleMenu()", | 101 | "QPE/TaskBar", "toggleMenu()", |
102 | "QPE/TaskBar", "toggleStartMenu()" }, | 102 | "QPE/TaskBar", "toggleStartMenu()" }, |
103 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 103 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
104 | "devicebuttons/z_mail", | 104 | "devicebuttons/z_mail", |
105 | "opiemail", "raise()", | 105 | "opiemail", "raise()", |
106 | "opiemail", "newMail()" }, | 106 | "opiemail", "newMail()" }, |
107 | 107 | ||
108 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), | 108 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), |
109 | "devicebuttons/z_hinge1", | 109 | "devicebuttons/z_hinge1", |
110 | "QPE/Rotation", "rotateDefault()",0,0}, | 110 | "QPE/Rotation", "rotateDefault()",0,0}, |
111 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), | 111 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), |
112 | "devicebuttons/z_hinge2", | 112 | "devicebuttons/z_hinge2", |
113 | "QPE/Rotation", "rotateDefault()",0,0}, | 113 | "QPE/Rotation", "rotateDefault()",0,0}, |
114 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), | 114 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), |
115 | "devicebuttons/z_hinge3", | 115 | "devicebuttons/z_hinge3", |
116 | "QPE/Rotation", "rotateDefault()",0,0}, | 116 | "QPE/Rotation", "rotateDefault()",0,0}, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | 119 | ||
120 | // | 120 | // |
121 | // HTC-Universal (PXA-model w/ 480x640 3.6" lcd) | 121 | // HTC-Universal (PXA-model w/ 480x640 3.6" lcd) |
122 | // HTC-Alpine (PXA-model w/ 240x320 3.5" lcd) | 122 | // HTC-Alpine (PXA-model w/ 240x320 3.5" lcd) |
123 | // HTC-Apache (PXA-model w/ 240x320 2.8" lcd) | 123 | // HTC-Apache (PXA-model w/ 240x320 2.8" lcd) |
124 | // HTC-Beetles (PXA-model w/ 240x240 3.0" lcd) | 124 | // HTC-Beetles (PXA-model w/ 240x240 3.0" lcd) |
125 | // HTC-Blueangel (PXA-model w/ 240x320 3.5" lcd) | 125 | // HTC-Blueangel (PXA-model w/ 240x320 3.5" lcd) |
126 | // HTC-Himalaya (PXA-model w/ 240x320 3.5" lcd) | 126 | // HTC-Himalaya (PXA-model w/ 240x320 3.5" lcd) |
127 | // HTC-Magician (PXA-model w/ 240x320 2.8" lcd) | 127 | // HTC-Magician (PXA-model w/ 240x320 2.8" lcd) |
128 | 128 | ||
129 | void HTC::init(const QString& cpu_info) | 129 | void HTC::init(const QString& cpu_info) |
130 | { | 130 | { |
131 | qDebug( "HTC::init()" ); | 131 | qDebug( "HTC::init()" ); |
132 | // Set the time to wait until the system is really suspended | 132 | // Set the time to wait until the system is really suspended |
133 | // the delta between apm --suspend and sleeping | 133 | // the delta between apm --suspend and sleeping |
134 | setAPMTimeOut( 15000 ); | 134 | setAPMTimeOut( 15000 ); |
135 | 135 | ||
136 | d->m_vendorstr = "Xanadux Team"; | 136 | d->m_vendorstr = "Xanadux Team"; |
137 | d->m_vendor = Vendor_HTC; | ||
137 | d->m_systemstr = "Familiar"; | 138 | d->m_systemstr = "Familiar"; |
138 | d->m_system = System_Familiar; | 139 | d->m_system = System_Familiar; |
139 | 140 | ||
140 | // check the HTC model | 141 | // check the HTC model |
141 | QString model; | 142 | QString model; |
142 | int loc = cpu_info.find( ":" ); | 143 | int loc = cpu_info.find( ":" ); |
143 | if ( loc != -1 ) | 144 | if ( loc != -1 ) |
144 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 145 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
145 | else | 146 | else |
146 | model = cpu_info; | 147 | model = cpu_info; |
147 | 148 | ||
148 | d->m_model = Model_HTC_Universal; | 149 | d->m_model = Model_HTC_Universal; |
149 | d->m_modelstr = "Unknown HTC"; | 150 | d->m_modelstr = "Unknown HTC"; |
150 | 151 | ||
151 | if ( model == "HTC Universal" ) { | 152 | if ( model == "HTC Universal" ) { |
152 | d->m_model = Model_HTC_Universal; | 153 | d->m_model = Model_HTC_Universal; |
153 | d->m_modelstr = "HTC Universal"; | 154 | d->m_modelstr = "HTC Universal"; |
154 | } | 155 | } |
155 | if ( model == "HTC Alpine" ) { | 156 | if ( model == "HTC Alpine" ) { |
156 | d->m_model = Model_HTC_Alpine; | 157 | d->m_model = Model_HTC_Alpine; |
157 | d->m_modelstr = "HTC Alpine"; | 158 | d->m_modelstr = "HTC Alpine"; |
158 | } | 159 | } |
159 | if ( model == "HTC Apache" ) { | 160 | if ( model == "HTC Apache" ) { |
160 | d->m_model = Model_HTC_Apache; | 161 | d->m_model = Model_HTC_Apache; |
161 | d->m_modelstr = "HTC Apache"; | 162 | d->m_modelstr = "HTC Apache"; |
162 | } | 163 | } |
163 | if ( model == "HTC Beetles" ) { | 164 | if ( model == "HTC Beetles" ) { |
164 | d->m_model = Model_HTC_Beetles; | 165 | d->m_model = Model_HTC_Beetles; |
165 | d->m_modelstr = "HTC Beetles"; | 166 | d->m_modelstr = "HTC Beetles"; |
166 | } | 167 | } |
167 | if ( model == "HTC Blueangel" ) { | 168 | if ( model == "HTC Blueangel" ) { |
168 | d->m_model = Model_HTC_Blueangel; | 169 | d->m_model = Model_HTC_Blueangel; |
169 | d->m_modelstr = "HTC Blueangel"; | 170 | d->m_modelstr = "HTC Blueangel"; |
170 | } | 171 | } |
171 | if ( model == "HTC Himalaya" ) { | 172 | if ( model == "HTC Himalaya" ) { |
172 | d->m_model = Model_HTC_Himalaya; | 173 | d->m_model = Model_HTC_Himalaya; |
173 | d->m_modelstr = "HTC Himalaya"; | 174 | d->m_modelstr = "HTC Himalaya"; |
174 | } | 175 | } |
175 | if ( model == "HTC Magician" ) { | 176 | if ( model == "HTC Magician" ) { |
176 | d->m_model = Model_HTC_Magician; | 177 | d->m_model = Model_HTC_Magician; |
177 | d->m_modelstr = "HTC Magician"; | 178 | d->m_modelstr = "HTC Magician"; |
178 | } | 179 | } |
179 | 180 | ||
180 | 181 | ||
181 | // set path to backlight device | 182 | // set path to backlight device |
182 | switch ( d->m_model ) | 183 | switch ( d->m_model ) |
183 | { | 184 | { |
184 | case Model_HTC_Universal: | 185 | case Model_HTC_Universal: |
185 | case Model_HTC_Magician: | 186 | case Model_HTC_Magician: |
186 | case Model_HTC_Alpine: | 187 | case Model_HTC_Alpine: |
187 | case Model_HTC_Beetles: | 188 | case Model_HTC_Beetles: |
188 | case Model_HTC_Apache: | 189 | case Model_HTC_Apache: |
189 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | 190 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
190 | break; | 191 | break; |
191 | case Model_HTC_Blueangel: | 192 | case Model_HTC_Blueangel: |
192 | case Model_HTC_Himalaya: | 193 | case Model_HTC_Himalaya: |
193 | m_backlightdev = "/sys/class/backlight/w100fb/"; | 194 | m_backlightdev = "/sys/class/backlight/w100fb/"; |
194 | break; | 195 | break; |
195 | default: | 196 | default: |
196 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | 197 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; |
197 | } | 198 | } |
198 | 199 | ||
199 | // set initial rotation | 200 | // set initial rotation |
200 | switch( d->m_model ) | 201 | switch( d->m_model ) |
201 | { | 202 | { |
202 | case Model_HTC_Universal: | 203 | case Model_HTC_Universal: |
203 | initHingeSensor(); | 204 | initHingeSensor(); |
204 | d->m_rotation = rotation(); | 205 | d->m_rotation = rotation(); |
205 | d->m_direction = direction(); | 206 | d->m_direction = direction(); |
206 | break; | 207 | break; |
207 | default: | 208 | default: |
208 | d->m_rotation = Rot270; | 209 | d->m_rotation = Rot270; |
209 | } | 210 | } |
210 | 211 | ||
211 | // set default qte driver | 212 | // set default qte driver |
212 | switch( d->m_model ) | 213 | switch( d->m_model ) |
213 | { | 214 | { |
214 | default: | 215 | default: |
215 | d->m_qteDriver = "Transformed"; | 216 | d->m_qteDriver = "Transformed"; |
216 | } | 217 | } |
217 | 218 | ||
218 | m_leds[0] = Led_Off; | 219 | m_leds[0] = Led_Off; |
219 | 220 | ||
220 | qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr ); | 221 | qDebug( "HTC::init() - Using the 2.6 Xanadux on a %s", (const char*) d->m_modelstr ); |
221 | } | 222 | } |
222 | 223 | ||
223 | void HTC::initButtons() | 224 | void HTC::initButtons() |
224 | { | 225 | { |
225 | qDebug( "HTC::initButtons()" ); | 226 | qDebug( "HTC::initButtons()" ); |
226 | if ( d->m_buttons ) | 227 | if ( d->m_buttons ) |
227 | return; | 228 | return; |
228 | 229 | ||
229 | d->m_buttons = new QValueList <ODeviceButton>; | 230 | d->m_buttons = new QValueList <ODeviceButton>; |
230 | 231 | ||
231 | struct htc_button * phtc_buttons; | 232 | struct htc_button * phtc_buttons; |
232 | int buttoncount; | 233 | int buttoncount; |
233 | switch ( d->m_model ) | 234 | switch ( d->m_model ) |
234 | { | 235 | { |
235 | case Model_HTC_Universal: | 236 | case Model_HTC_Universal: |
236 | if ( isQWS( ) ) | 237 | if ( isQWS( ) ) |
237 | { | 238 | { |
238 | addPreHandler(this); | 239 | addPreHandler(this); |
239 | } | 240 | } |
240 | phtc_buttons = htc_buttons_universal; | 241 | phtc_buttons = htc_buttons_universal; |
241 | buttoncount = ARRAY_SIZE(htc_buttons_universal); | 242 | buttoncount = ARRAY_SIZE(htc_buttons_universal); |
242 | break; | 243 | break; |
243 | default: | 244 | default: |
244 | phtc_buttons = htc_buttons; | 245 | phtc_buttons = htc_buttons; |
245 | buttoncount = ARRAY_SIZE(htc_buttons); | 246 | buttoncount = ARRAY_SIZE(htc_buttons); |
246 | break; | 247 | break; |
247 | } | 248 | } |
248 | 249 | ||
249 | for ( int i = 0; i < buttoncount; i++ ) { | 250 | for ( int i = 0; i < buttoncount; i++ ) { |
250 | struct htc_button *zb = phtc_buttons + i; | 251 | struct htc_button *zb = phtc_buttons + i; |
251 | ODeviceButton b; | 252 | ODeviceButton b; |
252 | 253 | ||
253 | b.setKeycode( zb->code ); | 254 | b.setKeycode( zb->code ); |
254 | b.setUserText( QObject::tr( "Button", zb->utext )); | 255 | b.setUserText( QObject::tr( "Button", zb->utext )); |
255 | b.setPixmap( OResource::loadPixmap( zb->pix )); | 256 | b.setPixmap( OResource::loadPixmap( zb->pix )); |
256 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 257 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
257 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 258 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
258 | d->m_buttons->append( b ); | 259 | d->m_buttons->append( b ); |
259 | } | 260 | } |
260 | 261 | ||
261 | reloadButtonMapping(); | 262 | reloadButtonMapping(); |
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | ||
265 | 266 | ||
266 | typedef struct sharp_led_status { | 267 | typedef struct sharp_led_status { |
267 | int which; /* select which LED status is wanted. */ | 268 | int which; /* select which LED status is wanted. */ |
268 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 269 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
269 | } sharp_led_status; | 270 | } sharp_led_status; |
270 | 271 | ||
271 | void HTC::buzzer( int sound ) | 272 | void HTC::buzzer( int sound ) |
272 | { | 273 | { |
273 | #ifndef QT_NO_SOUND | 274 | #ifndef QT_NO_SOUND |
274 | Sound *snd = 0; | 275 | Sound *snd = 0; |
275 | 276 | ||
276 | // All devices except SL5500 have a DSP device | 277 | // All devices except SL5500 have a DSP device |
277 | if ( d->m_model == Model_HTC_Universal ) { | 278 | if ( d->m_model == Model_HTC_Universal ) { |
278 | 279 | ||
279 | switch ( sound ){ | 280 | switch ( sound ){ |
280 | case SHARP_BUZ_TOUCHSOUND: { | 281 | case SHARP_BUZ_TOUCHSOUND: { |
281 | static Sound touch_sound("touchsound"); | 282 | static Sound touch_sound("touchsound"); |
282 | snd = &touch_sound; | 283 | snd = &touch_sound; |
283 | } | 284 | } |
284 | break; | 285 | break; |
285 | case SHARP_BUZ_KEYSOUND: { | 286 | case SHARP_BUZ_KEYSOUND: { |
286 | static Sound key_sound( "keysound" ); | 287 | static Sound key_sound( "keysound" ); |
287 | snd = &key_sound; | 288 | snd = &key_sound; |
288 | } | 289 | } |
289 | break; | 290 | break; |
290 | case SHARP_BUZ_SCHEDULE_ALARM: | 291 | case SHARP_BUZ_SCHEDULE_ALARM: |
291 | default: { | 292 | default: { |
292 | static Sound alarm_sound("alarm"); | 293 | static Sound alarm_sound("alarm"); |
293 | snd = &alarm_sound; | 294 | snd = &alarm_sound; |
294 | } | 295 | } |
295 | break; | 296 | break; |
296 | } | 297 | } |
297 | } | 298 | } |
298 | 299 | ||
299 | // If a soundname is defined, we expect that this device has | 300 | // If a soundname is defined, we expect that this device has |
300 | // sound capabilities.. Otherwise we expect to have the buzzer | 301 | // sound capabilities.. Otherwise we expect to have the buzzer |
301 | // device.. | 302 | // device.. |
302 | if ( snd && snd->isFinished() ){ | 303 | if ( snd && snd->isFinished() ){ |
303 | changeMixerForAlarm( 0, "/dev/mixer", snd ); | 304 | changeMixerForAlarm( 0, "/dev/mixer", snd ); |
304 | snd->play(); | 305 | snd->play(); |
305 | } else if( !snd ) { | 306 | } else if( !snd ) { |
306 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 307 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
307 | 308 | ||
308 | if ( fd >= 0 ) { | 309 | if ( fd >= 0 ) { |
309 | if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1) | 310 | if (::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ) == -1) |
310 | qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)", | 311 | qWarning( "HTC::buzzer() - Couldn't make the buzzer buzz (%s)", |
311 | strerror( errno ) ); | 312 | strerror( errno ) ); |
312 | ::close ( fd ); | 313 | ::close ( fd ); |
313 | } | 314 | } |
314 | 315 | ||
315 | } | 316 | } |
316 | #endif | 317 | #endif |
317 | } | 318 | } |
318 | 319 | ||
319 | 320 | ||
320 | void HTC::playAlarmSound() | 321 | void HTC::playAlarmSound() |
321 | { | 322 | { |
322 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 323 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
323 | } | 324 | } |
324 | 325 | ||
325 | void HTC::playTouchSound() | 326 | void HTC::playTouchSound() |
326 | { | 327 | { |
327 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 328 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
328 | } | 329 | } |
329 | 330 | ||
330 | void HTC::playKeySound() | 331 | void HTC::playKeySound() |
331 | { | 332 | { |
332 | buzzer( SHARP_BUZ_KEYSOUND ); | 333 | buzzer( SHARP_BUZ_KEYSOUND ); |
333 | } | 334 | } |
334 | 335 | ||
335 | 336 | ||
336 | QValueList <OLed> HTC::ledList() const | 337 | QValueList <OLed> HTC::ledList() const |
337 | { | 338 | { |
338 | QValueList <OLed> vl; | 339 | QValueList <OLed> vl; |
339 | vl << Led_Mail; | 340 | vl << Led_Mail; |
340 | return vl; | 341 | return vl; |
341 | } | 342 | } |
342 | 343 | ||
343 | QValueList <OLedState> HTC::ledStateList( OLed l ) const | 344 | QValueList <OLedState> HTC::ledStateList( OLed l ) const |
344 | { | 345 | { |
345 | QValueList <OLedState> vl; | 346 | QValueList <OLedState> vl; |
346 | 347 | ||
347 | if ( l == Led_Mail ) | 348 | if ( l == Led_Mail ) |
348 | vl << Led_Off << Led_On << Led_BlinkSlow; | 349 | vl << Led_Off << Led_On << Led_BlinkSlow; |
349 | return vl; | 350 | return vl; |
350 | } | 351 | } |
351 | 352 | ||
352 | OLedState HTC::ledState( OLed which ) const | 353 | OLedState HTC::ledState( OLed which ) const |
353 | { | 354 | { |
354 | if ( which == Led_Mail ) | 355 | if ( which == Led_Mail ) |
355 | return m_leds [0]; | 356 | return m_leds [0]; |
356 | else | 357 | else |
357 | return Led_Off; | 358 | return Led_Off; |
358 | } | 359 | } |
359 | 360 | ||
360 | bool HTC::setLedState( OLed, OLedState ) | 361 | bool HTC::setLedState( OLed, OLedState ) |
361 | { | 362 | { |
362 | qDebug( "HTC::setLedState: ODevice handling not yet implemented" ); | 363 | qDebug( "HTC::setLedState: ODevice handling not yet implemented" ); |
363 | return false; | 364 | return false; |
364 | } | 365 | } |
365 | 366 | ||
366 | int HTC::displayBrightnessResolution() const | 367 | int HTC::displayBrightnessResolution() const |
367 | { | 368 | { |
368 | int res = 1; | 369 | int res = 1; |
369 | 370 | ||
370 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); | 371 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); |
371 | 372 | ||
372 | if ( fd ) | 373 | if ( fd ) |
373 | { | 374 | { |
374 | char buf[100]; | 375 | char buf[100]; |
375 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | 376 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); |
376 | ::close( fd ); | 377 | ::close( fd ); |
377 | } | 378 | } |
378 | 379 | ||
379 | return res; | 380 | return res; |
380 | } | 381 | } |
381 | 382 | ||
382 | bool HTC::setDisplayBrightness( int bright ) | 383 | bool HTC::setDisplayBrightness( int bright ) |
383 | { | 384 | { |
384 | 385 | ||
385 | //qDebug( "HTC::setDisplayBrightness( %d )", bright ); | 386 | //qDebug( "HTC::setDisplayBrightness( %d )", bright ); |
386 | bool res = false; | 387 | bool res = false; |
387 | 388 | ||
388 | if ( bright > 255 ) bright = 255; | 389 | if ( bright > 255 ) bright = 255; |
389 | if ( bright < 0 ) bright = 0; | 390 | if ( bright < 0 ) bright = 0; |
390 | 391 | ||
391 | int numberOfSteps = displayBrightnessResolution(); | 392 | int numberOfSteps = displayBrightnessResolution(); |
392 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 393 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
393 | 394 | ||
394 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | 395 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
395 | if ( fd ) | 396 | if ( fd ) |
396 | { | 397 | { |
397 | char buf[100]; | 398 | char buf[100]; |
398 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 399 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
399 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 400 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
400 | ::close( fd ); | 401 | ::close( fd ); |
401 | } | 402 | } |
402 | return res; | 403 | return res; |
403 | } | 404 | } |
404 | 405 | ||
405 | bool HTC::setDisplayStatus( bool on ) | 406 | bool HTC::setDisplayStatus( bool on ) |
406 | { | 407 | { |
407 | 408 | ||
408 | bool res = false; | 409 | bool res = false; |
409 | 410 | ||
410 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); | 411 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); |
411 | if ( fd ) | 412 | if ( fd ) |
412 | { | 413 | { |
413 | char buf[10]; | 414 | char buf[10]; |
414 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 415 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
415 | buf[1] = '\0'; | 416 | buf[1] = '\0'; |
416 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 417 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
417 | ::close( fd ); | 418 | ::close( fd ); |
418 | } | 419 | } |
419 | return res; | 420 | return res; |
420 | } | 421 | } |
421 | 422 | ||
422 | Transformation HTC::rotation() const | 423 | Transformation HTC::rotation() const |
423 | { | 424 | { |
424 | qDebug( "HTC::rotation()" ); | 425 | qDebug( "HTC::rotation()" ); |
425 | Transformation rot = Rot270; | 426 | Transformation rot = Rot270; |
426 | 427 | ||
427 | switch ( d->m_model ) { | 428 | switch ( d->m_model ) { |
428 | case Model_HTC_Universal: | 429 | case Model_HTC_Universal: |
429 | { | 430 | { |
430 | OHingeStatus hs = readHingeSensor(); | 431 | OHingeStatus hs = readHingeSensor(); |
431 | qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); | 432 | qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); |
432 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 433 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
433 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; | 434 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; |
434 | } | 435 | } |
435 | break; | 436 | break; |
436 | default: | 437 | default: |
437 | break; | 438 | break; |
438 | } | 439 | } |
439 | 440 | ||
440 | qDebug( "HTC::rotation() - returning '%d'", rot ); | 441 | qDebug( "HTC::rotation() - returning '%d'", rot ); |
441 | return rot; | 442 | return rot; |
442 | } | 443 | } |
443 | ODirection HTC::direction() const | 444 | ODirection HTC::direction() const |
444 | { | 445 | { |
445 | ODirection dir; | 446 | ODirection dir; |
446 | 447 | ||
447 | switch ( d->m_model ) { | 448 | switch ( d->m_model ) { |
448 | case Model_HTC_Universal: { | 449 | case Model_HTC_Universal: { |
449 | OHingeStatus hs = readHingeSensor(); | 450 | OHingeStatus hs = readHingeSensor(); |
450 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 451 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
451 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 452 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
452 | else dir = CW; | 453 | else dir = CW; |
453 | } | 454 | } |
454 | break; | 455 | break; |
455 | default: dir = d->m_direction; | 456 | default: dir = d->m_direction; |
456 | break; | 457 | break; |
457 | } | 458 | } |
458 | return dir; | 459 | return dir; |
459 | 460 | ||
460 | } | 461 | } |
461 | 462 | ||
462 | bool HTC::hasHingeSensor() const | 463 | bool HTC::hasHingeSensor() const |
463 | { | 464 | { |
464 | return d->m_model == Model_HTC_Universal; | 465 | return d->m_model == Model_HTC_Universal; |
465 | } | 466 | } |
466 | 467 | ||
467 | OHingeStatus HTC::readHingeSensor() const | 468 | OHingeStatus HTC::readHingeSensor() const |
468 | { | 469 | { |
469 | /* | 470 | /* |
470 | * The HTC Universal keyboard is event source 1 in kernel 2.6. | 471 | * The HTC Universal keyboard is event source 1 in kernel 2.6. |
471 | * Hinge status is reported via Input System Switchs 0 and 1 like that: | 472 | * Hinge status is reported via Input System Switchs 0 and 1 like that: |
472 | * | 473 | * |
473 | * ------------------------- | 474 | * ------------------------- |
474 | * | SW0 | SW1 | CASE | | 475 | * | SW0 | SW1 | CASE | |
475 | * |-----|-----|-----------| | 476 | * |-----|-----|-----------| |
476 | * | 0 0 Unknown | | 477 | * | 0 0 Unknown | |
477 | * | 1 0 Portrait | | 478 | * | 1 0 Portrait | |
478 | * | 0 1 Closed | | 479 | * | 0 1 Closed | |
479 | * | 1 1 Landscape | | 480 | * | 1 1 Landscape | |
480 | * ------------------------- | 481 | * ------------------------- |
481 | */ | 482 | */ |
482 | OInputDevice* keyboard = OInputSystem::instance()->device( "event1" ); | 483 | OInputDevice* keyboard = OInputSystem::instance()->device( "event1" ); |
483 | bool switch0 = true; | 484 | bool switch0 = true; |
484 | bool switch1 = false; | 485 | bool switch1 = false; |
485 | if ( keyboard ) | 486 | if ( keyboard ) |
486 | { | 487 | { |
487 | switch0 = keyboard->isHeld( OInputDevice::Switch0 ); | 488 | switch0 = keyboard->isHeld( OInputDevice::Switch0 ); |
488 | switch1 = keyboard->isHeld( OInputDevice::Switch1 ); | 489 | switch1 = keyboard->isHeld( OInputDevice::Switch1 ); |
489 | } | 490 | } |
490 | if ( switch0 ) | 491 | if ( switch0 ) |
491 | { | 492 | { |
492 | return switch1 ? CASE_LANDSCAPE : CASE_PORTRAIT; | 493 | return switch1 ? CASE_LANDSCAPE : CASE_PORTRAIT; |
493 | } | 494 | } |
494 | else | 495 | else |
495 | { | 496 | { |
496 | return switch1 ? CASE_CLOSED : CASE_UNKNOWN; | 497 | return switch1 ? CASE_CLOSED : CASE_UNKNOWN; |
497 | } | 498 | } |
498 | } | 499 | } |
499 | 500 | ||
500 | void HTC::initHingeSensor() | 501 | void HTC::initHingeSensor() |
501 | { | 502 | { |
502 | if ( m_embedix ) return; | 503 | if ( m_embedix ) return; |
503 | 504 | ||
504 | m_hinge.setName( "/dev/input/event1" ); | 505 | m_hinge.setName( "/dev/input/event1" ); |
505 | if ( !m_hinge.open( IO_ReadOnly ) ) | 506 | if ( !m_hinge.open( IO_ReadOnly ) ) |
506 | { | 507 | { |
507 | qWarning( "HTC::init() - Couldn't open /dev/input/event1 for read (%s)", strerror( errno ) ); | 508 | qWarning( "HTC::init() - Couldn't open /dev/input/event1 for read (%s)", strerror( errno ) ); |
508 | return; | 509 | return; |
509 | } | 510 | } |
510 | 511 | ||
511 | QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); | 512 | QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); |
512 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); | 513 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); |
513 | 514 | ||
514 | qDebug( "HTC::init() - Hinge Sensor Initialization successfully completed" ); | 515 | qDebug( "HTC::init() - Hinge Sensor Initialization successfully completed" ); |
515 | } | 516 | } |
516 | 517 | ||
517 | void HTC::hingeSensorTriggered() | 518 | void HTC::hingeSensorTriggered() |
518 | { | 519 | { |
519 | qDebug( "HTC::hingeSensorTriggered() - got event" ); | 520 | qDebug( "HTC::hingeSensorTriggered() - got event" ); |
520 | struct input_event e; | 521 | struct input_event e; |
521 | if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 ) | 522 | if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 ) |
522 | { | 523 | { |
523 | qDebug( "HTC::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value ); | 524 | qDebug( "HTC::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value ); |
524 | if ( e.type != EV_SW ) return; | 525 | if ( e.type != EV_SW ) return; |
525 | if ( readHingeSensor() != CASE_UNKNOWN ) | 526 | if ( readHingeSensor() != CASE_UNKNOWN ) |
526 | { | 527 | { |
527 | qDebug( "HTC::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); | 528 | qDebug( "HTC::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); |
528 | QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); | 529 | QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); |
529 | } | 530 | } |
530 | } | 531 | } |
531 | } | 532 | } |
532 | 533 | ||
533 | void HTC::systemMessage( const QCString &msg, const QByteArray & ) | 534 | void HTC::systemMessage( const QCString &msg, const QByteArray & ) |
534 | { | 535 | { |
535 | if ( msg == "deviceButtonMappingChanged()" ) { | 536 | if ( msg == "deviceButtonMappingChanged()" ) { |
536 | reloadButtonMapping(); | 537 | reloadButtonMapping(); |
537 | } | 538 | } |
538 | } | 539 | } |
539 | 540 | ||
540 | /* | 541 | /* |
541 | * Take code from iPAQ device. | 542 | * Take code from iPAQ device. |
542 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. | 543 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. |
543 | * I hope that is ok - Alwin | 544 | * I hope that is ok - Alwin |
544 | */ | 545 | */ |
545 | bool HTC::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 546 | bool HTC::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
546 | { | 547 | { |
547 | int newkeycode = keycode; | 548 | int newkeycode = keycode; |
548 | 549 | ||
549 | if ( !hasHingeSensor() ) return false; | 550 | if ( !hasHingeSensor() ) return false; |
550 | 551 | ||
551 | /* map cursor keys depending on the hinge status */ | 552 | /* map cursor keys depending on the hinge status */ |
552 | switch ( keycode ) { | 553 | switch ( keycode ) { |
553 | // Rotate cursor keys | 554 | // Rotate cursor keys |
554 | case Key_Left : | 555 | case Key_Left : |
555 | case Key_Right: | 556 | case Key_Right: |
556 | case Key_Up : | 557 | case Key_Up : |
557 | case Key_Down : | 558 | case Key_Down : |
558 | { | 559 | { |
559 | if (rotation()==Rot90) { | 560 | if (rotation()==Rot90) { |
560 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 561 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
561 | } | 562 | } |
562 | } | 563 | } |
563 | break; | 564 | break; |
564 | 565 | ||
565 | } | 566 | } |
566 | if (newkeycode!=keycode) { | 567 | if (newkeycode!=keycode) { |
567 | if ( newkeycode != Key_unknown ) { | 568 | if ( newkeycode != Key_unknown ) { |
568 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 569 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
569 | } | 570 | } |
570 | return true; | 571 | return true; |
571 | } | 572 | } |
572 | return false; | 573 | return false; |
573 | } | 574 | } |
574 | 575 | ||
575 | bool HTC::suspend() { | 576 | bool HTC::suspend() { |
576 | 577 | ||
577 | /* MV */ | 578 | /* MV */ |
578 | return false; | 579 | return false; |
579 | 580 | ||
580 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 581 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
581 | return false; | 582 | return false; |
582 | 583 | ||
583 | bool res = false; | 584 | bool res = false; |
584 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); | 585 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); |
585 | 586 | ||
586 | struct timeval tvs, tvn; | 587 | struct timeval tvs, tvn; |
587 | ::gettimeofday ( &tvs, 0 ); | 588 | ::gettimeofday ( &tvs, 0 ); |
588 | 589 | ||
589 | ::sync(); // flush fs caches | 590 | ::sync(); // flush fs caches |
590 | res = ( ::system ( "apm --suspend" ) == 0 ); | 591 | res = ( ::system ( "apm --suspend" ) == 0 ); |
591 | 592 | ||
592 | // This is needed because some apm implementations are asynchronous and we | 593 | // This is needed because some apm implementations are asynchronous and we |
593 | // can not be sure when exactly the device is really suspended | 594 | // can not be sure when exactly the device is really suspended |
594 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 595 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
595 | // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here. | 596 | // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here. |
596 | 597 | ||
597 | if ( res && m_embedix) { | 598 | if ( res && m_embedix) { |
598 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 599 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
599 | ::usleep ( 200 * 1000 ); | 600 | ::usleep ( 200 * 1000 ); |
600 | ::gettimeofday ( &tvn, 0 ); | 601 | ::gettimeofday ( &tvn, 0 ); |
601 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); | 602 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); |
602 | } | 603 | } |
603 | 604 | ||
604 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); | 605 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); |
605 | 606 | ||
606 | return res; | 607 | return res; |
607 | } | 608 | } |