author | wimpie <wimpie> | 2005-01-04 01:29:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:29:55 (UTC) |
commit | 5199338e990284244b8fe540d3fb4a36b24bae82 (patch) (side-by-side diff) | |
tree | bbd17e6ab0998379a1a032851d27d78bd5db201f | |
parent | 1708efc66ceab63d93960a523e247bcbfafe6e7f (diff) | |
download | opie-5199338e990284244b8fe540d3fb4a36b24bae82.zip opie-5199338e990284244b8fe540d3fb4a36b24bae82.tar.gz opie-5199338e990284244b8fe540d3fb4a36b24bae82.tar.bz2 |
added odevice_genuine for pure INTEL based CPU
-> needed for system dependend applications. being LIKE
-> an IPAQ is not enough
-rw-r--r-- | libopie2/opiecore/device/device.pro | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.cpp | 193 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.h | 84 |
5 files changed, 291 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro index 2c9e770..9a409e1 100644 --- a/libopie2/opiecore/device/device.pro +++ b/libopie2/opiecore/device/device.pro @@ -1,20 +1,22 @@ HEADERS += device/odevice.h \ device/odevicebutton.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_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 39b37cd..a824392 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -21,32 +21,33 @@ : = ...= . :.=- -. .:....=;==+<; 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_beagle.h" #include "odevice_ipaq.h" #include "odevice_jornada.h" #include "odevice_ramses.h" #include "odevice_simpad.h" #include "odevice_yopy.h" #include "odevice_zaurus.h" +#include "odevice_genuineintel.h" /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> /* OPIE */ #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/sound.h> #include <opie2/okeyfilter.h> /* STD */ @@ -130,32 +131,39 @@ ODevice *ODevice::inst() while ( !s.atEnd() ) { QString line; line = s.readLine(); if ( line.startsWith( "Hardware" ) ) { qDebug( "ODevice() - found '%s'", (const char*) line ); cpu_info = line; if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); else qWarning( "ODevice() - unknown hardware - using default." ); break; + } else if ( line.startsWith( "vendor_id" ) ) { + qDebug( "ODevice() - found '%s'", (const char*) line ); + cpu_info = line; + if( line.contains( "genuineintel", false ) ) { + dev = new Internal::GenuineIntel(); + break; + } } } } else { qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); } if ( !dev ) dev = new ODevice(); dev->init(cpu_info); } return dev; } ODevice::ODevice() { d = new ODeviceData; diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 21fcc3f..93d7d22 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -94,59 +94,63 @@ enum OModel { Model_Ramses_All = ( Model_Ramses | 0xffffff ), Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), Model_Yopy = ( 5 << 24 ), Model_Yopy_All = ( Model_Yopy | 0xffffff ), Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), Model_Beagle = ( 6 << 24 ), Model_Beagle_All = ( Model_Beagle | 0xffffff ), Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), + Model_GenuineIntel = ( 7 << 24 ) + }; /** * The vendor of the device */ enum OVendor { Vendor_Unknown, Vendor_HP, Vendor_Sharp, Vendor_SIEMENS, Vendor_MundN, Vendor_GMate, Vendor_MasterIA, + Vendor_GenuineIntel }; /** * The System used */ enum OSystem { System_Unknown, System_Familiar, System_Zaurus, System_OpenZaurus, System_Linupy, System_OpenEmbedded, + System_PC }; typedef struct { OSystem system; char* sysstr; char* sysvfile; } ODistribution; extern ODistribution distributions[]; enum OLedState { Led_Off, Led_On, Led_BlinkSlow, Led_BlinkFast diff --git a/libopie2/opiecore/device/odevice_genuineintel.cpp b/libopie2/opiecore/device/odevice_genuineintel.cpp new file mode 100644 index 0000000..61ba052 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_genuineintel.cpp @@ -0,0 +1,193 @@ +/* + This file is part of the Opie Project + Copyright (C) 2002,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. +*/ + +#include "odevice_genuineintel.h" + +/* QT */ +#include <qapplication.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qwindowsystem_qws.h> + +/* OPIE */ +#include <qpe/config.h> +#include <qpe/resource.h> +#include <qpe/sound.h> +#include <qpe/qcopenvelope_qws.h> +#include <opie2/okeyfilter.h> + +#ifndef QT_NO_SOUND +#include <linux/soundcard.h> +#endif + +using namespace Opie::Core; +using namespace Opie::Core::Internal; + +struct gi_button genuineintel_buttons [] = { + { + Qt::Key_F1, QT_TRANSLATE_NOOP("Button", "Calendar Button"), + "devicebuttons/ipaq_calendar", + "datebook", "nextView()", + "today", "raise()" }, + { + Qt::Key_F2, QT_TRANSLATE_NOOP("Button", "Contacts Button"), + "devicebuttons/ipaq_contact", + "addressbook", "raise()", + "addressbook", "beamBusinessCard()" }, + { + Qt::Key_F3, QT_TRANSLATE_NOOP("Button", "Menu Button"), + "devicebuttons/ipaq_menu", + "QPE/TaskBar", "toggleMenu()", + "QPE/TaskBar", "toggleStartMenu()" }, + { + Qt::Key_F4, QT_TRANSLATE_NOOP("Button", "Mail Button"), + "devicebuttons/ipaq_mail", + "opiemail", "raise()", + "opiemail", "newMail()" }, + { + Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Home Button"), + "devicebuttons/ipaq_home", + "QPE/Launcher", "home()", + "buttonsettings", "raise()" }, + { + Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Record Button"), + "devicebuttons/ipaq_record", + "QPE/VMemo", "toggleRecord()", + "sound", "raise()" }, +}; + +void GenuineIntel::init(const QString& model) +{ + d->m_vendorstr = "Intel"; + d->m_vendor = Vendor_GenuineIntel; + + QStringList SL = QStringList::split( " ", model ); + + d->m_model = Model_GenuineIntel; + d->m_rotation = Rot0; +} + +void GenuineIntel::initButtons() +{ + if ( d->m_buttons ) + return; + + if ( isQWS( ) ) { + addPreHandler(this); + } + + d->m_buttons = new QValueList <ODeviceButton>; + + for ( uint i = 0; i < ( sizeof( genuineintel_buttons ) / sizeof( gi_button )); i++ ) { + gi_button *ib = genuineintel_buttons + i; + ODeviceButton b; + + 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(); +} + +QValueList <OLed> GenuineIntel::ledList() const +{ + QValueList <OLed> vl; + return vl; //none +} + +QValueList <OLedState> GenuineIntel::ledStateList ( OLed ) const +{ + QValueList <OLedState> vl; + return vl; // none +} + +OLedState GenuineIntel::ledState ( OLed ) const +{ + return Led_Off; +} + +bool GenuineIntel::setLedState ( OLed , OLedState ) +{ + return false; +} + + +bool GenuineIntel::filter ( int /*unicode*/, int , int , bool , bool ) +{ + return false; +} + +void GenuineIntel::playAlarmSound() +{ +#ifndef QT_NO_SOUND + static Sound snd ( "alarm" ); + if(!snd.isFinished()) + return; + + changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); + snd. play(); +#endif +} + + +bool GenuineIntel::setSoftSuspend ( bool ) +{ + return false; +} + + +bool GenuineIntel::setDisplayBrightness ( int ) +{ + return false; +} + +int GenuineIntel::displayBrightnessResolution() const +{ + return 1; // perhaps to avoid division by zero +} + + +bool GenuineIntel::hasLightSensor() const +{ + return false; +} + +int GenuineIntel::readLightSensor() +{ + return 0; +} + +int GenuineIntel::lightSensorResolution() const +{ + return 1; // see above +} diff --git a/libopie2/opiecore/device/odevice_genuineintel.h b/libopie2/opiecore/device/odevice_genuineintel.h new file mode 100644 index 0000000..52c5fc6 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_genuineintel.h @@ -0,0 +1,84 @@ +/* + 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_GENUINEINTEL +#define ODEVICE_GENUINEINTEL + +#include "odevice.h" + +/* QT */ +#include <qwindowsystem_qws.h> + +namespace Opie { +namespace Core { +namespace Internal { + +class GenuineIntel : public ODevice, public QWSServer::KeyboardFilter +{ + + protected: + virtual void init(const QString&); + virtual void initButtons(); + + public: + virtual bool setSoftSuspend( bool soft ); + + 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 ); + +}; + +struct gi_button { + Qt::Key code; + char *utext; + char *pix; + char *fpressedservice; + char *fpressedaction; + char *fheldservice; + char *fheldaction; +}; + +} +} +} + +#endif |