author | mickeyl <mickeyl> | 2005-09-03 18:01:49 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-09-03 18:01:49 (UTC) |
commit | de950b18690b8981a2bddaca68cbd5d48c71f689 (patch) (side-by-side diff) | |
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 @@ -218,13 +218,13 @@ struct default_button { /** * A singleton which gives informations about device specefic option * like the Hardware used, LEDs, the Base Distribution and * hardware key mappings. * - * @short A small class for device specefic options + * @short A small class for device specific options * @see QObject * @author Robert Griebl * @version 1.0 */ class ODevice : public QObject { 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 @@ -154,12 +154,13 @@ struct z_button z_buttons_6000 [] = { // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) void Zaurus::init(const QString& cpu_info) { + qDebug( "Zaurus::init()" ); // Set the time to wait until the system is really suspended // the delta between apm --suspend and sleeping setAPMTimeOut( 15000 ); // generic distribution code already scanned /etc/issue at that point - // embedix releases contain "Embedix <version> | Linux for Embedded Devices" @@ -256,12 +257,13 @@ void Zaurus::init(const QString& cpu_info) d->m_rotation = Rot0; break; case Model_Zaurus_SLC3100: // fallthrough case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC1000: // fallthrough case Model_Zaurus_SLC7x0: + initHingeSensor(); d->m_rotation = rotation(); d->m_direction = direction(); break; case Model_Zaurus_SLB600: // fallthrough case Model_Zaurus_SL5000: // fallthrough case Model_Zaurus_SL5500: // fallthrough @@ -286,12 +288,13 @@ void Zaurus::init(const QString& cpu_info) else qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); } void Zaurus::initButtons() { + qDebug( "Zaurus::initButtons()" ); if ( d->m_buttons ) return; d->m_buttons = new QValueList <ODeviceButton>; struct z_button * pz_buttons; @@ -304,15 +307,14 @@ void Zaurus::initButtons() break; case Model_Zaurus_SLC3100: // fallthrough case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC1000: // fallthrough case Model_Zaurus_SLC7x0: if ( isQWS( ) ) - { // setup hinge sensor stuff + { addPreHandler(this); - initHingeSensor(); } pz_buttons = z_buttons_c700; buttoncount = ARRAY_SIZE(z_buttons_c700); break; default: pz_buttons = z_buttons; @@ -598,12 +600,13 @@ Transformation Zaurus::rotation() const case Model_Zaurus_SL5000: default: rot = d->m_rotation; break; } + qDebug( "Zaurus::rotation() - returning '%d'", rot ); return rot; } ODirection Zaurus::direction() const { ODirection dir; @@ -702,18 +705,20 @@ void Zaurus::initHingeSensor() { if ( m_embedix ) return; m_hinge.setName( "/dev/input/event0" ); if ( !m_hinge.open( IO_ReadOnly ) ) { - qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); + qWarning( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); return; } QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); + + qDebug( "Zaurus::init() - Hinge Sensor Initialization successfully completed" ); } void Zaurus::hingeSensorTriggered() { qDebug( "Zaurus::hingeSensorTriggered() - got event" ); struct input_event e; @@ -726,12 +731,19 @@ void Zaurus::hingeSensorTriggered() qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); } } } +void Zaurus::systemMessage( const QCString &msg, const QByteArray & ) +{ + if ( msg == "deviceButtonMappingChanged()" ) { + reloadButtonMapping(); + } +} + /* * Take code from iPAQ device. * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. * I hope that is ok - Alwin */ bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 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 @@ -94,19 +94,22 @@ namespace Opie { namespace Core { namespace Internal { class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter { + Q_OBJECT + protected: virtual void init(const QString&); virtual void initButtons(); void initHingeSensor(); protected slots: void hingeSensorTriggered(); + void systemMessage( const QCString &msg, const QByteArray & ); public: virtual bool setDisplayBrightness( int b ); virtual bool setDisplayStatus( bool on ); virtual int displayBrightnessResolution() const; |