author | mickeyl <mickeyl> | 2005-09-03 18:01:49 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-09-03 18:01:49 (UTC) |
commit | de950b18690b8981a2bddaca68cbd5d48c71f689 (patch) (unidiff) | |
tree | 53e111efa326b6fbfb4e157c4c7d3776ea9af17b | |
parent | ed772cdd53070ccc61c87a3b0e96769a9f558f71 (diff) | |
download | opie-de950b18690b8981a2bddaca68cbd5d48c71f689.zip opie-de950b18690b8981a2bddaca68cbd5d48c71f689.tar.gz opie-de950b18690b8981a2bddaca68cbd5d48c71f689.tar.bz2 |
fun with namespaces and moc... this patch fixes the hinge sensor on clamshell Zaurii
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 18 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 3 |
3 files changed, 19 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 0eed1c9..492c97b 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -221,7 +221,7 @@ struct default_button { | |||
221 | * like the Hardware used, LEDs, the Base Distribution and | 221 | * like the Hardware used, LEDs, the Base Distribution and |
222 | * hardware key mappings. | 222 | * hardware key mappings. |
223 | * | 223 | * |
224 | * @short A small class for device specefic options | 224 | * @short A small class for device specific options |
225 | * @see QObject | 225 | * @see QObject |
226 | * @author Robert Griebl | 226 | * @author Robert Griebl |
227 | * @version 1.0 | 227 | * @version 1.0 |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index a75f566..8a7e252 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -157,6 +157,7 @@ struct z_button z_buttons_6000 [] = { | |||
157 | 157 | ||
158 | void Zaurus::init(const QString& cpu_info) | 158 | void Zaurus::init(const QString& cpu_info) |
159 | { | 159 | { |
160 | qDebug( "Zaurus::init()" ); | ||
160 | // Set the time to wait until the system is really suspended | 161 | // Set the time to wait until the system is really suspended |
161 | // the delta between apm --suspend and sleeping | 162 | // the delta between apm --suspend and sleeping |
162 | setAPMTimeOut( 15000 ); | 163 | setAPMTimeOut( 15000 ); |
@@ -259,6 +260,7 @@ void Zaurus::init(const QString& cpu_info) | |||
259 | case Model_Zaurus_SLC3000: // fallthrough | 260 | case Model_Zaurus_SLC3000: // fallthrough |
260 | case Model_Zaurus_SLC1000: // fallthrough | 261 | case Model_Zaurus_SLC1000: // fallthrough |
261 | case Model_Zaurus_SLC7x0: | 262 | case Model_Zaurus_SLC7x0: |
263 | initHingeSensor(); | ||
262 | d->m_rotation = rotation(); | 264 | d->m_rotation = rotation(); |
263 | d->m_direction = direction(); | 265 | d->m_direction = direction(); |
264 | break; | 266 | break; |
@@ -289,6 +291,7 @@ void Zaurus::init(const QString& cpu_info) | |||
289 | 291 | ||
290 | void Zaurus::initButtons() | 292 | void Zaurus::initButtons() |
291 | { | 293 | { |
294 | qDebug( "Zaurus::initButtons()" ); | ||
292 | if ( d->m_buttons ) | 295 | if ( d->m_buttons ) |
293 | return; | 296 | return; |
294 | 297 | ||
@@ -307,9 +310,8 @@ void Zaurus::initButtons() | |||
307 | case Model_Zaurus_SLC1000: // fallthrough | 310 | case Model_Zaurus_SLC1000: // fallthrough |
308 | case Model_Zaurus_SLC7x0: | 311 | case Model_Zaurus_SLC7x0: |
309 | if ( isQWS( ) ) | 312 | if ( isQWS( ) ) |
310 | { // setup hinge sensor stuff | 313 | { |
311 | addPreHandler(this); | 314 | addPreHandler(this); |
312 | initHingeSensor(); | ||
313 | } | 315 | } |
314 | pz_buttons = z_buttons_c700; | 316 | pz_buttons = z_buttons_c700; |
315 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 317 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
@@ -601,6 +603,7 @@ Transformation Zaurus::rotation() const | |||
601 | break; | 603 | break; |
602 | } | 604 | } |
603 | 605 | ||
606 | qDebug( "Zaurus::rotation() - returning '%d'", rot ); | ||
604 | return rot; | 607 | return rot; |
605 | } | 608 | } |
606 | ODirection Zaurus::direction() const | 609 | ODirection Zaurus::direction() const |
@@ -705,12 +708,14 @@ void Zaurus::initHingeSensor() | |||
705 | m_hinge.setName( "/dev/input/event0" ); | 708 | m_hinge.setName( "/dev/input/event0" ); |
706 | if ( !m_hinge.open( IO_ReadOnly ) ) | 709 | if ( !m_hinge.open( IO_ReadOnly ) ) |
707 | { | 710 | { |
708 | qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); | 711 | qWarning( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); |
709 | return; | 712 | return; |
710 | } | 713 | } |
711 | 714 | ||
712 | QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); | 715 | QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); |
713 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); | 716 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); |
717 | |||
718 | qDebug( "Zaurus::init() - Hinge Sensor Initialization successfully completed" ); | ||
714 | } | 719 | } |
715 | 720 | ||
716 | void Zaurus::hingeSensorTriggered() | 721 | void Zaurus::hingeSensorTriggered() |
@@ -729,6 +734,13 @@ void Zaurus::hingeSensorTriggered() | |||
729 | } | 734 | } |
730 | } | 735 | } |
731 | 736 | ||
737 | void Zaurus::systemMessage( const QCString &msg, const QByteArray & ) | ||
738 | { | ||
739 | if ( msg == "deviceButtonMappingChanged()" ) { | ||
740 | reloadButtonMapping(); | ||
741 | } | ||
742 | } | ||
743 | |||
732 | /* | 744 | /* |
733 | * Take code from iPAQ device. | 745 | * Take code from iPAQ device. |
734 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. | 746 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index bf30bc6..8a66f9c 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -97,6 +97,8 @@ namespace Internal { | |||
97 | 97 | ||
98 | class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter | 98 | class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter |
99 | { | 99 | { |
100 | Q_OBJECT | ||
101 | |||
100 | protected: | 102 | protected: |
101 | virtual void init(const QString&); | 103 | virtual void init(const QString&); |
102 | virtual void initButtons(); | 104 | virtual void initButtons(); |
@@ -104,6 +106,7 @@ class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter | |||
104 | 106 | ||
105 | protected slots: | 107 | protected slots: |
106 | void hingeSensorTriggered(); | 108 | void hingeSensorTriggered(); |
109 | void systemMessage( const QCString &msg, const QByteArray & ); | ||
107 | 110 | ||
108 | public: | 111 | public: |
109 | virtual bool setDisplayBrightness( int b ); | 112 | virtual bool setDisplayBrightness( int b ); |