summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-02-04 17:59:22 (UTC)
committer mickeyl <mickeyl>2005-02-04 17:59:22 (UTC)
commitee4b479d3e0b67a4418914231c0ec38ef31b8290 (patch) (unidiff)
treeb4bde4c8544444d260f98619bf82a0c5ec8a584e
parentc0248a2c02381b5a5dce5c4543db6ff46486f2f1 (diff)
downloadopie-ee4b479d3e0b67a4418914231c0ec38ef31b8290.zip
opie-ee4b479d3e0b67a4418914231c0ec38ef31b8290.tar.gz
opie-ee4b479d3e0b67a4418914231c0ec38ef31b8290.tar.bz2
implement computing the hinge status for Zaurus w/ Kernel 2.6
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 780d130..a59e799 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -33,12 +33,13 @@
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <opie2/oinputsystem.h>
39#include <qpe/config.h> 40#include <qpe/config.h>
40#include <qpe/resource.h> 41#include <qpe/resource.h>
41#include <qpe/sound.h> 42#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 43#include <qpe/qcopenvelope_qws.h>
43 44
44/* STD */ 45/* STD */
@@ -97,13 +98,22 @@ struct z_button z_buttons_c700 [] = {
97 "QPE/TaskBar", "toggleMenu()", 98 "QPE/TaskBar", "toggleMenu()",
98 "QPE/TaskBar", "toggleStartMenu()" }, 99 "QPE/TaskBar", "toggleStartMenu()" },
99 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 100 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
100 "devicebuttons/z_mail", 101 "devicebuttons/z_mail",
101 "opiemail", "raise()", 102 "opiemail", "raise()",
102 "opiemail", "newMail()" }, 103 "opiemail", "newMail()" },
103 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 104
105 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
106 "devicebuttons/z_hinge",
107 "QPE/Rotation", "rotateDefault()",
108 "QPE/Dummy", "doNothing()" },
109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
110 "devicebuttons/z_hinge",
111 "QPE/Rotation", "rotateDefault()",
112 "QPE/Dummy", "doNothing()" },
113 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
104 "devicebuttons/z_hinge", 114 "devicebuttons/z_hinge",
105 "QPE/Rotation", "rotateDefault()", 115 "QPE/Rotation", "rotateDefault()",
106 "QPE/Dummy", "doNothing()" }, 116 "QPE/Dummy", "doNothing()" },
107}; 117};
108 118
109// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 119// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
@@ -504,13 +514,13 @@ bool Zaurus::suspend()
504} 514}
505 515
506 516
507Transformation Zaurus::rotation() const 517Transformation Zaurus::rotation() const
508{ 518{
509 Transformation rot; 519 Transformation rot;
510 520
511 switch ( d->m_model ) { 521 switch ( d->m_model ) {
512 case Model_Zaurus_SLC3000: // fallthrough 522 case Model_Zaurus_SLC3000: // fallthrough
513 case Model_Zaurus_SLC7x0: { 523 case Model_Zaurus_SLC7x0: {
514 OHingeStatus hs = readHingeSensor(); 524 OHingeStatus hs = readHingeSensor();
515 if ( hs == CASE_PORTRAIT ) rot = Rot0; 525 if ( hs == CASE_PORTRAIT ) rot = Rot0;
516 else if ( hs == CASE_UNKNOWN ) rot = Rot0; 526 else if ( hs == CASE_UNKNOWN ) rot = Rot0;
@@ -529,13 +539,13 @@ Transformation Zaurus::rotation() const
529 539
530 return rot; 540 return rot;
531} 541}
532ODirection Zaurus::direction() const 542ODirection Zaurus::direction() const
533{ 543{
534 ODirection dir; 544 ODirection dir;
535 545
536 switch ( d->m_model ) { 546 switch ( d->m_model ) {
537 case Model_Zaurus_SLC3000: // fallthrough 547 case Model_Zaurus_SLC3000: // fallthrough
538 case Model_Zaurus_SLC7x0: { 548 case Model_Zaurus_SLC7x0: {
539 OHingeStatus hs = readHingeSensor(); 549 OHingeStatus hs = readHingeSensor();
540 if ( hs == CASE_PORTRAIT ) dir = CCW; 550 if ( hs == CASE_PORTRAIT ) dir = CCW;
541 else if ( hs == CASE_UNKNOWN ) dir = CCW; 551 else if ( hs == CASE_UNKNOWN ) dir = CCW;
@@ -584,10 +594,15 @@ OHingeStatus Zaurus::readHingeSensor() const
584 return CASE_UNKNOWN; 594 return CASE_UNKNOWN;
585 } 595 }
586 } 596 }
587 } 597 }
588 else 598 else
589 { 599 {
590 qDebug( "Zaurus::readHingeSensor: ODevice handling for non-embedix kernels not yet implemented" ); 600 // corgi keyboard is event source 0 in OZ kernel 2.6
601 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" );
602 if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE;
603 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT;
604 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED;
605 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
591 return CASE_UNKNOWN; 606 return CASE_UNKNOWN;
592 } 607 }
593} 608}