author | schurig <schurig> | 2004-09-08 14:37:07 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-08 14:37:07 (UTC) |
commit | 548f5017a18a0d574baadfb3f063f734db13944a (patch) (unidiff) | |
tree | 04b0f1958f767455496375945b15e9fe898b759c | |
parent | 409d1470e28bfaf9a8de34f231a3d6e0ff0b090d (diff) | |
download | opie-548f5017a18a0d574baadfb3f063f734db13944a.zip opie-548f5017a18a0d574baadfb3f063f734db13944a.tar.gz opie-548f5017a18a0d574baadfb3f063f734db13944a.tar.bz2 |
default rotation is now 90
-rw-r--r-- | libopie/odevice.cpp | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 4258d60..013f804 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -116,601 +116,579 @@ public: | |||
116 | virtual bool setSoftSuspend ( bool soft ); | 116 | virtual bool setSoftSuspend ( bool soft ); |
117 | virtual bool setDisplayBrightness ( int b ); | 117 | virtual bool setDisplayBrightness ( int b ); |
118 | virtual int displayBrightnessResolution ( ) const; | 118 | virtual int displayBrightnessResolution ( ) const; |
119 | static bool isJornada(); | 119 | static bool isJornada(); |
120 | 120 | ||
121 | }; | 121 | }; |
122 | 122 | ||
123 | class Zaurus : public ODevice { | 123 | class Zaurus : public ODevice { |
124 | protected: | 124 | protected: |
125 | virtual void init ( ); | 125 | virtual void init ( ); |
126 | virtual void initButtons ( ); | 126 | virtual void initButtons ( ); |
127 | 127 | ||
128 | public: | 128 | public: |
129 | virtual bool setSoftSuspend ( bool soft ); | 129 | virtual bool setSoftSuspend ( bool soft ); |
130 | 130 | ||
131 | virtual bool setDisplayBrightness ( int b ); | 131 | virtual bool setDisplayBrightness ( int b ); |
132 | virtual int displayBrightnessResolution ( ) const; | 132 | virtual int displayBrightnessResolution ( ) const; |
133 | 133 | ||
134 | virtual void alarmSound ( ); | 134 | virtual void alarmSound ( ); |
135 | virtual void keySound ( ); | 135 | virtual void keySound ( ); |
136 | virtual void touchSound ( ); | 136 | virtual void touchSound ( ); |
137 | 137 | ||
138 | virtual QValueList <OLed> ledList ( ) const; | 138 | virtual QValueList <OLed> ledList ( ) const; |
139 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 139 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
140 | virtual OLedState ledState ( OLed led ) const; | 140 | virtual OLedState ledState ( OLed led ) const; |
141 | virtual bool setLedState ( OLed led, OLedState st ); | 141 | virtual bool setLedState ( OLed led, OLedState st ); |
142 | 142 | ||
143 | bool hasHingeSensor() const; | 143 | bool hasHingeSensor() const; |
144 | OHingeStatus readHingeSensor(); | 144 | OHingeStatus readHingeSensor(); |
145 | 145 | ||
146 | static bool isZaurus(); | 146 | static bool isZaurus(); |
147 | 147 | ||
148 | // Does this break BC? | 148 | // Does this break BC? |
149 | virtual bool suspend ( ); | 149 | virtual bool suspend ( ); |
150 | Transformation rotation ( ) const; | 150 | Transformation rotation ( ) const; |
151 | ODirection direction ( ) const; | 151 | ODirection direction ( ) const; |
152 | 152 | ||
153 | protected: | 153 | protected: |
154 | virtual void buzzer ( int snd ); | 154 | virtual void buzzer ( int snd ); |
155 | 155 | ||
156 | OLedState m_leds [1]; | 156 | OLedState m_leds [1]; |
157 | bool m_embedix; | 157 | bool m_embedix; |
158 | void virtual_hook( int id, void *data ); | 158 | void virtual_hook( int id, void *data ); |
159 | }; | 159 | }; |
160 | 160 | ||
161 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { | 161 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { |
162 | protected: | 162 | protected: |
163 | virtual void init ( ); | 163 | virtual void init ( ); |
164 | virtual void initButtons ( ); | 164 | virtual void initButtons ( ); |
165 | 165 | ||
166 | public: | 166 | public: |
167 | virtual bool setSoftSuspend ( bool soft ); | 167 | virtual bool setSoftSuspend ( bool soft ); |
168 | virtual bool suspend(); | 168 | virtual bool suspend(); |
169 | 169 | ||
170 | virtual bool setDisplayStatus( bool on ); | 170 | virtual bool setDisplayStatus( bool on ); |
171 | virtual bool setDisplayBrightness ( int b ); | 171 | virtual bool setDisplayBrightness ( int b ); |
172 | virtual int displayBrightnessResolution ( ) const; | 172 | virtual int displayBrightnessResolution ( ) const; |
173 | 173 | ||
174 | virtual void alarmSound ( ); | 174 | virtual void alarmSound ( ); |
175 | 175 | ||
176 | virtual QValueList <OLed> ledList ( ) const; | 176 | virtual QValueList <OLed> ledList ( ) const; |
177 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 177 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
178 | virtual OLedState ledState ( OLed led ) const; | 178 | virtual OLedState ledState ( OLed led ) const; |
179 | virtual bool setLedState ( OLed led, OLedState st ); | 179 | virtual bool setLedState ( OLed led, OLedState st ); |
180 | 180 | ||
181 | protected: | 181 | protected: |
182 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 182 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
183 | virtual void timerEvent ( QTimerEvent *te ); | 183 | virtual void timerEvent ( QTimerEvent *te ); |
184 | 184 | ||
185 | int m_power_timer; | 185 | int m_power_timer; |
186 | 186 | ||
187 | OLedState m_leds [1]; //FIXME check if really only one | 187 | OLedState m_leds [1]; //FIXME check if really only one |
188 | }; | 188 | }; |
189 | 189 | ||
190 | class Ramses : public ODevice, public QWSServer::KeyboardFilter { | 190 | class Ramses : public ODevice, public QWSServer::KeyboardFilter { |
191 | protected: | 191 | protected: |
192 | virtual void init ( ); | 192 | virtual void init ( ); |
193 | 193 | ||
194 | public: | 194 | public: |
195 | virtual bool setSoftSuspend ( bool soft ); | 195 | virtual bool setSoftSuspend ( bool soft ); |
196 | virtual bool suspend ( ); | 196 | virtual bool suspend ( ); |
197 | 197 | ||
198 | virtual bool setDisplayStatus( bool on ); | 198 | virtual bool setDisplayStatus( bool on ); |
199 | virtual bool setDisplayBrightness ( int b ); | 199 | virtual bool setDisplayBrightness ( int b ); |
200 | virtual int displayBrightnessResolution ( ) const; | 200 | virtual int displayBrightnessResolution ( ) const; |
201 | virtual bool setDisplayContrast ( int b ); | 201 | virtual bool setDisplayContrast ( int b ); |
202 | virtual int displayContrastResolution ( ) const; | 202 | virtual int displayContrastResolution ( ) const; |
203 | 203 | ||
204 | protected: | 204 | protected: |
205 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 205 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
206 | virtual void timerEvent ( QTimerEvent *te ); | 206 | virtual void timerEvent ( QTimerEvent *te ); |
207 | 207 | ||
208 | int m_power_timer; | 208 | int m_power_timer; |
209 | }; | 209 | }; |
210 | 210 | ||
211 | struct i_button { | 211 | struct i_button { |
212 | uint model; | 212 | uint model; |
213 | Qt::Key code; | 213 | Qt::Key code; |
214 | char *utext; | 214 | char *utext; |
215 | char *pix; | 215 | char *pix; |
216 | char *fpressedservice; | 216 | char *fpressedservice; |
217 | char *fpressedaction; | 217 | char *fpressedaction; |
218 | char *fheldservice; | 218 | char *fheldservice; |
219 | char *fheldaction; | 219 | char *fheldaction; |
220 | } ipaq_buttons [] = { | 220 | } ipaq_buttons [] = { |
221 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 221 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
222 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 222 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
223 | "devicebuttons/ipaq_calendar", | 223 | "devicebuttons/ipaq_calendar", |
224 | "datebook", "nextView()", | 224 | "datebook", "nextView()", |
225 | "today", "raise()" }, | 225 | "today", "raise()" }, |
226 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 226 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
227 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 227 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
228 | "devicebuttons/ipaq_contact", | 228 | "devicebuttons/ipaq_contact", |
229 | "addressbook", "raise()", | 229 | "addressbook", "raise()", |
230 | "addressbook", "beamBusinessCard()" }, | 230 | "addressbook", "beamBusinessCard()" }, |
231 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 231 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
232 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 232 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
233 | "devicebuttons/ipaq_menu", | 233 | "devicebuttons/ipaq_menu", |
234 | "QPE/TaskBar", "toggleMenu()", | 234 | "QPE/TaskBar", "toggleMenu()", |
235 | "QPE/TaskBar", "toggleStartMenu()" }, | 235 | "QPE/TaskBar", "toggleStartMenu()" }, |
236 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 236 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
237 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 237 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
238 | "devicebuttons/ipaq_mail", | 238 | "devicebuttons/ipaq_mail", |
239 | "mail", "raise()", | 239 | "mail", "raise()", |
240 | "mail", "newMail()" }, | 240 | "mail", "newMail()" }, |
241 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 241 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
242 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 242 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
243 | "devicebuttons/ipaq_home", | 243 | "devicebuttons/ipaq_home", |
244 | "QPE/Launcher", "home()", | 244 | "QPE/Launcher", "home()", |
245 | "buttonsettings", "raise()" }, | 245 | "buttonsettings", "raise()" }, |
246 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 246 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
247 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 247 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
248 | "devicebuttons/ipaq_record", | 248 | "devicebuttons/ipaq_record", |
249 | "QPE/VMemo", "toggleRecord()", | 249 | "QPE/VMemo", "toggleRecord()", |
250 | "sound", "raise()" }, | 250 | "sound", "raise()" }, |
251 | }; | 251 | }; |
252 | 252 | ||
253 | struct z_button { | 253 | struct z_button { |
254 | Qt::Key code; | 254 | Qt::Key code; |
255 | char *utext; | 255 | char *utext; |
256 | char *pix; | 256 | char *pix; |
257 | char *fpressedservice; | 257 | char *fpressedservice; |
258 | char *fpressedaction; | 258 | char *fpressedaction; |
259 | char *fheldservice; | 259 | char *fheldservice; |
260 | char *fheldaction; | 260 | char *fheldaction; |
261 | } z_buttons [] = { | 261 | } z_buttons [] = { |
262 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 262 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
263 | "devicebuttons/z_calendar", | 263 | "devicebuttons/z_calendar", |
264 | "datebook", "nextView()", | 264 | "datebook", "nextView()", |
265 | "today", "raise()" }, | 265 | "today", "raise()" }, |
266 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 266 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
267 | "devicebuttons/z_contact", | 267 | "devicebuttons/z_contact", |
268 | "addressbook", "raise()", | 268 | "addressbook", "raise()", |
269 | "addressbook", "beamBusinessCard()" }, | 269 | "addressbook", "beamBusinessCard()" }, |
270 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 270 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
271 | "devicebuttons/z_home", | 271 | "devicebuttons/z_home", |
272 | "QPE/Launcher", "home()", | 272 | "QPE/Launcher", "home()", |
273 | "buttonsettings", "raise()" }, | 273 | "buttonsettings", "raise()" }, |
274 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 274 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
275 | "devicebuttons/z_menu", | 275 | "devicebuttons/z_menu", |
276 | "QPE/TaskBar", "toggleMenu()", | 276 | "QPE/TaskBar", "toggleMenu()", |
277 | "QPE/TaskBar", "toggleStartMenu()" }, | 277 | "QPE/TaskBar", "toggleStartMenu()" }, |
278 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 278 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
279 | "devicebuttons/z_mail", | 279 | "devicebuttons/z_mail", |
280 | "mail", "raise()", | 280 | "mail", "raise()", |
281 | "mail", "newMail()" }, | 281 | "mail", "newMail()" }, |
282 | }; | 282 | }; |
283 | 283 | ||
284 | struct z_button z_buttons_c700 [] = { | 284 | struct z_button z_buttons_c700 [] = { |
285 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 285 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
286 | "devicebuttons/z_calendar", | 286 | "devicebuttons/z_calendar", |
287 | "datebook", "nextView()", | 287 | "datebook", "nextView()", |
288 | "today", "raise()" }, | 288 | "today", "raise()" }, |
289 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 289 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
290 | "devicebuttons/z_contact", | 290 | "devicebuttons/z_contact", |
291 | "addressbook", "raise()", | 291 | "addressbook", "raise()", |
292 | "addressbook", "beamBusinessCard()" }, | 292 | "addressbook", "beamBusinessCard()" }, |
293 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 293 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
294 | "devicebuttons/z_home", | 294 | "devicebuttons/z_home", |
295 | "QPE/Launcher", "home()", | 295 | "QPE/Launcher", "home()", |
296 | "buttonsettings", "raise()" }, | 296 | "buttonsettings", "raise()" }, |
297 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 297 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
298 | "devicebuttons/z_menu", | 298 | "devicebuttons/z_menu", |
299 | "QPE/TaskBar", "toggleMenu()", | 299 | "QPE/TaskBar", "toggleMenu()", |
300 | "QPE/TaskBar", "toggleStartMenu()" }, | 300 | "QPE/TaskBar", "toggleStartMenu()" }, |
301 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 301 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
302 | "devicebuttons/z_hinge", | 302 | "devicebuttons/z_hinge", |
303 | "QPE/Rotation", "rotateDefault()", | 303 | "QPE/Rotation", "rotateDefault()", |
304 | "QPE/Dummy", "doNothing()" }, | 304 | "QPE/Dummy", "doNothing()" }, |
305 | }; | 305 | }; |
306 | 306 | ||
307 | struct s_button { | 307 | struct s_button { |
308 | uint model; | 308 | uint model; |
309 | Qt::Key code; | 309 | Qt::Key code; |
310 | char *utext; | 310 | char *utext; |
311 | char *pix; | 311 | char *pix; |
312 | char *fpressedservice; | 312 | char *fpressedservice; |
313 | char *fpressedaction; | 313 | char *fpressedaction; |
314 | char *fheldservice; | 314 | char *fheldservice; |
315 | char *fheldaction; | 315 | char *fheldaction; |
316 | } simpad_buttons [] = { | 316 | } simpad_buttons [] = { |
317 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 317 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
318 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 318 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
319 | "devicebuttons/simpad_lower_up", | 319 | "devicebuttons/simpad_lower_up", |
320 | "datebook", "nextView()", | 320 | "datebook", "nextView()", |
321 | "today", "raise()" }, | 321 | "today", "raise()" }, |
322 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 322 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
323 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), | 323 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
324 | "devicebuttons/simpad_lower_down", | 324 | "devicebuttons/simpad_lower_down", |
325 | "addressbook", "raise()", | 325 | "addressbook", "raise()", |
326 | "addressbook", "beamBusinessCard()" }, | 326 | "addressbook", "beamBusinessCard()" }, |
327 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 327 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
328 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), | 328 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), |
329 | "devicebuttons/simpad_lower_right", | 329 | "devicebuttons/simpad_lower_right", |
330 | "QPE/TaskBar", "toggleMenu()", | 330 | "QPE/TaskBar", "toggleMenu()", |
331 | "QPE/TaskBar", "toggleStartMenu()" }, | 331 | "QPE/TaskBar", "toggleStartMenu()" }, |
332 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 332 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
333 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), | 333 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), |
334 | "devicebuttons/simpad_lower_left", | 334 | "devicebuttons/simpad_lower_left", |
335 | "mail", "raise()", | 335 | "mail", "raise()", |
336 | "mail", "newMail()" }, | 336 | "mail", "newMail()" }, |
337 | 337 | ||
338 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 338 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
339 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), | 339 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), |
340 | "devicebuttons/simpad_upper_up", | 340 | "devicebuttons/simpad_upper_up", |
341 | "QPE/Launcher", "home()", | 341 | "QPE/Launcher", "home()", |
342 | "buttonsettings", "raise()" }, | 342 | "buttonsettings", "raise()" }, |
343 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 343 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
344 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), | 344 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), |
345 | "devicebuttons/simpad_upper_down", | 345 | "devicebuttons/simpad_upper_down", |
346 | "addressbook", "raise()", | 346 | "addressbook", "raise()", |
347 | "addressbook", "beamBusinessCard()" }, | 347 | "addressbook", "beamBusinessCard()" }, |
348 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 348 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
349 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), | 349 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), |
350 | "devicebuttons/simpad_upper_right", | 350 | "devicebuttons/simpad_upper_right", |
351 | "QPE/TaskBar", "toggleMenu()", | 351 | "QPE/TaskBar", "toggleMenu()", |
352 | "QPE/TaskBar", "toggleStartMenu()" }, | 352 | "QPE/TaskBar", "toggleStartMenu()" }, |
353 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 353 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
354 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | 354 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), |
355 | "devicebuttons/simpad_upper_left", | 355 | "devicebuttons/simpad_upper_left", |
356 | "QPE/Rotation", "flip()", | 356 | "QPE/Rotation", "flip()", |
357 | "QPE/Rotation", "flip()" }, | 357 | "QPE/Rotation", "flip()" }, |
358 | /* | 358 | /* |
359 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 359 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
360 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 360 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
361 | "devicebuttons/simpad_lower_upper", | 361 | "devicebuttons/simpad_lower_upper", |
362 | "QPE/Launcher", "home()", | 362 | "QPE/Launcher", "home()", |
363 | "buttonsettings", "raise()" }, | 363 | "buttonsettings", "raise()" }, |
364 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 364 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
365 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 365 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
366 | "devicebuttons/simpad_upper_lower", | 366 | "devicebuttons/simpad_upper_lower", |
367 | "QPE/Launcher", "home()", | 367 | "QPE/Launcher", "home()", |
368 | "buttonsettings", "raise()" }, | 368 | "buttonsettings", "raise()" }, |
369 | */ | 369 | */ |
370 | }; | 370 | }; |
371 | 371 | ||
372 | struct r_button { | ||
373 | uint model; | ||
374 | Qt::Key code; | ||
375 | char *utext; | ||
376 | char *pix; | ||
377 | char *fpressedservice; | ||
378 | char *fpressedaction; | ||
379 | char *fheldservice; | ||
380 | char *fheldaction; | ||
381 | } ramses_buttons [] = { | ||
382 | { Model_Ramses_MNCI, | ||
383 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | ||
384 | "devicebuttons/z_menu", | ||
385 | "QPE/TaskBar", "toggleMenu()", | ||
386 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
387 | { Model_Ramses_MNCI, | ||
388 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | ||
389 | "devicebuttons/ipaq_home", | ||
390 | "QPE/Launcher", "home()", | ||
391 | "buttonsettings", "raise()" }, | ||
392 | }; | ||
393 | |||
394 | class Yopy : public ODevice { | 372 | class Yopy : public ODevice { |
395 | protected: | 373 | protected: |
396 | virtual void init ( ); | 374 | virtual void init ( ); |
397 | virtual void initButtons ( ); | 375 | virtual void initButtons ( ); |
398 | 376 | ||
399 | public: | 377 | public: |
400 | virtual bool suspend ( ); | 378 | virtual bool suspend ( ); |
401 | 379 | ||
402 | virtual bool setDisplayBrightness ( int b ); | 380 | virtual bool setDisplayBrightness ( int b ); |
403 | virtual int displayBrightnessResolution ( ) const; | 381 | virtual int displayBrightnessResolution ( ) const; |
404 | 382 | ||
405 | static bool isYopy ( ); | 383 | static bool isYopy ( ); |
406 | }; | 384 | }; |
407 | 385 | ||
408 | struct yopy_button { | 386 | struct yopy_button { |
409 | Qt::Key code; | 387 | Qt::Key code; |
410 | char *utext; | 388 | char *utext; |
411 | char *pix; | 389 | char *pix; |
412 | char *fpressedservice; | 390 | char *fpressedservice; |
413 | char *fpressedaction; | 391 | char *fpressedaction; |
414 | char *fheldservice; | 392 | char *fheldservice; |
415 | char *fheldaction; | 393 | char *fheldaction; |
416 | } yopy_buttons [] = { | 394 | } yopy_buttons [] = { |
417 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), | 395 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), |
418 | "devicebuttons/yopy_action", | 396 | "devicebuttons/yopy_action", |
419 | "datebook", "nextView()", | 397 | "datebook", "nextView()", |
420 | "today", "raise()" }, | 398 | "today", "raise()" }, |
421 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), | 399 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), |
422 | "devicebuttons/yopy_ok", | 400 | "devicebuttons/yopy_ok", |
423 | "addressbook", "raise()", | 401 | "addressbook", "raise()", |
424 | "addressbook", "beamBusinessCard()" }, | 402 | "addressbook", "beamBusinessCard()" }, |
425 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"), | 403 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"), |
426 | "devicebuttons/yopy_end", | 404 | "devicebuttons/yopy_end", |
427 | "QPE/Launcher", "home()", | 405 | "QPE/Launcher", "home()", |
428 | "buttonsettings", "raise()" }, | 406 | "buttonsettings", "raise()" }, |
429 | }; | 407 | }; |
430 | 408 | ||
431 | static QCString makeChannel ( const char *str ) | 409 | static QCString makeChannel ( const char *str ) |
432 | { | 410 | { |
433 | if ( str && !::strchr ( str, '/' )) | 411 | if ( str && !::strchr ( str, '/' )) |
434 | return QCString ( "QPE/Application/" ) + str; | 412 | return QCString ( "QPE/Application/" ) + str; |
435 | else | 413 | else |
436 | return str; | 414 | return str; |
437 | } | 415 | } |
438 | 416 | ||
439 | static inline bool isQWS() | 417 | static inline bool isQWS() |
440 | { | 418 | { |
441 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 419 | return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
442 | } | 420 | } |
443 | 421 | ||
444 | ODevice *ODevice::inst ( ) | 422 | ODevice *ODevice::inst ( ) |
445 | { | 423 | { |
446 | static ODevice *dev = 0; | 424 | static ODevice *dev = 0; |
447 | 425 | ||
448 | if ( !dev ) { | 426 | if ( !dev ) { |
449 | if ( QFile::exists ( "/proc/hal/model" )) | 427 | if ( QFile::exists ( "/proc/hal/model" )) |
450 | dev = new iPAQ ( ); | 428 | dev = new iPAQ ( ); |
451 | else if ( Zaurus::isZaurus() ) | 429 | else if ( Zaurus::isZaurus() ) |
452 | dev = new Zaurus ( ); | 430 | dev = new Zaurus ( ); |
453 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) | 431 | else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) |
454 | dev = new SIMpad ( ); | 432 | dev = new SIMpad ( ); |
455 | else if ( QFile::exists ( "/proc/sys/board/name" )) | ||
456 | dev = new Ramses ( ); | ||
457 | else if ( Yopy::isYopy() ) | 433 | else if ( Yopy::isYopy() ) |
458 | dev = new Yopy ( ); | 434 | dev = new Yopy ( ); |
459 | else if ( Jornada::isJornada() ) | 435 | else if ( Jornada::isJornada() ) |
460 | dev = new Jornada ( ); | 436 | dev = new Jornada ( ); |
437 | else if ( QFile::exists ( "/proc/sys/board/sys_name" )) | ||
438 | dev = new Ramses ( ); | ||
461 | else | 439 | else |
462 | dev = new ODevice ( ); | 440 | dev = new ODevice ( ); |
463 | dev-> init ( ); | 441 | dev-> init ( ); |
464 | } | 442 | } |
465 | return dev; | 443 | return dev; |
466 | } | 444 | } |
467 | 445 | ||
468 | 446 | ||
469 | /************************************************** | 447 | /************************************************** |
470 | * | 448 | * |
471 | * common | 449 | * common |
472 | * | 450 | * |
473 | **************************************************/ | 451 | **************************************************/ |
474 | 452 | ||
475 | 453 | ||
476 | ODevice::ODevice ( ) | 454 | ODevice::ODevice ( ) |
477 | { | 455 | { |
478 | d = new ODeviceData; | 456 | d = new ODeviceData; |
479 | 457 | ||
480 | d-> m_modelstr = "Unknown"; | 458 | d-> m_modelstr = "Unknown"; |
481 | d-> m_model = Model_Unknown; | 459 | d-> m_model = Model_Unknown; |
482 | d-> m_vendorstr = "Unknown"; | 460 | d-> m_vendorstr = "Unknown"; |
483 | d-> m_vendor = Vendor_Unknown; | 461 | d-> m_vendor = Vendor_Unknown; |
484 | d-> m_systemstr = "Unknown"; | 462 | d-> m_systemstr = "Unknown"; |
485 | d-> m_system = System_Unknown; | 463 | d-> m_system = System_Unknown; |
486 | d-> m_sysverstr = "0.0"; | 464 | d-> m_sysverstr = "0.0"; |
487 | d-> m_rotation = Rot0; | 465 | d-> m_rotation = Rot0; |
488 | d-> m_direction = CW; | 466 | d-> m_direction = CW; |
489 | 467 | ||
490 | d-> m_holdtime = 1000; // 1000ms | 468 | d-> m_holdtime = 1000; // 1000ms |
491 | d-> m_buttons = 0; | 469 | d-> m_buttons = 0; |
492 | d-> m_cpu_frequencies = new QStrList; | 470 | d-> m_cpu_frequencies = new QStrList; |
493 | } | 471 | } |
494 | 472 | ||
495 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 473 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
496 | { | 474 | { |
497 | if ( msg == "deviceButtonMappingChanged()" ) { | 475 | if ( msg == "deviceButtonMappingChanged()" ) { |
498 | reloadButtonMapping ( ); | 476 | reloadButtonMapping ( ); |
499 | } | 477 | } |
500 | } | 478 | } |
501 | 479 | ||
502 | void ODevice::init ( ) | 480 | void ODevice::init ( ) |
503 | { | 481 | { |
504 | } | 482 | } |
505 | 483 | ||
506 | /** | 484 | /** |
507 | * This method initialises the button mapping | 485 | * This method initialises the button mapping |
508 | */ | 486 | */ |
509 | void ODevice::initButtons ( ) | 487 | void ODevice::initButtons ( ) |
510 | { | 488 | { |
511 | if ( d-> m_buttons ) | 489 | if ( d-> m_buttons ) |
512 | return; | 490 | return; |
513 | 491 | ||
514 | // Simulation uses iPAQ 3660 device buttons | 492 | // Simulation uses iPAQ 3660 device buttons |
515 | 493 | ||
516 | qDebug ( "init Buttons" ); | 494 | qDebug ( "init Buttons" ); |
517 | d-> m_buttons = new QValueList <ODeviceButton>; | 495 | d-> m_buttons = new QValueList <ODeviceButton>; |
518 | 496 | ||
519 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 497 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
520 | i_button *ib = ipaq_buttons + i; | 498 | i_button *ib = ipaq_buttons + i; |
521 | ODeviceButton b; | 499 | ODeviceButton b; |
522 | 500 | ||
523 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 501 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
524 | b. setKeycode ( ib-> code ); | 502 | b. setKeycode ( ib-> code ); |
525 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 503 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
526 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 504 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
527 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 505 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
528 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 506 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
529 | d-> m_buttons-> append ( b ); | 507 | d-> m_buttons-> append ( b ); |
530 | } | 508 | } |
531 | } | 509 | } |
532 | reloadButtonMapping ( ); | 510 | reloadButtonMapping ( ); |
533 | 511 | ||
534 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 512 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
535 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 513 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
536 | } | 514 | } |
537 | 515 | ||
538 | ODevice::~ODevice ( ) | 516 | ODevice::~ODevice ( ) |
539 | { | 517 | { |
540 | // we leak m_devicebuttons and m_cpu_frequency | 518 | // we leak m_devicebuttons and m_cpu_frequency |
541 | // but it's a singleton and it is not so importantant | 519 | // but it's a singleton and it is not so importantant |
542 | // -zecke | 520 | // -zecke |
543 | delete d; | 521 | delete d; |
544 | } | 522 | } |
545 | 523 | ||
546 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 524 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
547 | { | 525 | { |
548 | return false; | 526 | return false; |
549 | } | 527 | } |
550 | 528 | ||
551 | //#include <linux/apm_bios.h> | 529 | //#include <linux/apm_bios.h> |
552 | 530 | ||
553 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 531 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
554 | 532 | ||
555 | /** | 533 | /** |
556 | * This method will try to suspend the device | 534 | * This method will try to suspend the device |
557 | * It only works if the user is the QWS Server and the apm application | 535 | * It only works if the user is the QWS Server and the apm application |
558 | * is installed. | 536 | * is installed. |
559 | * It tries to suspend and then waits some time cause some distributions | 537 | * It tries to suspend and then waits some time cause some distributions |
560 | * do have asynchronus apm implementations. | 538 | * do have asynchronus apm implementations. |
561 | * This method will either fail and return false or it'll suspend the | 539 | * This method will either fail and return false or it'll suspend the |
562 | * device and return once the device got woken up | 540 | * device and return once the device got woken up |
563 | * | 541 | * |
564 | * @return if the device got suspended | 542 | * @return if the device got suspended |
565 | */ | 543 | */ |
566 | bool ODevice::suspend ( ) | 544 | bool ODevice::suspend ( ) |
567 | { | 545 | { |
568 | qDebug("ODevice::suspend"); | 546 | qDebug("ODevice::suspend"); |
569 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 547 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
570 | return false; | 548 | return false; |
571 | 549 | ||
572 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 550 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
573 | return false; | 551 | return false; |
574 | 552 | ||
575 | bool res = false; | 553 | bool res = false; |
576 | 554 | ||
577 | struct timeval tvs, tvn; | 555 | struct timeval tvs, tvn; |
578 | ::gettimeofday ( &tvs, 0 ); | 556 | ::gettimeofday ( &tvs, 0 ); |
579 | 557 | ||
580 | ::sync ( ); // flush fs caches | 558 | ::sync ( ); // flush fs caches |
581 | res = ( ::system ( "apm --suspend" ) == 0 ); | 559 | res = ( ::system ( "apm --suspend" ) == 0 ); |
582 | 560 | ||
583 | // This is needed because the iPAQ apm implementation is asynchronous and we | 561 | // This is needed because the iPAQ apm implementation is asynchronous and we |
584 | // can not be sure when exactly the device is really suspended | 562 | // can not be sure when exactly the device is really suspended |
585 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 563 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
586 | 564 | ||
587 | if ( res ) { | 565 | if ( res ) { |
588 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 566 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
589 | ::usleep ( 200 * 1000 ); | 567 | ::usleep ( 200 * 1000 ); |
590 | ::gettimeofday ( &tvn, 0 ); | 568 | ::gettimeofday ( &tvn, 0 ); |
591 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 569 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
592 | } | 570 | } |
593 | 571 | ||
594 | return res; | 572 | return res; |
595 | } | 573 | } |
596 | 574 | ||
597 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 575 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
598 | 576 | ||
599 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 577 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
600 | 578 | ||
601 | /* VESA Blanking Levels */ | 579 | /* VESA Blanking Levels */ |
602 | #define VESA_NO_BLANKING 0 | 580 | #define VESA_NO_BLANKING 0 |
603 | #define VESA_VSYNC_SUSPEND 1 | 581 | #define VESA_VSYNC_SUSPEND 1 |
604 | #define VESA_HSYNC_SUSPEND 2 | 582 | #define VESA_HSYNC_SUSPEND 2 |
605 | #define VESA_POWERDOWN 3 | 583 | #define VESA_POWERDOWN 3 |
606 | 584 | ||
607 | /** | 585 | /** |
608 | * This sets the display on or off | 586 | * This sets the display on or off |
609 | */ | 587 | */ |
610 | bool ODevice::setDisplayStatus ( bool on ) | 588 | bool ODevice::setDisplayStatus ( bool on ) |
611 | { | 589 | { |
612 | qDebug("ODevice::setDisplayStatus(%d)", on); | 590 | qDebug("ODevice::setDisplayStatus(%d)", on); |
613 | 591 | ||
614 | if ( d-> m_model == Model_Unknown ) | 592 | if ( d-> m_model == Model_Unknown ) |
615 | return false; | 593 | return false; |
616 | 594 | ||
617 | bool res = false; | 595 | bool res = false; |
618 | int fd; | 596 | int fd; |
619 | 597 | ||
620 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 598 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
621 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 599 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
622 | ::close ( fd ); | 600 | ::close ( fd ); |
623 | } | 601 | } |
624 | return res; | 602 | return res; |
625 | } | 603 | } |
626 | 604 | ||
627 | /** | 605 | /** |
628 | * This sets the display brightness | 606 | * This sets the display brightness |
629 | * | 607 | * |
630 | * @param p The brightness to be set on a scale from 0 to 255 | 608 | * @param p The brightness to be set on a scale from 0 to 255 |
631 | * @return success or failure | 609 | * @return success or failure |
632 | */ | 610 | */ |
633 | bool ODevice::setDisplayBrightness ( int p) | 611 | bool ODevice::setDisplayBrightness ( int p) |
634 | { | 612 | { |
635 | Q_UNUSED( p ) | 613 | Q_UNUSED( p ) |
636 | return false; | 614 | return false; |
637 | } | 615 | } |
638 | 616 | ||
639 | /** | 617 | /** |
640 | * @return returns the number of steppings on the brightness slider | 618 | * @return returns the number of steppings on the brightness slider |
641 | * in the Light-'n-Power settings. | 619 | * in the Light-'n-Power settings. |
642 | */ | 620 | */ |
643 | int ODevice::displayBrightnessResolution ( ) const | 621 | int ODevice::displayBrightnessResolution ( ) const |
644 | { | 622 | { |
645 | return 16; | 623 | return 16; |
646 | } | 624 | } |
647 | 625 | ||
648 | /** | 626 | /** |
649 | * This sets the display contrast | 627 | * This sets the display contrast |
650 | * @param p The contrast to be set on a scale from 0 to 255 | 628 | * @param p The contrast to be set on a scale from 0 to 255 |
651 | * @return success or failure | 629 | * @return success or failure |
652 | */ | 630 | */ |
653 | bool ODevice::setDisplayContrast ( int p) | 631 | bool ODevice::setDisplayContrast ( int p) |
654 | { | 632 | { |
655 | Q_UNUSED( p ) | 633 | Q_UNUSED( p ) |
656 | return false; | 634 | return false; |
657 | } | 635 | } |
658 | 636 | ||
659 | /** | 637 | /** |
660 | * @return return the max value for the brightness settings slider | 638 | * @return return the max value for the brightness settings slider |
661 | * or 0 if the device doesn't support setting of a contrast | 639 | * or 0 if the device doesn't support setting of a contrast |
662 | */ | 640 | */ |
663 | int ODevice::displayContrastResolution ( ) const | 641 | int ODevice::displayContrastResolution ( ) const |
664 | { | 642 | { |
665 | return 0; | 643 | return 0; |
666 | } | 644 | } |
667 | 645 | ||
668 | /** | 646 | /** |
669 | * This returns the vendor as string | 647 | * This returns the vendor as string |
670 | * @return Vendor as QString | 648 | * @return Vendor as QString |
671 | */ | 649 | */ |
672 | QString ODevice::vendorString ( ) const | 650 | QString ODevice::vendorString ( ) const |
673 | { | 651 | { |
674 | return d-> m_vendorstr; | 652 | return d-> m_vendorstr; |
675 | } | 653 | } |
676 | 654 | ||
677 | /** | 655 | /** |
678 | * This returns the vendor as one of the values of OVendor | 656 | * This returns the vendor as one of the values of OVendor |
679 | * @return OVendor | 657 | * @return OVendor |
680 | */ | 658 | */ |
681 | OVendor ODevice::vendor ( ) const | 659 | OVendor ODevice::vendor ( ) const |
682 | { | 660 | { |
683 | return d-> m_vendor; | 661 | return d-> m_vendor; |
684 | } | 662 | } |
685 | 663 | ||
686 | /** | 664 | /** |
687 | * This returns the model as a string | 665 | * This returns the model as a string |
688 | * @return A string representing the model | 666 | * @return A string representing the model |
689 | */ | 667 | */ |
690 | QString ODevice::modelString ( ) const | 668 | QString ODevice::modelString ( ) const |
691 | { | 669 | { |
692 | return d-> m_modelstr; | 670 | return d-> m_modelstr; |
693 | } | 671 | } |
694 | 672 | ||
695 | /** | 673 | /** |
696 | * This does return the OModel used | 674 | * This does return the OModel used |
697 | */ | 675 | */ |
698 | OModel ODevice::model ( ) const | 676 | OModel ODevice::model ( ) const |
699 | { | 677 | { |
700 | return d-> m_model; | 678 | return d-> m_model; |
701 | } | 679 | } |
702 | 680 | ||
703 | /** | 681 | /** |
704 | * This does return the systen name | 682 | * This does return the systen name |
705 | */ | 683 | */ |
706 | QString ODevice::systemString ( ) const | 684 | QString ODevice::systemString ( ) const |
707 | { | 685 | { |
708 | return d-> m_systemstr; | 686 | return d-> m_systemstr; |
709 | } | 687 | } |
710 | 688 | ||
711 | /** | 689 | /** |
712 | * Return System as OSystem value | 690 | * Return System as OSystem value |
713 | */ | 691 | */ |
714 | OSystem ODevice::system ( ) const | 692 | OSystem ODevice::system ( ) const |
715 | { | 693 | { |
716 | return d-> m_system; | 694 | return d-> m_system; |
@@ -2275,513 +2253,513 @@ void SIMpad::initButtons ( ) | |||
2275 | { | 2253 | { |
2276 | if ( d-> m_buttons ) | 2254 | if ( d-> m_buttons ) |
2277 | return; | 2255 | return; |
2278 | 2256 | ||
2279 | if ( isQWS( ) ) | 2257 | if ( isQWS( ) ) |
2280 | QWSServer::setKeyboardFilter ( this ); | 2258 | QWSServer::setKeyboardFilter ( this ); |
2281 | 2259 | ||
2282 | d-> m_buttons = new QValueList <ODeviceButton>; | 2260 | d-> m_buttons = new QValueList <ODeviceButton>; |
2283 | 2261 | ||
2284 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 2262 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { |
2285 | s_button *sb = simpad_buttons + i; | 2263 | s_button *sb = simpad_buttons + i; |
2286 | ODeviceButton b; | 2264 | ODeviceButton b; |
2287 | 2265 | ||
2288 | if (( sb-> model & d-> m_model ) == d-> m_model ) { | 2266 | if (( sb-> model & d-> m_model ) == d-> m_model ) { |
2289 | b. setKeycode ( sb-> code ); | 2267 | b. setKeycode ( sb-> code ); |
2290 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); | 2268 | b. setUserText ( QObject::tr ( "Button", sb-> utext )); |
2291 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); | 2269 | b. setPixmap ( Resource::loadPixmap ( sb-> pix )); |
2292 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); | 2270 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); |
2293 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); | 2271 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); |
2294 | 2272 | ||
2295 | d-> m_buttons-> append ( b ); | 2273 | d-> m_buttons-> append ( b ); |
2296 | } | 2274 | } |
2297 | } | 2275 | } |
2298 | reloadButtonMapping ( ); | 2276 | reloadButtonMapping ( ); |
2299 | 2277 | ||
2300 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 2278 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
2301 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 2279 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
2302 | } | 2280 | } |
2303 | 2281 | ||
2304 | // SIMpad boardcontrol register CS3 | 2282 | // SIMpad boardcontrol register CS3 |
2305 | #define SIMPAD_BOARDCONTROL "/proc/cs3" | 2283 | #define SIMPAD_BOARDCONTROL "/proc/cs3" |
2306 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA | 2284 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA |
2307 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA | 2285 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA |
2308 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's | 2286 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's |
2309 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V | 2287 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V |
2310 | #define SIMPAD_DISPLAY_ON 0x0010 | 2288 | #define SIMPAD_DISPLAY_ON 0x0010 |
2311 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 | 2289 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 |
2312 | #define SIMPAD_MQ_RESET 0x0040 | 2290 | #define SIMPAD_MQ_RESET 0x0040 |
2313 | #define SIMPAD_PCMCIA_RESET 0x0080 | 2291 | #define SIMPAD_PCMCIA_RESET 0x0080 |
2314 | #define SIMPAD_DECT_POWER_ON 0x0100 | 2292 | #define SIMPAD_DECT_POWER_ON 0x0100 |
2315 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave | 2293 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave |
2316 | #define SIMPAD_RS232_ON 0x0400 | 2294 | #define SIMPAD_RS232_ON 0x0400 |
2317 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave | 2295 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave |
2318 | #define SIMPAD_LED2_ON 0x1000 | 2296 | #define SIMPAD_LED2_ON 0x1000 |
2319 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode | 2297 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode |
2320 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit | 2298 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit |
2321 | #define SIMPAD_RESET_SIMCARD 0x8000 | 2299 | #define SIMPAD_RESET_SIMCARD 0x8000 |
2322 | 2300 | ||
2323 | //SIMpad touchscreen backlight strength control | 2301 | //SIMpad touchscreen backlight strength control |
2324 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" | 2302 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" |
2325 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 | 2303 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 |
2326 | 2304 | ||
2327 | QValueList <OLed> SIMpad::ledList ( ) const | 2305 | QValueList <OLed> SIMpad::ledList ( ) const |
2328 | { | 2306 | { |
2329 | QValueList <OLed> vl; | 2307 | QValueList <OLed> vl; |
2330 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? | 2308 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? |
2331 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway | 2309 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway |
2332 | return vl; | 2310 | return vl; |
2333 | } | 2311 | } |
2334 | 2312 | ||
2335 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const | 2313 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const |
2336 | { | 2314 | { |
2337 | QValueList <OLedState> vl; | 2315 | QValueList <OLedState> vl; |
2338 | 2316 | ||
2339 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? | 2317 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? |
2340 | vl << Led_Off << Led_On; | 2318 | vl << Led_Off << Led_On; |
2341 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway | 2319 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway |
2342 | //vl << Led_Off; | 2320 | //vl << Led_Off; |
2343 | return vl; | 2321 | return vl; |
2344 | } | 2322 | } |
2345 | 2323 | ||
2346 | OLedState SIMpad::ledState ( OLed l ) const | 2324 | OLedState SIMpad::ledState ( OLed l ) const |
2347 | { | 2325 | { |
2348 | switch ( l ) { | 2326 | switch ( l ) { |
2349 | case Led_Power: | 2327 | case Led_Power: |
2350 | return m_leds [0]; | 2328 | return m_leds [0]; |
2351 | //case Led_Mail: | 2329 | //case Led_Mail: |
2352 | //return m_leds [1]; | 2330 | //return m_leds [1]; |
2353 | default: | 2331 | default: |
2354 | return Led_Off; | 2332 | return Led_Off; |
2355 | } | 2333 | } |
2356 | } | 2334 | } |
2357 | 2335 | ||
2358 | bool SIMpad::setLedState ( OLed l, OLedState st ) | 2336 | bool SIMpad::setLedState ( OLed l, OLedState st ) |
2359 | { | 2337 | { |
2360 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); | 2338 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); |
2361 | 2339 | ||
2362 | if ( l == Led_Power ) { | 2340 | if ( l == Led_Power ) { |
2363 | if ( fd >= 0 ) { | 2341 | if ( fd >= 0 ) { |
2364 | LED_IN leds; | 2342 | LED_IN leds; |
2365 | ::memset ( &leds, 0, sizeof( leds )); | 2343 | ::memset ( &leds, 0, sizeof( leds )); |
2366 | leds. TotalTime = 0; | 2344 | leds. TotalTime = 0; |
2367 | leds. OnTime = 0; | 2345 | leds. OnTime = 0; |
2368 | leds. OffTime = 1; | 2346 | leds. OffTime = 1; |
2369 | leds. OffOnBlink = 2; | 2347 | leds. OffOnBlink = 2; |
2370 | 2348 | ||
2371 | switch ( st ) { | 2349 | switch ( st ) { |
2372 | case Led_Off : leds. OffOnBlink = 0; break; | 2350 | case Led_Off : leds. OffOnBlink = 0; break; |
2373 | case Led_On : leds. OffOnBlink = 1; break; | 2351 | case Led_On : leds. OffOnBlink = 1; break; |
2374 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 2352 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
2375 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 2353 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
2376 | } | 2354 | } |
2377 | 2355 | ||
2378 | { | 2356 | { |
2379 | /*TODO Implement this like that: | 2357 | /*TODO Implement this like that: |
2380 | read from cs3 | 2358 | read from cs3 |
2381 | && with SIMPAD_LED2_ON | 2359 | && with SIMPAD_LED2_ON |
2382 | write to cs3 */ | 2360 | write to cs3 */ |
2383 | m_leds [0] = st; | 2361 | m_leds [0] = st; |
2384 | return true; | 2362 | return true; |
2385 | } | 2363 | } |
2386 | } | 2364 | } |
2387 | } | 2365 | } |
2388 | return false; | 2366 | return false; |
2389 | } | 2367 | } |
2390 | 2368 | ||
2391 | 2369 | ||
2392 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 2370 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
2393 | { | 2371 | { |
2394 | //TODO | 2372 | //TODO |
2395 | return false; | 2373 | return false; |
2396 | } | 2374 | } |
2397 | 2375 | ||
2398 | void SIMpad::timerEvent ( QTimerEvent * ) | 2376 | void SIMpad::timerEvent ( QTimerEvent * ) |
2399 | { | 2377 | { |
2400 | killTimer ( m_power_timer ); | 2378 | killTimer ( m_power_timer ); |
2401 | m_power_timer = 0; | 2379 | m_power_timer = 0; |
2402 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 2380 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
2403 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 2381 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
2404 | } | 2382 | } |
2405 | 2383 | ||
2406 | 2384 | ||
2407 | void SIMpad::alarmSound ( ) | 2385 | void SIMpad::alarmSound ( ) |
2408 | { | 2386 | { |
2409 | #ifndef QT_NO_SOUND | 2387 | #ifndef QT_NO_SOUND |
2410 | static Sound snd ( "alarm" ); | 2388 | static Sound snd ( "alarm" ); |
2411 | int fd; | 2389 | int fd; |
2412 | int vol; | 2390 | int vol; |
2413 | bool vol_reset = false; | 2391 | bool vol_reset = false; |
2414 | 2392 | ||
2415 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 2393 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
2416 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 2394 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
2417 | Config cfg ( "qpe" ); | 2395 | Config cfg ( "qpe" ); |
2418 | cfg. setGroup ( "Volume" ); | 2396 | cfg. setGroup ( "Volume" ); |
2419 | 2397 | ||
2420 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 2398 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
2421 | if ( volalarm < 0 ) | 2399 | if ( volalarm < 0 ) |
2422 | volalarm = 0; | 2400 | volalarm = 0; |
2423 | else if ( volalarm > 100 ) | 2401 | else if ( volalarm > 100 ) |
2424 | volalarm = 100; | 2402 | volalarm = 100; |
2425 | volalarm |= ( volalarm << 8 ); | 2403 | volalarm |= ( volalarm << 8 ); |
2426 | 2404 | ||
2427 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 2405 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
2428 | vol_reset = true; | 2406 | vol_reset = true; |
2429 | } | 2407 | } |
2430 | } | 2408 | } |
2431 | 2409 | ||
2432 | snd. play ( ); | 2410 | snd. play ( ); |
2433 | while ( !snd. isFinished ( )) | 2411 | while ( !snd. isFinished ( )) |
2434 | qApp-> processEvents ( ); | 2412 | qApp-> processEvents ( ); |
2435 | 2413 | ||
2436 | if ( fd >= 0 ) { | 2414 | if ( fd >= 0 ) { |
2437 | if ( vol_reset ) | 2415 | if ( vol_reset ) |
2438 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 2416 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
2439 | ::close ( fd ); | 2417 | ::close ( fd ); |
2440 | } | 2418 | } |
2441 | #endif | 2419 | #endif |
2442 | } | 2420 | } |
2443 | 2421 | ||
2444 | 2422 | ||
2445 | bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm | 2423 | bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm |
2446 | { | 2424 | { |
2447 | qDebug( "ODevice for SIMpad: suspend()" ); | 2425 | qDebug( "ODevice for SIMpad: suspend()" ); |
2448 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 2426 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
2449 | return false; | 2427 | return false; |
2450 | 2428 | ||
2451 | bool res = false; | 2429 | bool res = false; |
2452 | 2430 | ||
2453 | struct timeval tvs, tvn; | 2431 | struct timeval tvs, tvn; |
2454 | ::gettimeofday ( &tvs, 0 ); | 2432 | ::gettimeofday ( &tvs, 0 ); |
2455 | 2433 | ||
2456 | ::sync ( ); // flush fs caches | 2434 | ::sync ( ); // flush fs caches |
2457 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) | 2435 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) |
2458 | 2436 | ||
2459 | return res; | 2437 | return res; |
2460 | } | 2438 | } |
2461 | 2439 | ||
2462 | 2440 | ||
2463 | bool SIMpad::setSoftSuspend ( bool soft ) | 2441 | bool SIMpad::setSoftSuspend ( bool soft ) |
2464 | { | 2442 | { |
2465 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); | 2443 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); |
2466 | return false; | 2444 | return false; |
2467 | } | 2445 | } |
2468 | 2446 | ||
2469 | 2447 | ||
2470 | bool SIMpad::setDisplayStatus ( bool on ) | 2448 | bool SIMpad::setDisplayStatus ( bool on ) |
2471 | { | 2449 | { |
2472 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); | 2450 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); |
2473 | 2451 | ||
2474 | bool res = false; | 2452 | bool res = false; |
2475 | int fd; | 2453 | int fd; |
2476 | 2454 | ||
2477 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) | 2455 | QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) |
2478 | 2456 | ||
2479 | res = ( ::system( (const char*) cmdline ) == 0 ); | 2457 | res = ( ::system( (const char*) cmdline ) == 0 ); |
2480 | 2458 | ||
2481 | return res; | 2459 | return res; |
2482 | } | 2460 | } |
2483 | 2461 | ||
2484 | 2462 | ||
2485 | bool SIMpad::setDisplayBrightness ( int bright ) | 2463 | bool SIMpad::setDisplayBrightness ( int bright ) |
2486 | { | 2464 | { |
2487 | qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); | 2465 | qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); |
2488 | bool res = false; | 2466 | bool res = false; |
2489 | int fd; | 2467 | int fd; |
2490 | 2468 | ||
2491 | if ( bright > 255 ) | 2469 | if ( bright > 255 ) |
2492 | bright = 255; | 2470 | bright = 255; |
2493 | if ( bright < 1 ) | 2471 | if ( bright < 1 ) |
2494 | bright = 0; | 2472 | bright = 0; |
2495 | 2473 | ||
2496 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { | 2474 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { |
2497 | int value = 255 - bright; | 2475 | int value = 255 - bright; |
2498 | const int mask = SIMPAD_BACKLIGHT_MASK; | 2476 | const int mask = SIMPAD_BACKLIGHT_MASK; |
2499 | value = value << 8; | 2477 | value = value << 8; |
2500 | value += mask; | 2478 | value += mask; |
2501 | char writeCommand[100]; | 2479 | char writeCommand[100]; |
2502 | const int count = sprintf( writeCommand, "0x%x\n", value ); | 2480 | const int count = sprintf( writeCommand, "0x%x\n", value ); |
2503 | res = ( ::write ( fd, writeCommand, count ) != -1 ); | 2481 | res = ( ::write ( fd, writeCommand, count ) != -1 ); |
2504 | ::close ( fd ); | 2482 | ::close ( fd ); |
2505 | } | 2483 | } |
2506 | return res; | 2484 | return res; |
2507 | } | 2485 | } |
2508 | 2486 | ||
2509 | 2487 | ||
2510 | int SIMpad::displayBrightnessResolution ( ) const | 2488 | int SIMpad::displayBrightnessResolution ( ) const |
2511 | { | 2489 | { |
2512 | return 255; // All SIMpad models share the same display | 2490 | return 255; // All SIMpad models share the same display |
2513 | } | 2491 | } |
2514 | 2492 | ||
2515 | /************************************************** | 2493 | /************************************************** |
2516 | * | 2494 | * |
2517 | * Ramses | 2495 | * Ramses |
2518 | * | 2496 | * |
2519 | **************************************************/ | 2497 | **************************************************/ |
2520 | 2498 | ||
2521 | void Ramses::init() | 2499 | void Ramses::init() |
2522 | { | 2500 | { |
2523 | d->m_vendorstr = "M und N"; | 2501 | d->m_vendorstr = "M und N"; |
2524 | d->m_vendor = Vendor_MundN; | 2502 | d->m_vendor = Vendor_MundN; |
2525 | 2503 | ||
2526 | QFile f("/proc/sys/board/ramses"); | 2504 | QFile f("/proc/sys/board/ramses"); |
2527 | 2505 | ||
2528 | d->m_modelstr = "Ramses"; | 2506 | d->m_modelstr = "Ramses"; |
2529 | d->m_model = Model_Ramses_MNCI; | 2507 | d->m_model = Model_Ramses_MNCI; |
2530 | 2508 | ||
2531 | d->m_rotation = Rot0; | 2509 | d->m_rotation = Rot90; |
2532 | d->m_holdtime = 1000; | 2510 | d->m_holdtime = 1000; |
2533 | 2511 | ||
2534 | f.setName("/etc/oz_version"); | 2512 | f.setName("/etc/oz_version"); |
2535 | 2513 | ||
2536 | if (f.open(IO_ReadOnly)) { | 2514 | if (f.open(IO_ReadOnly)) { |
2537 | d->m_systemstr = "OpenEmbedded/Ramses"; | 2515 | d->m_systemstr = "OpenEmbedded/Ramses"; |
2538 | d->m_system = System_OpenZaurus; | 2516 | d->m_system = System_OpenZaurus; |
2539 | 2517 | ||
2540 | QTextStream ts(&f); | 2518 | QTextStream ts(&f); |
2541 | ts.setDevice(&f); | 2519 | ts.setDevice(&f); |
2542 | d->m_sysverstr = ts.readLine(); | 2520 | d->m_sysverstr = ts.readLine(); |
2543 | f.close(); | 2521 | f.close(); |
2544 | } | 2522 | } |
2545 | 2523 | ||
2546 | m_power_timer = 0; | 2524 | m_power_timer = 0; |
2547 | 2525 | ||
2548 | #ifdef QT_QWS_ALLOW_OVERCLOCK | 2526 | #ifdef QT_QWS_ALLOW_OVERCLOCK |
2549 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** | 2527 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** |
2550 | #define OC(x...) x | 2528 | #define OC(x...) x |
2551 | #else | 2529 | #else |
2552 | #define OC(x...) | 2530 | #define OC(x...) |
2553 | #endif | 2531 | #endif |
2554 | 2532 | ||
2555 | 2533 | ||
2556 | // This table is true for a Intel XScale PXA 255 | 2534 | // This table is true for a Intel XScale PXA 255 |
2557 | 2535 | ||
2558 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 | 2536 | d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 |
2559 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem | 2537 | OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem |
2560 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 | 2538 | d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 |
2561 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem | 2539 | OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem |
2562 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 | 2540 | d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 |
2563 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem | 2541 | OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem |
2564 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 | 2542 | d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 |
2565 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 | 2543 | d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 |
2566 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus | 2544 | OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus |
2567 | 2545 | ||
2568 | } | 2546 | } |
2569 | 2547 | ||
2570 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) | 2548 | bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) |
2571 | { | 2549 | { |
2572 | Q_UNUSED( keycode ); | 2550 | Q_UNUSED( keycode ); |
2573 | Q_UNUSED( modifiers ); | 2551 | Q_UNUSED( modifiers ); |
2574 | Q_UNUSED( isPress ); | 2552 | Q_UNUSED( isPress ); |
2575 | Q_UNUSED( autoRepeat ); | 2553 | Q_UNUSED( autoRepeat ); |
2576 | return false; | 2554 | return false; |
2577 | } | 2555 | } |
2578 | 2556 | ||
2579 | void Ramses::timerEvent(QTimerEvent *) | 2557 | void Ramses::timerEvent(QTimerEvent *) |
2580 | { | 2558 | { |
2581 | killTimer(m_power_timer); | 2559 | killTimer(m_power_timer); |
2582 | m_power_timer = 0; | 2560 | m_power_timer = 0; |
2583 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); | 2561 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); |
2584 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); | 2562 | QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); |
2585 | } | 2563 | } |
2586 | 2564 | ||
2587 | 2565 | ||
2588 | bool Ramses::setSoftSuspend(bool soft) | 2566 | bool Ramses::setSoftSuspend(bool soft) |
2589 | { | 2567 | { |
2590 | qDebug("Ramses::setSoftSuspend(%d)", soft); | 2568 | qDebug("Ramses::setSoftSuspend(%d)", soft); |
2591 | #if 0 | 2569 | #if 0 |
2592 | bool res = false; | 2570 | bool res = false; |
2593 | int fd; | 2571 | int fd; |
2594 | 2572 | ||
2595 | if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || | 2573 | if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || |
2596 | ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { | 2574 | ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { |
2597 | 2575 | ||
2598 | int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources | 2576 | int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources |
2599 | 2577 | ||
2600 | if (sources >= 0) { | 2578 | if (sources >= 0) { |
2601 | if (soft) | 2579 | if (soft) |
2602 | sources &= ~APM_EVT_POWER_BUTTON; | 2580 | sources &= ~APM_EVT_POWER_BUTTON; |
2603 | else | 2581 | else |
2604 | sources |= APM_EVT_POWER_BUTTON; | 2582 | sources |= APM_EVT_POWER_BUTTON; |
2605 | 2583 | ||
2606 | if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources | 2584 | if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources |
2607 | res = true; | 2585 | res = true; |
2608 | else | 2586 | else |
2609 | perror("APM_IOCGEVTSRC"); | 2587 | perror("APM_IOCGEVTSRC"); |
2610 | } | 2588 | } |
2611 | else | 2589 | else |
2612 | perror("APM_IOCGEVTSRC"); | 2590 | perror("APM_IOCGEVTSRC"); |
2613 | 2591 | ||
2614 | ::close(fd); | 2592 | ::close(fd); |
2615 | } | 2593 | } |
2616 | else | 2594 | else |
2617 | perror("/dev/apm_bios or /dev/misc/apm_bios"); | 2595 | perror("/dev/apm_bios or /dev/misc/apm_bios"); |
2618 | 2596 | ||
2619 | return res; | 2597 | return res; |
2620 | #else | 2598 | #else |
2621 | return true; | 2599 | return true; |
2622 | #endif | 2600 | #endif |
2623 | } | 2601 | } |
2624 | 2602 | ||
2625 | bool Ramses::suspend ( ) | 2603 | bool Ramses::suspend ( ) |
2626 | { | 2604 | { |
2627 | qDebug("Ramses::suspend"); | 2605 | qDebug("Ramses::suspend"); |
2628 | return false; | 2606 | return false; |
2629 | } | 2607 | } |
2630 | 2608 | ||
2631 | /** | 2609 | /** |
2632 | * This sets the display on or off | 2610 | * This sets the display on or off |
2633 | */ | 2611 | */ |
2634 | bool Ramses::setDisplayStatus(bool on) | 2612 | bool Ramses::setDisplayStatus(bool on) |
2635 | { | 2613 | { |
2636 | qDebug("Ramses::setDisplayStatus(%d)", on); | 2614 | qDebug("Ramses::setDisplayStatus(%d)", on); |
2637 | #if 0 | 2615 | #if 0 |
2638 | bool res = false; | 2616 | bool res = false; |
2639 | int fd; | 2617 | int fd; |
2640 | 2618 | ||
2641 | if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { | 2619 | if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { |
2642 | res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); | 2620 | res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); |
2643 | ::close(fd); | 2621 | ::close(fd); |
2644 | } | 2622 | } |
2645 | return res; | 2623 | return res; |
2646 | #else | 2624 | #else |
2647 | return true; | 2625 | return true; |
2648 | #endif | 2626 | #endif |
2649 | } | 2627 | } |
2650 | 2628 | ||
2651 | 2629 | ||
2652 | /* | 2630 | /* |
2653 | * We get something between 0..255 into us | 2631 | * We get something between 0..255 into us |
2654 | */ | 2632 | */ |
2655 | bool Ramses::setDisplayBrightness(int bright) | 2633 | bool Ramses::setDisplayBrightness(int bright) |
2656 | { | 2634 | { |
2657 | qDebug("Ramses::setDisplayBrightness(%d)", bright); | 2635 | qDebug("Ramses::setDisplayBrightness(%d)", bright); |
2658 | bool res = false; | 2636 | bool res = false; |
2659 | int fd; | 2637 | int fd; |
2660 | 2638 | ||
2661 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) | 2639 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) |
2662 | 2640 | ||
2663 | if (bright > 255 ) | 2641 | if (bright > 255 ) |
2664 | bright = 255; | 2642 | bright = 255; |
2665 | if (bright < 0) | 2643 | if (bright < 0) |
2666 | bright = 0; | 2644 | bright = 0; |
2667 | 2645 | ||
2668 | // Turn backlight completely off | 2646 | // Turn backlight completely off |
2669 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { | 2647 | if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { |
2670 | char writeCommand[10]; | 2648 | char writeCommand[10]; |
2671 | const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); | 2649 | const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); |
2672 | res = (::write(fd, writeCommand, count) != -1); | 2650 | res = (::write(fd, writeCommand, count) != -1); |
2673 | ::close(fd); | 2651 | ::close(fd); |
2674 | } | 2652 | } |
2675 | 2653 | ||
2676 | // scale backlight brightness to hardware | 2654 | // scale backlight brightness to hardware |
2677 | bright = 500-(bright * 500 / 255); | 2655 | bright = 500-(bright * 500 / 255); |
2678 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { | 2656 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { |
2679 | qDebug(" %d -> pwm1", bright); | 2657 | qDebug(" %d -> pwm1", bright); |
2680 | char writeCommand[100]; | 2658 | char writeCommand[100]; |
2681 | const int count = sprintf(writeCommand, "%d\n", bright); | 2659 | const int count = sprintf(writeCommand, "%d\n", bright); |
2682 | res = (::write(fd, writeCommand, count) != -1); | 2660 | res = (::write(fd, writeCommand, count) != -1); |
2683 | ::close(fd); | 2661 | ::close(fd); |
2684 | } | 2662 | } |
2685 | return res; | 2663 | return res; |
2686 | } | 2664 | } |
2687 | 2665 | ||
2688 | 2666 | ||
2689 | int Ramses::displayBrightnessResolution() const | 2667 | int Ramses::displayBrightnessResolution() const |
2690 | { | 2668 | { |
2691 | return 32; | 2669 | return 32; |
2692 | } | 2670 | } |
2693 | 2671 | ||
2694 | bool Ramses::setDisplayContrast(int contr) | 2672 | bool Ramses::setDisplayContrast(int contr) |
2695 | { | 2673 | { |
2696 | qDebug("Ramses::setDisplayContrast(%d)", contr); | 2674 | qDebug("Ramses::setDisplayContrast(%d)", contr); |
2697 | bool res = false; | 2675 | bool res = false; |
2698 | int fd; | 2676 | int fd; |
2699 | 2677 | ||
2700 | // pwm0 contrast: 20 steps 79..90 (dunkel->hell) | 2678 | // pwm0 contrast: 20 steps 79..90 (dunkel->hell) |
2701 | 2679 | ||
2702 | if (contr > 255 ) | 2680 | if (contr > 255 ) |
2703 | contr = 255; | 2681 | contr = 255; |
2704 | if (contr < 0) | 2682 | if (contr < 0) |
2705 | contr = 0; | 2683 | contr = 0; |
2706 | contr = 90 - (contr * 20 / 255); | 2684 | contr = 90 - (contr * 20 / 255); |
2707 | 2685 | ||
2708 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { | 2686 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { |
2709 | qDebug(" %d -> pwm0", contr); | 2687 | qDebug(" %d -> pwm0", contr); |
2710 | char writeCommand[100]; | 2688 | char writeCommand[100]; |
2711 | const int count = sprintf(writeCommand, "%d\n", contr); | 2689 | const int count = sprintf(writeCommand, "%d\n", contr); |
2712 | res = (::write(fd, writeCommand, count) != -1); | 2690 | res = (::write(fd, writeCommand, count) != -1); |
2713 | res = true; | 2691 | res = true; |
2714 | ::close(fd); | 2692 | ::close(fd); |
2715 | } | 2693 | } |
2716 | return res; | 2694 | return res; |
2717 | } | 2695 | } |
2718 | 2696 | ||
2719 | 2697 | ||
2720 | int Ramses::displayContrastResolution() const | 2698 | int Ramses::displayContrastResolution() const |
2721 | { | 2699 | { |
2722 | return 20; | 2700 | return 20; |
2723 | } | 2701 | } |
2724 | 2702 | ||
2725 | 2703 | ||
2726 | /************************************************** | 2704 | /************************************************** |
2727 | * * | 2705 | * * |
2728 | * Jornada * | 2706 | * Jornada * |
2729 | * * | 2707 | * * |
2730 | **************************************************/ | 2708 | **************************************************/ |
2731 | 2709 | ||
2732 | 2710 | ||
2733 | bool Jornada::isJornada ( ) | 2711 | bool Jornada::isJornada ( ) |
2734 | { | 2712 | { |
2735 | QFile f( "/proc/cpuinfo" ); | 2713 | QFile f( "/proc/cpuinfo" ); |
2736 | if ( f. open ( IO_ReadOnly ) ) { | 2714 | if ( f. open ( IO_ReadOnly ) ) { |
2737 | QTextStream ts ( &f ); | 2715 | QTextStream ts ( &f ); |
2738 | QString line; | 2716 | QString line; |
2739 | while( line = ts. readLine ( ) ) { | 2717 | while( line = ts. readLine ( ) ) { |
2740 | if ( line. left ( 8 ) == "Hardware" ) { | 2718 | if ( line. left ( 8 ) == "Hardware" ) { |
2741 | int loc = line. find ( ":" ); | 2719 | int loc = line. find ( ":" ); |
2742 | if ( loc != -1 ) { | 2720 | if ( loc != -1 ) { |
2743 | QString model = | 2721 | QString model = |
2744 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 2722 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
2745 | return ( model == "HP Jornada 56x" ); | 2723 | return ( model == "HP Jornada 56x" ); |
2746 | } | 2724 | } |
2747 | } | 2725 | } |
2748 | } | 2726 | } |
2749 | } | 2727 | } |
2750 | return false; | 2728 | return false; |
2751 | } | 2729 | } |
2752 | 2730 | ||
2753 | void Jornada::init ( ) | 2731 | void Jornada::init ( ) |
2754 | { | 2732 | { |
2755 | d-> m_vendorstr = "HP"; | 2733 | d-> m_vendorstr = "HP"; |
2756 | d-> m_vendor = Vendor_HP; | 2734 | d-> m_vendor = Vendor_HP; |
2757 | d-> m_modelstr = "Jornada 56x"; | 2735 | d-> m_modelstr = "Jornada 56x"; |
2758 | d-> m_model = Model_Jornada_56x; | 2736 | d-> m_model = Model_Jornada_56x; |
2759 | d-> m_systemstr = "Familiar"; | 2737 | d-> m_systemstr = "Familiar"; |
2760 | d-> m_system = System_Familiar; | 2738 | d-> m_system = System_Familiar; |
2761 | d-> m_rotation = Rot0; | 2739 | d-> m_rotation = Rot0; |
2762 | 2740 | ||
2763 | QFile f ( "/etc/familiar-version" ); | 2741 | QFile f ( "/etc/familiar-version" ); |
2764 | f. setName ( "/etc/familiar-version" ); | 2742 | f. setName ( "/etc/familiar-version" ); |
2765 | if ( f. open ( IO_ReadOnly )) { | 2743 | if ( f. open ( IO_ReadOnly )) { |
2766 | 2744 | ||
2767 | QTextStream ts ( &f ); | 2745 | QTextStream ts ( &f ); |
2768 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 2746 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
2769 | 2747 | ||
2770 | f. close ( ); | 2748 | f. close ( ); |
2771 | } | 2749 | } |
2772 | } | 2750 | } |
2773 | 2751 | ||
2774 | #if 0 | 2752 | #if 0 |
2775 | void Jornada::initButtons ( ) | 2753 | void Jornada::initButtons ( ) |
2776 | { | 2754 | { |
2777 | if ( d-> m_buttons ) | 2755 | if ( d-> m_buttons ) |
2778 | return; | 2756 | return; |
2779 | 2757 | ||
2780 | // Simulation uses iPAQ 3660 device buttons | 2758 | // Simulation uses iPAQ 3660 device buttons |
2781 | 2759 | ||
2782 | qDebug ( "init Buttons" ); | 2760 | qDebug ( "init Buttons" ); |
2783 | d-> m_buttons = new QValueList <ODeviceButton>; | 2761 | d-> m_buttons = new QValueList <ODeviceButton>; |
2784 | 2762 | ||
2785 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 2763 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
2786 | i_button *ib = ipaq_buttons + i; | 2764 | i_button *ib = ipaq_buttons + i; |
2787 | ODeviceButton b; | 2765 | ODeviceButton b; |