author | kergoth <kergoth> | 2003-04-16 22:46:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-16 22:46:26 (UTC) |
commit | 43f1d8c741f37b7fa3021bd480b5370b2b22cb53 (patch) (side-by-side diff) | |
tree | 49c96c4048f3ff53242e7ee56105e66bc3126d1d | |
parent | b98b64367e3871f3b34cf090376130f79698ce94 (diff) | |
download | opie-43f1d8c741f37b7fa3021bd480b5370b2b22cb53.zip opie-43f1d8c741f37b7fa3021bd480b5370b2b22cb53.tar.gz opie-43f1d8c741f37b7fa3021bd480b5370b2b22cb53.tar.bz2 |
Attempt to workaround oliver's reported suspend issue. Check for a qws server at runtime rather than init time, and set the keyboard filter in initButtons rather than init.
-rw-r--r-- | libopie/odevice.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 8f954b1..0e1c0dd 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -233,96 +233,98 @@ ODevice *ODevice::inst ( ) } /************************************************** * * common * **************************************************/ ODevice::ODevice ( ) { d = new ODeviceData; d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; d-> m_modelstr = "Unknown"; d-> m_model = Model_Unknown; d-> m_vendorstr = "Unknown"; d-> m_vendor = Vendor_Unknown; d-> m_systemstr = "Unknown"; d-> m_system = System_Unknown; d-> m_sysverstr = "0.0"; d-> m_rotation = Rot0; d-> m_holdtime = 1000; // 1000ms d-> m_buttons = 0; } void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) { if ( msg == "deviceButtonMappingChanged()" ) { reloadButtonMapping ( ); } } void ODevice::init ( ) { } /** * This method initialises the button mapping */ void ODevice::initButtons ( ) { if ( d-> m_buttons ) return; + d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; + // Simulation uses iPAQ 3660 device buttons qDebug ( "init Buttons" ); d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { i_button *ib = ipaq_buttons + i; ODeviceButton b; if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { b. setKeycode ( ib-> code ); b. setUserText ( QObject::tr ( "Button", ib-> utext )); b. setPixmap ( Resource::loadPixmap ( ib-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); d-> m_buttons-> append ( b ); } } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); } ODevice::~ODevice ( ) { delete d; } bool ODevice::setSoftSuspend ( bool /*soft*/ ) { return false; } //#include <linux/apm_bios.h> #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) /** * This method will try to suspend the device * It only works if the user is the QWS Server and the apm application * is installed. * It tries to suspend and then waits some time cause some distributions * do have asynchronus apm implementations. * This method will either fail and return false or it'll suspend the * device and return once the device got woken up * * @return if the device got suspended @@ -717,105 +719,108 @@ void iPAQ::init ( ) f. close ( ); } switch ( d-> m_model ) { case Model_iPAQ_H31xx: case Model_iPAQ_H38xx: d-> m_rotation = Rot90; break; case Model_iPAQ_H36xx: case Model_iPAQ_H37xx: case Model_iPAQ_H39xx: default: d-> m_rotation = Rot270; break; } f. setName ( "/etc/familiar-version" ); if ( f. open ( IO_ReadOnly )) { d-> m_systemstr = "Familiar"; d-> m_system = System_Familiar; QTextStream ts ( &f ); d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); f. close ( ); } else { f. setName ( "/etc/oz_version" ); if ( f. open ( IO_ReadOnly )) { d-> m_systemstr = "OpenEmbedded/iPaq"; d-> m_system = System_Familiar; QTextStream ts ( &f ); ts.setDevice ( &f ); d-> m_sysverstr = ts. readLine ( ); f. close ( ); } } m_leds [0] = m_leds [1] = Led_Off; m_power_timer = 0; - if ( d-> m_qwsserver ) - QWSServer::setKeyboardFilter ( this ); } void iPAQ::initButtons ( ) { if ( d-> m_buttons ) return; + d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; + + if ( d-> m_qwsserver ) + QWSServer::setKeyboardFilter ( this ); + d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { i_button *ib = ipaq_buttons + i; ODeviceButton b; if (( ib-> model & d-> m_model ) == d-> m_model ) { b. setKeycode ( ib-> code ); b. setUserText ( QObject::tr ( "Button", ib-> utext )); b. setPixmap ( Resource::loadPixmap ( ib-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); d-> m_buttons-> append ( b ); } } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); } //#include <linux/h3600_ts.h> // including kernel headers is evil ... typedef struct { unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ unsigned char TotalTime; /* Units of 5 seconds */ unsigned char OnTime; /* units of 100m/s */ unsigned char OffTime; /* units of 100m/s */ } LED_IN; typedef struct { unsigned char mode; unsigned char pwr; unsigned char brightness; } FLITE_IN; #define LED_ON OD_IOW( 'f', 5, LED_IN ) #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) QValueList <OLed> iPAQ::ledList ( ) const { QValueList <OLed> vl; vl << Led_Power; if ( d-> m_model == Model_iPAQ_H38xx ) @@ -1104,96 +1109,98 @@ void Zaurus::init ( ) } f. setName ( "/proc/deviceinfo/product" ); if ( f. open ( IO_ReadOnly ) ) { QTextStream ts ( &f ); QString model = ts. readLine ( ); f. close ( ); d-> m_modelstr = QString("Zaurus ") + model; if ( model == "SL-5500" ) d-> m_model = Model_Zaurus_SL5500; else if ( model == "SL-C700" ) d-> m_model = Model_Zaurus_SLC700; else if ( model == "SL-A300" ) d-> m_model = Model_Zaurus_SLA300; else if ( model == "SL-B600" || model == "SL-5600" ) d-> m_model = Model_Zaurus_SLB600; else d-> m_model = Model_Zaurus_SL5000; } else { d-> m_model = Model_Zaurus_SL5000; d-> m_modelstr = "Zaurus (model unknown)"; } switch ( d-> m_model ) { case Model_Zaurus_SLA300: d-> m_rotation = Rot0; break; case Model_Zaurus_SLC700: /* note for C700, we must check the display rotation * sensor to set an appropriate value */ case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: d-> m_rotation = Rot270; break; } m_leds [0] = Led_Off; } void Zaurus::initButtons ( ) { if ( d-> m_buttons ) return; + d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; + d-> m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { z_button *zb = z_buttons + i; ODeviceButton b; b. setKeycode ( zb-> code ); b. setUserText ( QObject::tr ( "Button", zb-> utext )); b. setPixmap ( Resource::loadPixmap ( zb-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); d-> m_buttons-> append ( b ); } reloadButtonMapping ( ); QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); } #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> //#include <asm/sharp_char.h> // including kernel headers is evil ... #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ #define SHARP_BUZ_KEYSOUND 2 /* key sound */ #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ /* --- for SHARP_BUZZER device --- */ //#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |