From de950b18690b8981a2bddaca68cbd5d48c71f689 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sat, 03 Sep 2005 18:01:49 +0000 Subject: fun with namespaces and moc... this patch fixes the hinge sensor on clamshell Zaurii --- (limited to 'libopie2') 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 { * 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 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 [] = { 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 ); @@ -259,6 +260,7 @@ void Zaurus::init(const QString& cpu_info) case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC1000: // fallthrough case Model_Zaurus_SLC7x0: + initHingeSensor(); d->m_rotation = rotation(); d->m_direction = direction(); break; @@ -289,6 +291,7 @@ void Zaurus::init(const QString& cpu_info) void Zaurus::initButtons() { + qDebug( "Zaurus::initButtons()" ); if ( d->m_buttons ) return; @@ -307,9 +310,8 @@ void Zaurus::initButtons() 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); @@ -601,6 +603,7 @@ Transformation Zaurus::rotation() const break; } + qDebug( "Zaurus::rotation() - returning '%d'", rot ); return rot; } ODirection Zaurus::direction() const @@ -705,12 +708,14 @@ void Zaurus::initHingeSensor() 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() @@ -729,6 +734,13 @@ void Zaurus::hingeSensorTriggered() } } +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. 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 { class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter { + Q_OBJECT + protected: virtual void init(const QString&); virtual void initButtons(); @@ -104,6 +106,7 @@ class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter protected slots: void hingeSensorTriggered(); + void systemMessage( const QCString &msg, const QByteArray & ); public: virtual bool setDisplayBrightness( int b ); -- cgit v0.9.0.2