summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2006-05-19 12:22:12 (UTC)
committer mickeyl <mickeyl>2006-05-19 12:22:12 (UTC)
commit0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc (patch) (side-by-side diff)
treef29beee42524c33b0a6c7f2079ecb610db6366b0
parentf2dc2fbeca42a87e1779696477b4caaf89a10614 (diff)
downloadopie-0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc.zip
opie-0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc.tar.gz
opie-0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc.tar.bz2
add preliminary support for the Motorola EZX Linux phone platform
see http://openezx.org
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog3
-rw-r--r--README3
-rw-r--r--libopie2/opiecore/device/device.pro14
-rw-r--r--libopie2/opiecore/device/odevice.cpp4
-rw-r--r--libopie2/opiecore/device/odevice.h24
-rw-r--r--libopie2/opiecore/device/odevice_motorola_ezx.cpp325
-rw-r--r--libopie2/opiecore/device/odevice_motorola_ezx.h102
7 files changed, 457 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index ce51dab..db5c0ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,202 +1,203 @@
2005-??-?? Opie 1.2.2
New Features
------------
* Appearance: Added configuration options to set smallIconSize, bigIconSize, useBigPixmaps (hrw, drw)
* Opie-Notes: Notes application based on NoteZ (hrw)
* Opie-PackageManager: Added two configuration options: "Force recursive", "Verbose fetch" (hrw)
* Added hardware support for HTC Universal (ljp)
- * Make Opie-Bluetooth subsystem actually usable (korovkin)
+ * Made Opie-Bluetooth subsystem actually usable (korovkin)
+ * Added hardware support for the Motorola EZX platform (mickeyl)
Fixed Bugs
----------
* #1695 - Date selector use too small fontsize on VGA screen (hrw)
* #1686 - opie-console lack UI setting for switching scrollbar (hrw)
* #1647 - Opie-console doesn't respect scroll-bar on left side (hrw)
* #1624 - Button settngs changes are applied only after restart (hrw)
* #1492 - Backup and Restore does not show list of backups to restore on start (hrw)
* n.a. - remove hardcoded font size from wellenreiter (hrw)
* n.a. - added patch to build QT/E 2.3.10 with gcc 4.x.x (hrw)
* n.a. - make blue-pin UI resizable to looks good in any resolution (hrw)
* n.a. - fix a problem with vCard send to Sony Ericsson k600i (ar)
* n.a. - add a patch to build Qt/E 2.3.10 on amd64 with gcc 4.x.x (ar)
* n.a. - Opie-console fallback to FixedFont settings from qpe.conf in config (hrw)
* n.a. - Set version to 1.2.1 in About applet (hrw)
* n.a. - add firstusage and background pictures for 480x640 devices (mickeyl)
* n.a. - many bluetooth fixes (korovkin)
Internal
--------
* libopiecore: /etc/oz_version renamed to /etc/openzaurus-version (hrw)
* libopiecore: SL6000 (tosa) now uses corgi-bl (Dirk Opfer)
* library/version.h: introduce integer version code in OPIE_VERSION for conditional compilation
2005-09-11 Opie 1.2.1
New Features
------------
* OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
* Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly)
* Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer)
* Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl)
* Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl)
* Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl)
* Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw)
* ZSafe: Made UI conform to Opie standards (drw)
* Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw)
* Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl)
* Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl)
* SysInfo: Remove CPU tab and add Devices tab instead (mickeyl)
* Opie-smb: Added Opie front end for Samba (ljp)
* Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie)
* Opieplayer: rudimentary podcast support (ljp)
Fixed Bugs
----------
* #1377 - Suspend Powermanagement when switched to another VT (mickeyl)
- We actually suspend the complete Opie now in that case.
* #1384 - Battery status updated improperly when charging (skyhusker)
* #1476 - Wrong order of application entries in the O-menu (skyhusker)
* #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl)
* #1535 - Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
* #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw)
* #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker)
* #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker)
* #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
* #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
* #1635 - opie-today, datebook-plugin does not show notes (skyhusker)
* #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker)
* #1666 - Opie-IRC does not allow to add !channels in config as autojoin ones (skyhusker)
* #1667 - Opie-IRC does not show messages from !channel (skyhusker)
* #1679 - Security PIN plugin is QVGA sized (hrw)
* #1682 - Properly resize tab control in OTabWidget (drw)
* n.a. - always show volume and wireless applet popups inside visible screen (deller)
* n.a. - scale O-Menu-Applets appropriately (mickeyl)
* n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
* n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl)
* n.a. - scale BluezApplet appropriately and use larger icons (mickeyl)
* n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
* n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl)
* n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw)
* n.a. - remove hardcoded font size from netsystemtime (hrw)
* n.a. - remove hardcoded font size from checkbook graphs (hrw)
* n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw)
Internal
--------
* Make BluezApplet use OTaskbarApplet (mickeyl)
* libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl)
* libopiecore: add ODirNotification - recursive directory notifications (mickeyl)
* libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl)
* libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl)
* libopienet: Miscellaneous API cleanups (mickeyl)
* libopiecore: Add linux pcmcia system abstraction classes (mickeyl)
* libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl)
* libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl)
* libopiecore: Add support for the new Linux Inputsystem Switches type [necessary for auto rotation in 2.6.13] (mickeyl)
* Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl)
* Fix / Optimize number of scanned directories (ljp)
* Use five point mouse calibration to make calibrated mouse drivers work on newer Zaurii (rp,mickeyl)
2005-03-25 Opie 1.2.0
Fixed Bugs
----------
* #1613 - AdvancedFM - scale toolbar icons appropriately (drw)
* #1620 - OFileSelector - show the button on press and not on press on hold (alwin)
* #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke)
* n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw)
* n.a. - make qpeglobal.h include qglobal.h (zecke)
2005-03-20 Opie 1.2.0-rc1
New Features
------------
* Launcher: Support a static background pixmap (mickeyl)
* LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
* PackageManager supports the 'lists_dir' ipkg configuration option (drw)
* Added hi-res inline images for large resolution devices (drw)
* Improved launcher icons for consistency (ar)
* Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin)
Fixed Bugs
----------
* #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
* #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw)
* #1472 - Opie textedit now check for unsaved changes on ESC key (ljp)
* #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
* #1482 - Fix double '/' in paths (zecke)
* #1536 - Autosave of custom locations in opie backup (ar)
* #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
* #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
* #1542 - Fixed Todo crash when priority < 1 or > 5 (drw)
* #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke)
* #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
* #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
* #1558 - Fixed opie-login breaking opie startup (mickeyl)
* #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning)
* #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar)
* #1591 - Addressbook sortorder changed by clicking on column 0 (eilers)
* #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints)
* #1604 - Checkbook crashed on startup (drw)
* #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers)
* #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers)
* n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw)
* n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw)
* n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw)
* n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw)
* n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw)
* n.a. - AddressBook - fixed sorting by 'File As' name (drw)
* n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers)
* n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw)
Internal
--------
* Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl)
* Killed the need for weak symbols in QtE (zecke)
* Added optional building libqpe without inline images (mickeyl)
* OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw)
2005-02-03 Opie 1.1.9
New Features
------------
* Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
* Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl)
* Usability enhancements in OpieIRC (skyhusker)
Fixed Bugs
----------
* #1501 - Fixed bug in todo sql backend (eilers)
* #1505 - Added more Swap sizes in memoryapplet (mickeyl)
* #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke)
* #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke)
* n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
* n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl)
* n.a. - Fixed numerous buglets in OpieIRC (skyhusker)
Internal
--------
* Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
* You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl)
* Made Opie compilable with Qt/Embedded 2.3.10 (ar)
* Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl)
* Build tree cleanups (mickeyl)
2004-11-26 Opie 1.1.8
New Features
------------
* PackageManager supports installation of local ipkg files (drw)
* PackageManager supports linking of applications to root (drw)
* PackageManager supports src/gz feeds (drw,wimpie)
* Added a syslog information tab to sysinfo (mickeyl)
* Added new, more consistent, PIM icons + a GIMP teplate (ar)
Fixed Bugs
----------
* #1017 - Tetrix doesn't display correctly for high resolution screens (drw)
diff --git a/README b/README
index 89a9892..0c6ef68 100644
--- a/README
+++ b/README
@@ -1,109 +1,112 @@
1. How to use the Opie build system
====================================
There's a tutorial document at:
http://www.uv-ac.de/opiedev/opiedev.html
The API reference currently is at:
http://handhelds.org/~zecke/apidocs/index.html
You will need qvfb, uic and
(if you want to develop applications) designer
compiled and linked against Qt/X11.
That means you must download and configure/make it:
wget ftp://ftp.trolltech.com/qt/source/qt-x11-2.3.2.tar.gz
(Alternatively, you can get static binaries from http://www.vanille.de/tools)
You will need Qt/Embedded 2.3.10. Note that we don't support any
other Qt/Embedded version anymore.
You can get it from:
ftp://ftp.trolltech.com/qt/source/qt-embedded-2.3.10-free.tar.bz2
Set QTDIR to point to your qt/embedded source tree, such as:
export QTDIR=/opt/qt-2.3.10
You need to do set the OPIEDIR environment variable:
export OPIEDIR=`pwd`
or
export OPIEDIR=~/projects/sources/opie
or wherever you placed the Opie sources.
You need to adjust your runtime library search path,
so that the Qt/Embedded and Opie libraries can be found:
export LD_LIBRARY_PATH=$OPIEDIR/lib:$QTDIR/lib:$LD_LIBRARY_PATH
You have to apply the patches corresponding to your Qt/Embedded version
and copy the qconfig-qpe.h file to $QTDIR/src/tools:
cd $QTDIR; cat $OPIEDIR/qt/qt-<version>.patch/qte<version>-all.patch | patch -p1
cp $OPIEDIR/qt/qconfig-qpe.h $QTDIR/src/tools
You are now ready to configure and build Qt/Embedded
cd $QTDIR
echo 'yes' | ./configure -qconfig qpe -depths 4,16,24,32 -system-jpeg -system-libpng -system-zlib -no-xkb -no-sm -no-xft -qvfb
make
Note that the above command ( -qvfb ) compiles in the Virtual
Framebuffer and is mostly meant for development on your host system.
For cross compiling, you will need to use the -xplatform switch.
See ./configure --help for details about the possible options.
Once you have these compiled, be sure to set the PATH to ensure your (cross)compiler
is available.
Then do the following in the opie source tree:
make clean
make menuconfig
Now you can move through the menu and select or deselect anything..
Exit and save the configuration and enter "make" to build everything selected.
Have fun!
2. Required Libraries
=====================
For a successful Opie build, you need to install the following libraries and headers:
* libsdl >= 1.2.0
http://www.libsdl.org/download-1.2.php
* libxine >= 1.0
http://prdownloads.sourceforge.net/xine/
* libpcap >= 0.7.2
http://www.tcpdump.org/release/
* libetpan >= 0.34
http://prdownloads.sourceforge.net/libetpan/
* libsqlite >= 3.0.0
http://www.sqlite.org/download.html
* libipk >= 138
ftp://handhelds.org/linux/packages/ipkg
* libobexftp >= 0.19
http://triq.net/obexftp.html
3. Required Programs
====================
For a successful usage of Opie, you should install the following programs:
* obexftpd
* obextool
4. Supported Devices
====================
Sharp Zaurus SL-5x00, SL-B500, SL-C7x0, SL-C8x0, SL-C1000, SL-C3000, SL-C3100, SL-6000
HP iPAQ 36xx, 37xx, 38xx, 39xx, 54xx, 55xx
SIEMENS SIMpad CL4, SL4, SLC, T-SinusPAD
MasterIA Beagle, Tradesquare.NL Tuxpad 1
GMate Yopy 3x00
+
+Motorola EZX A780, E680
+
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro
index 0954733..b517032 100644
--- a/libopie2/opiecore/device/device.pro
+++ b/libopie2/opiecore/device/device.pro
@@ -1,28 +1,30 @@
HEADERS += device/odevice.h \
device/odevicebutton.h \
- device/odevice_abstractmobiledevice.h \
- device/odevice_beagle.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 \
device/odevice_mypal.h \
- device/odevice_htc.h
+ device/odevice_htc.h \
+ device/odevice_motorola_ezx.h
SOURCES += device/odevice.cpp \
device/odevicebutton.cpp \
- device/odevice_abstractmobiledevice.cpp \
- device/odevice_beagle.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 \
device/odevice_mypal.cpp \
- device/odevice_htc.cpp
+ device/odevice_htc.cpp \
+ device/odevice_motorola_ezx.cpp
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index c6e031f..8f5be8b 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -1,340 +1,342 @@
/*
                This file is part of the Opie Project
- =. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
+ =. (C) 2002-2006 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; version 2 of the License.
     ._= =}       :
    .%`+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_beagle.h"
#include "odevice_ipaq.h"
#include "odevice_mypal.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"
#include "odevice_htc.h"
+#include "odevice_motorola_ezx.h"
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/sound.h>
#include <opie2/okeyfilter.h>
#include <opie2/oresource.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
namespace Opie {
namespace Core {
static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
/* STATIC and common implementation */
/* EXPORT */ ODistribution distributions[] = {
{ System_Familiar, "FamiliarLinux", "/etc/familiar-version" },
{ System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" },
{ System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" },
{ System_Unknown, "Linux", "/etc/issue" },
};
/* EXPORT */ bool isQWS(){
return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
}
/* EXPORT */ QCString makeChannel ( const char *str ){
if ( str && !::strchr ( str, '/' ))
return QCString ( "QPE/Application/" ) + str;
else
return str;
}
/* Now the default implementation of ODevice */
struct default_button default_buttons [] = {
{ 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()" },
};
ODevice *ODevice::inst()
{
static ODevice *dev = 0;
QString cpu_info;
if ( !dev )
{
QFile f( PATH_PROC_CPUINFO );
if ( f.open( IO_ReadOnly ) )
{
QTextStream s( &f );
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( "mypal", false ) ) dev = new Internal::MyPal();
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 if ( line.contains( "HTC", false ) ) dev = new Internal::HTC();
+ else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX();
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;
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_direction = CW;
d->m_qteDriver = "Transformed";
d->m_holdtime = 1000; // 1000ms
d->m_buttons = 0;
d->m_cpu_frequencies = new QStrList;
/* mixer */
d->m_sound = d->m_vol = d->m_mixer = -1;
/* System QCopChannel created */
d->m_initializedButtonQcop = false;
// New distribution detection code first checks for legacy distributions,
// 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)/sizeof(ODistribution); ++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 ( OResource::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;
}
/**
* 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
}
/**
* 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
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 2566979..9afb92d 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,397 +1,401 @@
/*
                This file is part of the Opie Project
-              Copyright (C) The Opie Team <opie-devel@handhelds.org>
+              (C) 2002-2006 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.
+ - .   .-<_>     .<> Foundation; version 2 of the License.
+     ._= =}       :
    .%`+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_H_
#define ODEVICE_H_
/* OPIE */
#include <opie2/odevicebutton.h>
#include <qpe/qpeapplication.h> /* for Transformation enum.. */
/* QT */
#include <qnamespace.h>
#include <qobject.h>
#include <qstring.h>
#include <qstrlist.h>
#include <qwindowsystem_qws.h>
class Sound;
namespace Opie{
namespace Core{
class ODeviceData;
/**
* The available devices
*/
enum OModel {
Model_Unknown, // = 0
Model_Series_Mask = 0xffff0000,
Model_iPAQ = ( 1 << 16 ),
Model_iPAQ_All = ( Model_iPAQ | 0xffff ),
Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ),
Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ),
Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ),
Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ),
Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ),
Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ),
Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ),
Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ),
Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ),
Model_iPAQ_HX4700 = ( Model_iPAQ | 0x000A ),
Model_Jornada = ( 6 << 16 ),
Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
Model_Zaurus = ( 2 << 16 ),
Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
Model_SIMpad = ( 3 << 16 ),
Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
Model_Ramses = ( 4 << 16 ),
Model_Ramses_All = ( Model_Ramses | 0xffff ),
Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ),
Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ),
Model_Yopy = ( 5 << 16 ),
Model_Yopy_All = ( Model_Yopy | 0xffff ),
Model_Yopy_3000 = ( Model_Yopy | 0x0001 ),
Model_Yopy_3500 = ( Model_Yopy | 0x0002 ),
Model_Yopy_3700 = ( Model_Yopy | 0x0003 ),
Model_Beagle = ( 6 << 16 ),
Model_Beagle_All = ( Model_Beagle | 0xffff ),
Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ),
Model_GenuineIntel = ( 7 << 16 ),
Model_MyPal = ( 8 << 16 ),
Model_MyPal_All = ( Model_MyPal | 0xffff ),
Model_MyPal_620 = ( Model_MyPal | 0x0001 ),
Model_MyPal_716 = ( Model_MyPal | 0x0002 ),
Model_MyPal_730 = ( Model_MyPal | 0x0003 ),
Model_HTC = ( 9 << 16 ),
Model_HTC_All = ( Model_HTC | 0xffff ),
- Model_HTC_Universal = ( Model_HTC | 0x0001 )
+ Model_HTC_Universal = ( Model_HTC | 0x0001 ),
+
+ Model_Motorola = ( 9 << 17 ),
+ Model_Motorola_All = ( Model_Motorola | 0xffff ),
+ Model_Motorola_EZX = ( Model_Motorola | 0x0001 ),
+
};
/**
* The vendor of the device
*/
enum OVendor {
Vendor_Unknown,
Vendor_HP,
Vendor_Sharp,
Vendor_SIEMENS,
Vendor_MundN,
Vendor_GMate,
Vendor_MasterIA,
Vendor_GenuineIntel,
Vendor_Asus,
- Vendor_HTC
+ Vendor_HTC,
+ Vendor_Motorola,
};
/**
* The System used
*/
enum OSystem {
System_Unknown,
System_Familiar,
System_Zaurus,
System_OpenZaurus,
System_Linupy,
System_OpenEmbedded,
- System_PC
+ System_PC,
+ System_OpenEZX,
+ System_Angstrom,
};
typedef struct {
OSystem system;
char* sysstr;
char* sysvfile;
} ODistribution;
extern ODistribution distributions[];
enum OLedState {
Led_Off,
Led_On,
Led_BlinkSlow,
Led_BlinkFast
};
enum OLed {
Led_Mail,
Led_Power,
Led_BlueTooth
};
enum OHardKey {
HardKey_Datebook = Qt::Key_F9,
HardKey_Contacts = Qt::Key_F10,
HardKey_Menu = Qt::Key_F11,
HardKey_Home = Qt::Key_F12,
HardKey_Mail = Qt::Key_F13,
HardKey_Record = Qt::Key_F24,
HardKey_Suspend = Qt::Key_F34,
HardKey_Backlight = Qt::Key_F35,
HardKey_Action = Qt::Key_F10,
HardKey_OK = Qt::Key_F11,
HardKey_End = Qt::Key_F12,
};
enum ODirection {
CW = 0,
CCW = 1,
Flip = 2,
};
enum OHingeStatus {
CASE_CLOSED = 3,
CASE_PORTRAIT = 2,
CASE_LANDSCAPE = 0,
CASE_UNKNOWN = 1,
};
/* default button for qvfb or such
* see odevice.cpp for details.
* hint: manage a user defined button for qvfb?
* alwin
*/
struct default_button {
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
/**
* 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 specific options
* @see QObject
* @author Robert Griebl
* @version 1.0
*/
class ODevice : public QObject
{
Q_OBJECT
private:
/* disable copy */
ODevice ( const ODevice & );
protected:
ODevice();
virtual void init(const QString&);
virtual void initButtons();
static void sendSuspendmsg();
ODeviceData *d;
public:
// sandman do we want to allow destructions? -zecke?
virtual ~ODevice();
static ODevice *inst();
// information
QString modelString() const;
OModel model() const;
inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
QString vendorString() const;
OVendor vendor() const;
QString systemString() const;
OSystem system() const;
QString systemVersionString() const;
virtual Transformation rotation() const;
virtual ODirection direction() const;
QString qteDriver() const;
// system
virtual bool suspend();
virtual bool setDisplayStatus ( bool on );
virtual bool setDisplayBrightness ( int brightness );
virtual int displayBrightnessResolution() const;
virtual bool setDisplayContrast ( int contrast );
virtual int displayContrastResolution() const;
// don't add new virtual methods, use this:
// /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
// and in your subclass do overwrite
// protected virtual int virtual_hook(int, void *)
// which is defined below
// input / output
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 hasLightSensor() const;
virtual int readLightSensor();
virtual int lightSensorResolution() const;
virtual bool hasHingeSensor() const;
virtual OHingeStatus readHingeSensor()const;
const QStrList &allowedCpuFrequencies() const;
bool setCurrentCpuFrequency(uint index);
/**
* Returns the available buttons on this device. The number and location
* of buttons will vary depending on the device. Button numbers will be assigned
* by the device manufacturer and will be from most preferred button to least preffered
* button. Note that this list only contains "user mappable" buttons.
*
* @todo Make method const and take care of calling initButtons or make that const too
*
*/
const QValueList<ODeviceButton> &buttons();
/**
* Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
* returns 0L
*/
const ODeviceButton *buttonForKeycode ( ushort keyCode );
/**
* Reassigns the pressed action for \a button. To return to the factory
* default pass an empty string as \a qcopMessage.
*/
void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
/**
* Reassigns the held action for \a button. To return to the factory
* default pass an empty string as \a qcopMessage.
*/
void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
/**
* How long (in ms) you have to press a button for a "hold" action
*/
uint buttonHoldTime() const;
signals:
void buttonMappingChanged();
private slots:
void systemMessage ( const QCString &, const QByteArray & );
void playingStopped();
protected:
void addPreHandler(QWSServer::KeyboardFilter*aFilter);
void remPreHandler(QWSServer::KeyboardFilter*aFilter);
void reloadButtonMapping();
void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
/* ugly virtual hook */
virtual void virtual_hook( int id, void* data );
};
class ODeviceData {
public:
QString m_vendorstr;
OVendor m_vendor;
QString m_modelstr;
OModel m_model;
QString m_systemstr;
OSystem m_system;
QString m_sysverstr;
Transformation m_rotation;
ODirection m_direction;
QString m_qteDriver;
QValueList <ODeviceButton> *m_buttons;
uint m_holdtime;
QStrList *m_cpu_frequencies;
bool m_initializedButtonQcop : 1;
/* values for changeMixerForAlarm */
int m_sound, m_vol, m_mixer;
};
extern bool isQWS();
extern QCString makeChannel ( const char *str );
}
}
-
-
-
#endif
-
diff --git a/libopie2/opiecore/device/odevice_motorola_ezx.cpp b/libopie2/opiecore/device/odevice_motorola_ezx.cpp
new file mode 100644
index 0000000..69256dd
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_motorola_ezx.cpp
@@ -0,0 +1,325 @@
+/*
+                 This file is part of the Opie Project
+ =. (C) 2006 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; version 2 of the License.
+     ._= =}       :
+    .%`+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_motorola_ezx.h"
+
+/* OPIE */
+#include <opie2/oinputsystem.h>
+#include <opie2/oresource.h>
+
+#include <qpe/config.h>
+#include <qpe/sound.h>
+
+/* QT */
+#include <qapplication.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qwindowsystem_qws.h>
+#include <qcopchannel_qws.h>
+
+/* STD */
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <unistd.h>
+#ifndef QT_NO_SOUND
+#include <linux/soundcard.h>
+#endif
+
+using namespace Opie::Core;
+using namespace Opie::Core::Internal;
+
+struct ezx_button ezx_buttons [] = {
+ { 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()" },
+};
+
+void Motorola_EZX::init(const QString& cpu_info)
+{
+ qDebug( "Motorola_EZX::init()" );
+ // Set the time to wait until the system is really suspended
+ // the delta between apm --suspend and sleeping
+ setAPMTimeOut( 15000 );
+
+ d->m_vendorstr = "OpenEZX Team";
+ d->m_systemstr = "OpenEZX";
+ d->m_system = System_OpenEZX;
+ // sysver already gathered
+
+ // check the Motorola_EZX model
+ QString model;
+ int loc = cpu_info.find( ":" );
+ if ( loc != -1 )
+ model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
+ else
+ model = cpu_info;
+
+ if ( model == "Motorola Ezx Platform" ) {
+ d->m_model = Model_Motorola_EZX;
+ d->m_modelstr = "Motorola_EZX";
+ } else assert( 0 );
+
+ // set path to backlight device in kernel 2.6
+ m_backlightdev = "/sys/class/backlight/ezx-bl/";
+ d->m_rotation = Rot0;
+ //initHingeSensor();
+
+ // set default qte driver and led state
+ d->m_qteDriver = "Transformed";
+ m_leds[0] = Led_Off;
+
+ qDebug( "Motorola_EZX::init() - Using the 2.6 OpenEZX HAL on a %s", (const char*) d->m_modelstr );
+}
+
+void Motorola_EZX::initButtons()
+{
+ qDebug( "Motorola_EZX::initButtons()" );
+ if ( d->m_buttons )
+ return;
+
+ d->m_buttons = new QValueList <ODeviceButton>;
+
+ struct ezx_button * ezx_buttons;
+ int buttoncount;
+
+/*
+
+ switch ( d->m_model )
+ {
+ case Model_Motorola_EZX_SL6000:
+ pezx_buttons = ezx_buttons_6000;
+ buttoncount = ARRAY_SIZE(ezx_buttons_6000);
+ break;
+ case Model_Motorola_EZX_SLC3100: // fallthrough
+ case Model_Motorola_EZX_SLC3000: // fallthrough
+ case Model_Motorola_EZX_SLC1000: // fallthrough
+ case Model_Motorola_EZX_SLC7x0:
+ if ( isQWS( ) )
+ {
+ addPreHandler(this);
+ }
+ pezx_buttons = ezx_buttons_c700;
+ buttoncount = ARRAY_SIZE(ezx_buttons_c700);
+ break;
+ default:
+ pezx_buttons = ezx_buttons;
+ buttoncount = ARRAY_SIZE(ezx_buttons);
+ break;
+ }
+
+ for ( int i = 0; i < buttoncount; i++ ) {
+ struct ezx_button *zb = pezx_buttons + i;
+ ODeviceButton b;
+
+ b.setKeycode( zb->code );
+ b.setUserText( QObject::tr( "Button", zb->utext ));
+ b.setPixmap( OResource::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();
+}
+
+void Motorola_EZX::playAlarmSound()
+{
+#ifndef QT_NO_SOUND
+ static Sound snd ( "alarm" );
+ if(!snd.isFinished())
+ return;
+
+ changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
+ snd. play();
+#endif
+}
+
+QValueList <OLed> Motorola_EZX::ledList() const
+{
+ QValueList <OLed> vl;
+ vl << Led_Mail;
+ return vl;
+}
+
+QValueList <OLedState> Motorola_EZX::ledStateList( OLed l ) const
+{
+ QValueList <OLedState> vl;
+
+ if ( l == Led_Mail )
+ vl << Led_Off << Led_On << Led_BlinkSlow;
+ return vl;
+}
+
+OLedState Motorola_EZX::ledState( OLed which ) const
+{
+ if ( which == Led_Mail )
+ return m_leds [0];
+ else
+ return Led_Off;
+}
+
+bool Motorola_EZX::setLedState( OLed which, OLedState st )
+{
+ // Currently not supported
+ qDebug( "Motorola_EZX::setLedState: ODevice handling not yet implemented" );
+ return false;
+}
+
+int Motorola_EZX::displayBrightnessResolution() const
+{
+ // Currently not supported
+ qDebug( "Motorola_EZX::displayBrightnessResolution: ODevice handling not yet implemented" );
+ return 100;
+
+#if 0
+ int res = 1;
+ if (m_embedix)
+ {
+ int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
+ if ( fd )
+ {
+ int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
+ ::close( fd );
+ return value ? value : res;
+ }
+ }
+ else
+ {
+ int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
+ if ( fd )
+ {
+ char buf[100];
+ if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
+ ::close( fd );
+ }
+ }
+ return res;
+#endif
+}
+
+bool Motorola_EZX::setDisplayBrightness( int bright )
+{
+ qDebug( "Motorola_EZX::setDisplayBrightness( %d )", bright );
+ return false;
+
+#if 0
+ 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( m_backlightdev + "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;
+#endif
+}
+
+bool Motorola_EZX::setDisplayStatus( bool on )
+{
+ bool res = false;
+ int fd = ::open( m_backlightdev + "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;
+}
+
+void Motorola_EZX::systemMessage( const QCString &msg, const QByteArray & )
+{
+ if ( msg == "deviceButtonMappingChanged()" ) {
+ reloadButtonMapping();
+ }
+}
+
+bool Motorola_EZX::suspend() {
+ if ( !isQWS( ) ) // only qwsserver is allowed to suspend
+ return false;
+
+ bool res = false;
+ QCopChannel::send( "QPE/System", "aboutToSuspend()" );
+
+ struct timeval tvs, tvn;
+ ::gettimeofday ( &tvs, 0 );
+
+ ::sync(); // flush fs caches
+ res = ( ::system ( "apm --suspend" ) == 0 );
+
+ QCopChannel::send( "QPE/System", "returnFromSuspend()" );
+
+ return res;
+}
diff --git a/libopie2/opiecore/device/odevice_motorola_ezx.h b/libopie2/opiecore/device/odevice_motorola_ezx.h
new file mode 100644
index 0000000..c0bd6c7
--- a/dev/null
+++ b/libopie2/opiecore/device/odevice_motorola_ezx.h
@@ -0,0 +1,102 @@
+/*
+                 This file is part of the Opie Project
+ =. (C) 2006 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; version 2 of the License.
+     ._= =}       :
+    .%`+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_MOTOROLA_EZX
+#define ODEVICE_MOTOROLA_EZX
+
+#include "odevice_abstractmobiledevice.h"
+
+/* QT */
+#include <qfile.h>
+#include <qwindowsystem_qws.h>
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+// Audio
+// LED
+// Power Management
+#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
+#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
+#define APM_EVT_POWER_BUTTON (1 << 0)
+
+// Vesa Standard
+#define FB_BLANK_UNBLANK 0
+#define FB_BLANK_POWERDOWN 4
+
+namespace Opie {
+namespace Core {
+namespace Internal {
+
+class Motorola_EZX : public OAbstractMobileDevice
+{
+ 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;
+
+ 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 suspend();
+
+ protected:
+ QString m_backlightdev;
+ OLedState m_leds[1];
+ QFile m_hinge;
+};
+
+struct ezx_button {
+ Qt::Key code;
+ char *utext;
+ char *pix;
+ char *fpressedservice;
+ char *fpressedaction;
+ char *fheldservice;
+ char *fheldaction;
+};
+}
+}
+}
+#endif