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 | |||
@@ -276,281 +276,259 @@ struct z_button { | |||
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 |
@@ -2435,193 +2413,193 @@ void SIMpad::alarmSound ( ) | |||
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"); |