author | zecke <zecke> | 2005-02-17 23:52:46 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-17 23:52:46 (UTC) |
commit | 9bf35a9978c8a9e8b9c2100abf9137ffefc73e17 (patch) (side-by-side diff) | |
tree | f251c1697f2ed091d8f55eca7aa1b8f4a85c7889 | |
parent | 87cbafeb59d0505b631be811bd96fb1d0b1df1f7 (diff) | |
download | opie-9bf35a9978c8a9e8b9c2100abf9137ffefc73e17.zip opie-9bf35a9978c8a9e8b9c2100abf9137ffefc73e17.tar.gz opie-9bf35a9978c8a9e8b9c2100abf9137ffefc73e17.tar.bz2 |
Add OAbstractMobileDevice with implementations for suspend and setDisplayStatus
Switch our implementations over to this partial implementation of ODevice
-rw-r--r-- | libopie2/opiecore/device/device.pro | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 14 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | 119 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.h | 64 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_beagle.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 21 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.h | 5 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 36 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 5 |
14 files changed, 204 insertions, 84 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro index 9a409e1..08bd4e1 100644 --- a/libopie2/opiecore/device/device.pro +++ b/libopie2/opiecore/device/device.pro @@ -1,22 +1,24 @@ HEADERS += device/odevice.h \ device/odevicebutton.h \ + device/odevice_abstractmobiledevice.h \ device/odevice_beagle.h \ device/odevice_ipaq.h \ device/odevice_jornada.h \ device/odevice_ramses.h \ device/odevice_simpad.h \ device/odevice_zaurus.h \ device/odevice_genuineintel.h \ device/odevice_yopy.h SOURCES += device/odevice.cpp \ device/odevicebutton.cpp \ + device/odevice_abstractmobiledevice.cpp \ device/odevice_beagle.cpp \ device/odevice_ipaq.cpp \ device/odevice_jornada.cpp\ device/odevice_ramses.cpp \ device/odevice_simpad.cpp \ device/odevice_zaurus.cpp \ device/odevice_genuineintel.cpp \ device/odevice_yopy.cpp diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 2c5190c..ed705a6 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -193,158 +193,144 @@ ODevice::ODevice() // identified by /etc/familiar-version or /etc/oz_version. // Then check for OpenEmbedded and lastly, read /etc/issue for ( unsigned int i = 0; i < sizeof distributions; ++i ) { if ( QFile::exists( distributions[i].sysvfile ) ) { d->m_systemstr = distributions[i].sysstr; d->m_system = distributions[i].system; d->m_sysverstr = "<Unknown>"; QFile f( distributions[i].sysvfile ); if ( f.open( IO_ReadOnly ) ) { QTextStream ts( &f ); d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); } break; } } } void ODevice::systemMessage( const QCString &msg, const QByteArray & ) { if ( msg == "deviceButtonMappingChanged()" ) { reloadButtonMapping(); } } void ODevice::init(const QString&) { } /** * This method initialises the button mapping */ void ODevice::initButtons() { if ( d->m_buttons ) return; qDebug ( "init Buttons" ); d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { default_button *db = default_buttons + i; ODeviceButton b; b. setKeycode ( db->code ); b. setUserText ( QObject::tr ( "Button", db->utext )); b. setPixmap ( Resource::loadPixmap ( db->pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); d->m_buttons->append ( b ); } reloadButtonMapping(); } ODevice::~ODevice() { // we leak m_devicebuttons and m_cpu_frequency // but it's a singleton and it is not so importantant // -zecke delete d; } -//#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 */ bool ODevice::suspend() { return false; // default implementation == unknown device or qvfb } -//#include <linux/fb.h> better not rely on kernel headers in userspace ... - -#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 - -/* VESA Blanking Levels */ -#define VESA_NO_BLANKING 0 -#define VESA_VSYNC_SUSPEND 1 -#define VESA_HSYNC_SUSPEND 2 -#define VESA_POWERDOWN 3 - /** * This sets the display on or off */ bool ODevice::setDisplayStatus( bool on ) { qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); return false; // don't do anything for unknown models } /** * This sets the display brightness * * @param b The brightness to be set on a scale from 0 to 255 * @return success or failure */ bool ODevice::setDisplayBrightness( int b ) { qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); return false; } /** * * @returns the number of steppings on the brightness slider * in the Light-'n-Power settings. Values smaller than zero and bigger * than 255 do not make sense. * * \sa QSlider::setLineStep * \sa QSlider::setPageStep */ int ODevice::displayBrightnessResolution() const { qDebug( "ODevice::displayBrightnessResolution() - please override me." ); return 16; } /** * This sets the display contrast * @param p The contrast to be set on a scale from 0 to 255 * @returns success or failure */ bool ODevice::setDisplayContrast( int p ) { qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); return false; } /** * @returns the maximum value for the contrast settings slider * or 0 if the device doesn't support setting of a contrast */ int ODevice::displayContrastResolution() const { qDebug( "ODevice::displayBrightnessResolution() - please override me." ); return 0; } /** * This returns the vendor as string * @return Vendor as QString */ QString ODevice::vendorString() const { return d->m_vendorstr; diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp new file mode 100644 index 0000000..f3f6af5 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp @@ -0,0 +1,119 @@ +/* + This file is part of the Opie Project + Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> + Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> + Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org> + + + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "odevice_abstractmobiledevice.h" + +#include <sys/time.h> +#include <sys/ioctl.h> + +#include <time.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> + +namespace Opie { +namespace Core { +OAbstractMobileDevice::OAbstractMobileDevice() + : m_timeOut( 1500 ) +{} + +/** + * @short Time to wait for the asynchronos APM implementation to suspend + * + * Milli Seconds to wait before returning from the suspend method. + * This is needed due asynchrnonus implementations of the APM bios. + * + */ +void OAbstractMobileDevice::setAPMTimeOut( int time ) { + m_timeOut = time; +} + + +bool OAbstractMobileDevice::suspend() { + if ( !isQWS( ) ) // only qwsserver is allowed to suspend + return false; + + bool res = false; + ODevice::sendSuspendmsg(); + + struct timeval tvs, tvn; + ::gettimeofday ( &tvs, 0 ); + + ::sync(); // flush fs caches + res = ( ::system ( "apm --suspend" ) == 0 ); + + // This is needed because some apm implementations are asynchronous and we + // can not be sure when exactly the device is really suspended + // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. + + if ( res ) { + do { // wait at most 1.5 sec: either suspend didn't work or the device resumed + ::usleep ( 200 * 1000 ); + ::gettimeofday ( &tvn, 0 ); + } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); + } + + return res; +} + +//#include <linux/fb.h> better not rely on kernel headers in userspace ... + +// _IO and friends are only defined in kernel headers ... +#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) +#define OD_IO(type,number) OD_IOC(0,type,number,0) + +#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 + +/* VESA Blanking Levels */ +#define VESA_NO_BLANKING 0 +#define VESA_VSYNC_SUSPEND 1 +#define VESA_HSYNC_SUSPEND 2 +#define VESA_POWERDOWN 3 + +bool OAbstractMobileDevice::setDisplayStatus ( bool on ) { + bool res = false; + int fd; + +#ifdef QT_QWS_DEVFS + if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { +#else + if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { +#endif + res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); + ::close ( fd ); + } + + return res; +} +} +} diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.h b/libopie2/opiecore/device/odevice_abstractmobiledevice.h new file mode 100644 index 0000000..9467e82 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.h @@ -0,0 +1,64 @@ +/* + This file is part of the Opie Project + Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> + Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> + + + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE +#define OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE + +#include "odevice.h" + +namespace Opie { +namespace Core { +/** + * @short Common Implementations for Linux Handheld Devices + * + * Abstract Class with implementation for suspending using + * asynchrnonus apm implementations and displaystatus using + * the Linux Frame Buffer API + * + */ +class OAbstractMobileDevice : public ODevice { + Q_OBJECT +protected: + OAbstractMobileDevice(); + void setAPMTimeOut( int time ); +public: + virtual bool suspend(); + virtual bool setDisplayStatus(bool); + +private: + int m_timeOut; +}; +} +} + + +#endif diff --git a/libopie2/opiecore/device/odevice_beagle.h b/libopie2/opiecore/device/odevice_beagle.h index 17b040c..697d689 100644 --- a/libopie2/opiecore/device/odevice_beagle.h +++ b/libopie2/opiecore/device/odevice_beagle.h @@ -1,61 +1,61 @@ /* This file is part of the Opie Project Copyright (C) 2004 The Opie Team <opie-devel@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OPIE_CORE_DEVICE_BEAGLE_H #define OPIE_CORE_DEVICE_BEAGLE_H -#include "odevice.h" +#include "odevice_abstractmobiledevice.h" namespace Opie { namespace Core { namespace Internal { -class Beagle : public ODevice { +class Beagle : public OAbstractMobileDevice { public: Beagle(); ~Beagle(); //@{ void init( const QString& init ); void initButtons(); //@} //@{ bool setDisplayStatus( bool on ); int displayBrightnessResolution()const; bool setDisplayBrightness( int brightness ); //@} }; } } } #endif diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h index b1dac74..1889467 100644 --- a/libopie2/opiecore/device/odevice_ipaq.h +++ b/libopie2/opiecore/device/odevice_ipaq.h @@ -1,88 +1,88 @@ /* This file is part of the Opie Project Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_IPAQ #define ODEVICE_IPAQ -#include "odevice.h" +#include "odevice_abstractmobiledevice.h" /* QT */ #include <qwindowsystem_qws.h> namespace Opie { namespace Core { namespace Internal { -class iPAQ : public ODevice, public QWSServer::KeyboardFilter +class iPAQ : public OAbstractMobileDevice, public QWSServer::KeyboardFilter { protected: virtual void init(const QString&); virtual void initButtons(); public: virtual bool setDisplayBrightness( int b ); virtual int displayBrightnessResolution() const; virtual void playAlarmSound(); virtual QValueList <OLed> ledList() const; virtual QValueList <OLedState> ledStateList( OLed led ) const; virtual OLedState ledState( OLed led ) const; virtual bool setLedState( OLed led, OLedState st ); virtual bool hasLightSensor() const; virtual int readLightSensor(); virtual int lightSensorResolution() const; protected: virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); virtual void timerEvent( QTimerEvent *te ); int m_power_timer; OLedState m_leds [2]; }; struct i_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; }; } } } #endif diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 8141f1c..5f95e42 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp @@ -109,96 +109,75 @@ struct j_button jornada56x_buttons [] = { }; void Jornada::init(const QString&) { d->m_vendorstr = "HP"; d->m_vendor = Vendor_HP; d->m_modelstr = "Jornada 56x"; d->m_model = Model_Jornada_56x; d->m_rotation = Rot0; //Distribution detecting code is now in base class } void Jornada::initButtons() { if ( d->m_buttons ) return; d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { j_button *ib = jornada56x_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(); } int Jornada::displayBrightnessResolution() const { return 255; } bool Jornada::setDisplayBrightness( int bright ) { bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; QString cmdline; if ( !bright ) cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); else cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); res = ( ::system( (const char*) cmdline ) == 0 ); return res; } -bool Jornada::suspend( ) -{ - qDebug("ODevice::suspend"); - if ( !isQWS( ) ) // only qwsserver is allowed to suspend - return false; - - if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices - return false; - - bool res = false; - ODevice::sendSuspendmsg(); - - struct timeval tvs; - ::gettimeofday ( &tvs, 0 ); - - ::sync(); // flush fs caches - res = ( ::system ( "apm --suspend" ) == 0 ); - - return res; -} - bool Jornada::setDisplayStatus ( bool on ) { bool res = false; QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); res = ( ::system( (const char*) cmdline ) == 0 ); return res; } diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h index b17fa8b..480efff 100644 --- a/libopie2/opiecore/device/odevice_jornada.h +++ b/libopie2/opiecore/device/odevice_jornada.h @@ -1,67 +1,66 @@ /* This file is part of the Opie Project Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_JORNADA #define ODEVICE_JORNADA -#include <opie2/odevice.h> +#include "odevice_abstractmobiledevice.h" namespace Opie { namespace Core { namespace Internal { -class Jornada : public ODevice +class Jornada : public OAbstractMobileDevice { protected: virtual void init(const QString&); virtual void initButtons(); public: - virtual bool suspend ( ); virtual bool setDisplayBrightness ( int b ); virtual bool setDisplayStatus ( bool on); virtual int displayBrightnessResolution() const; }; struct j_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; }; } } } #endif diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h index bbd3862..50963dc 100644 --- a/libopie2/opiecore/device/odevice_ramses.h +++ b/libopie2/opiecore/device/odevice_ramses.h @@ -1,69 +1,69 @@ /* This file is part of the Opie Project Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_RAMSES #define ODEVICE_RAMSES -#include <opie2/odevice.h> +#include "odevice_abstractmobiledevice.h" /* QT */ #include <qwindowsystem_qws.h> #ifndef OD_IOC #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) #define OD_IO(type,number) OD_IOC(0,type,number,0) #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) #endif namespace Opie { namespace Core { namespace Internal { class Ramses : public ODevice { protected: virtual void init(const QString&); public: virtual bool suspend(); virtual bool setDisplayBrightness( int b ); virtual int displayBrightnessResolution() const; virtual void playAlarmSound(); }; } } } #endif diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index d6c2c80..550da5e 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp @@ -271,129 +271,129 @@ QValueList <OLed> SIMpad::ledList() const } QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const { QValueList <OLedState> vl; if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? vl << Led_Off << Led_On; //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway //vl << Led_Off; return vl; } OLedState SIMpad::ledState ( OLed l ) const { switch ( l ) { case Led_Power: return m_leds [0]; //case Led_Mail: // return m_leds [1]; default: return Led_Off; } } bool SIMpad::setLedState ( OLed l, OLedState st ) { if ( l == Led_Power ) { m_leds [0] = st; setCS3Bit(st == Led_On, SIMPAD_LED2_ON); return true; } return false; } void SIMpad::timerEvent ( QTimerEvent * ) { killTimer ( m_power_timer ); m_power_timer = 0; QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); } void SIMpad::playAlarmSound() { #ifndef QT_NO_SOUND static Sound snd ( "alarm" ); if(!snd.isFinished()) return; /* save as the Sound is static! */ changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); snd. play(); #endif } bool SIMpad::suspend() // Must override because SIMpad does NOT have apm { if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; - bool res = ODevice::suspend(); + bool res = OAbstractMobileDevice::suspend(); /* * restore the screen content if we really * supended the device */ if ( res ) updateAllWidgets(); return res; } bool SIMpad::setDisplayStatus ( bool on ) { qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); return setCS3Bit(on, SIMPAD_DISPLAY_ON); } bool SIMpad::setDisplayBrightness ( int bright ) { qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 1 ) bright = 0; if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { QCString str = QFile::encodeName( QString::number(bright)); res = ( ::write(fd, str, str.length()) != -1 ); ::close ( fd ); } return res; } int SIMpad::displayBrightnessResolution() const { return 255; // All SIMpad models share the same display } /* * The MQ200 DRAM content is lost during suspend * so we will just repaint every widget on resume */ void SIMpad::updateAllWidgets() { QWidgetList *list = QApplication::allWidgets(); QWidgetListIt it( *list ); QWidget *wid; while ((wid=it.current()) != 0 ) { wid->update(); ++it; } delete list; } } } diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index 41b94d1..1276603 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h @@ -1,75 +1,75 @@ /* This file is part of the Opie Project Copyright (C) 2003, 2004 The Opie Team <opie-devel@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_SIMPAD #define ODEVICE_SIMPAD -#include <opie2/odevice.h> +#include "odevice_abstractmobiledevice.h" /* QT */ #include <qwindowsystem_qws.h> namespace Opie { namespace Core { namespace Internal { -class SIMpad : public ODevice -{ +class SIMpad : public OAbstractMobileDevice +{ protected: virtual void init(const QString&); virtual void initButtons(); public: virtual bool suspend(); virtual bool setDisplayStatus( bool on ); virtual bool setDisplayBrightness( int b ); virtual int displayBrightnessResolution() const; virtual void playAlarmSound(); virtual QValueList <OLed> ledList() const; virtual QValueList <OLedState> ledStateList( OLed led ) const; virtual OLedState ledState( OLed led ) const; virtual bool setLedState( OLed led, OLedState st ); protected: virtual void timerEvent( QTimerEvent *te ); int m_power_timer; OLedState m_leds [2]; private: static void updateAllWidgets(); }; } } } #endif diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h index f6bf061..02a19c9 100644 --- a/libopie2/opiecore/device/odevice_yopy.h +++ b/libopie2/opiecore/device/odevice_yopy.h @@ -1,67 +1,67 @@ /* This file is part of the Opie Project Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_YOPY #define ODEVICE_YOPY -#include <opie2/odevice.h> +#include "odevice_abstractmobiledevice.h" namespace Opie { namespace Core { namespace Internal { -class Yopy : public ODevice +class Yopy : public OAbstractMobileDevice { protected: virtual void init(const QString&); virtual void initButtons(); public: virtual bool suspend(); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution() const; }; struct yopy_button { Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; }; } } } #endif diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 82e127e..67dfa41 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -71,128 +71,132 @@ struct z_button z_buttons [] = { "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, }; struct z_button z_buttons_c700 [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), "devicebuttons/z_hinge1", "QPE/Rotation", "rotateDefault()", "QPE/Rotation", "rotateDefault()" }, { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), "devicebuttons/z_hinge2", "QPE/Rotation", "rotateDefault()", "QPE/Rotation", "rotateDefault()" }, { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), "devicebuttons/z_hinge3", "QPE/Rotation", "rotateDefault()", "QPE/Rotation", "rotateDefault()" }, }; // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus // class up into individual classes. We need three classes // // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) // // Only question right now is: Do we really need to do it? Because as soon // as the OpenZaurus kernel is ready, there will be a unified interface for all // Zaurus models (concerning apm, backlight, buttons, etc.) // // Comments? - mickeyl. void Zaurus::init(const QString& cpu_info) { + // Set the time to wait until the system is realy 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" if ( d->m_sysverstr.contains( "embedix", false ) ) { d->m_vendorstr = "Sharp"; d->m_vendor = Vendor_Sharp; d->m_systemstr = "Zaurus"; d->m_system = System_Zaurus; m_embedix = true; } else { d->m_vendorstr = "OpenZaurus Team"; d->m_systemstr = "OpenZaurus"; d->m_system = System_OpenZaurus; // sysver already gathered // OpenZaurus sometimes uses the embedix kernel, check if this is one FILE *uname = popen("uname -r", "r"); QFile f; QString line; if ( f.open(IO_ReadOnly, uname) ) { QTextStream ts ( &f ); line = ts. readLine(); int loc = line. find ( "embedix" ); if ( loc != -1 ) m_embedix = true; else m_embedix = false; f.close(); } pclose(uname); } // check the Zaurus model QString model; int loc = cpu_info.find( ":" ); if ( loc != -1 ) model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); else model = cpu_info; if ( model == "SHARP Corgi" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C700"; } else if ( model == "SHARP Shepherd" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C750"; } else if ( model == "SHARP Husky" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C760 or SL-C860"; } else if ( model == "SHARP Boxer" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C760 or SL-C860"; } else if ( model == "SHARP Poodle" ) { d->m_model = Model_Zaurus_SLB600; d->m_modelstr = "Zaurus SL-B500 or SL-5600"; } else if ( model == "Sharp-Collie" || model == "Collie" ) { d->m_model = Model_Zaurus_SL5500; d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; } else if ( model == "SHARP Tosa" ) { d->m_model = Model_Zaurus_SL6000; d->m_modelstr = "Zaurus SL-6000"; } else if ( model == "SHARP Spitz" ) { @@ -421,160 +425,128 @@ int Zaurus::displayBrightnessResolution() const } bool Zaurus::setDisplayBrightness( int bright ) { //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); bool res = false; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; int numberOfSteps = displayBrightnessResolution(); int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; if ( m_embedix ) { int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); if ( fd ) { res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); ::close( fd ); } } else { int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[100]; int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); res = ( ::write( fd, &buf[0], len ) == 0 ); ::close( fd ); } } return res; } bool Zaurus::setDisplayStatus( bool on ) { bool res = false; if ( m_embedix ) { int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); if ( fd ) { int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); ::close ( fd ); } } else { int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); if ( fd ) { char buf[10]; buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; buf[1] = '\0'; res = ( ::write( fd, &buf[0], 2 ) == 0 ); ::close( fd ); } } return res; } -bool Zaurus::suspend() -{ - qDebug("ODevice::suspend"); - if ( !isQWS( ) ) // only qwsserver is allowed to suspend - return false; - - if ( d->m_model == Model_Unknown ) // better don't suspend on unknown devices - return false; - - bool res = false; - ODevice::sendSuspendmsg(); - - struct timeval tvs, tvn; - ::gettimeofday ( &tvs, 0 ); - - ::sync(); // flush fs caches - res = ( ::system ( "apm --suspend" ) == 0 ); - - // This is needed because the apm implementation is asynchronous and we - // can not be sure when exactly the device is really suspended - if ( res ) { - do { // Yes, wait 15 seconds. This APM sucks big time. - ::usleep ( 200 * 1000 ); - ::gettimeofday ( &tvn, 0 ); - } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); - } - - QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); - return res; -} - - Transformation Zaurus::rotation() const { qDebug( "Zaurus::rotation()" ); Transformation rot; switch ( d->m_model ) { case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: { OHingeStatus hs = readHingeSensor(); qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); if ( m_embedix ) { if ( hs == CASE_PORTRAIT ) rot = Rot0; else if ( hs == CASE_UNKNOWN ) rot = Rot0; else rot = Rot270; } else { if ( hs == CASE_PORTRAIT ) rot = Rot90; else if ( hs == CASE_UNKNOWN ) rot = Rot0; else rot = Rot0; } } break; case Model_Zaurus_SL6000: case Model_Zaurus_SLB600: case Model_Zaurus_SLA300: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: rot = d->m_rotation; break; } return rot; } ODirection Zaurus::direction() const { ODirection dir; switch ( d->m_model ) { case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: { OHingeStatus hs = readHingeSensor(); if ( hs == CASE_PORTRAIT ) dir = CCW; else if ( hs == CASE_UNKNOWN ) dir = CCW; else dir = CW; } break; case Model_Zaurus_SL6000: case Model_Zaurus_SLA300: case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: dir = d->m_direction; break; } return dir; } bool Zaurus::hasHingeSensor() const diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 80593ce..6e6ca46 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h @@ -1,140 +1,139 @@ /* This file is part of the Opie Project Copyright (C) The Opie Team <opie-devel@handhelds.org> =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_ZAURUS #define ODEVICE_ZAURUS -#include <opie2/odevice.h> +#include "odevice_abstractmobiledevice.h" #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif // _IO and friends are only defined in kernel headers ... #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) #define OD_IO(type,number) OD_IOC(0,type,number,0) #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) // Audio #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 */ #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) // LED #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ // Rotation and Power Management #define SHARP_IOCTL_GET_ROTATION 0x413c #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) #define APM_EVT_POWER_BUTTON (1 << 0) // Brightness Embedix #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" #define SHARP_FL_IOCTL_ON 1 #define SHARP_FL_IOCTL_OFF 2 #define SHARP_FL_IOCTL_STEP_CONTRAST 100 #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 #define SHARP_FL_IOCTL_GET_STEP 102 // Vesa Standard #define FB_BLANK_UNBLANK 0 #define FB_BLANK_POWERDOWN 4 namespace Opie { namespace Core { namespace Internal { -class Zaurus : public ODevice +class Zaurus : public OAbstractMobileDevice { protected: virtual void init(const QString&); virtual void initButtons(); public: virtual bool setDisplayBrightness( int b ); virtual bool setDisplayStatus( bool on ); virtual int displayBrightnessResolution() const; virtual void playAlarmSound(); virtual void playKeySound(); virtual void playTouchSound(); virtual QValueList <OLed> ledList() const; virtual QValueList <OLedState> ledStateList ( OLed led ) const; virtual OLedState ledState( OLed led ) const; virtual bool setLedState( OLed led, OLedState st ); virtual bool hasHingeSensor() const; virtual OHingeStatus readHingeSensor() const; - virtual bool suspend(); virtual Transformation rotation() const; virtual ODirection direction() const; protected: virtual void buzzer( int snd ); OLedState m_leds[1]; bool m_embedix; }; struct z_button { Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; }; } } } #endif |