author | mickeyl <mickeyl> | 2006-05-19 12:22:12 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2006-05-19 12:22:12 (UTC) |
commit | 0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc (patch) (unidiff) | |
tree | f29beee42524c33b0a6c7f2079ecb610db6366b0 /libopie2 | |
parent | f2dc2fbeca42a87e1779696477b4caaf89a10614 (diff) | |
download | opie-0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc.zip opie-0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc.tar.gz opie-0a37c2f7c92ca6b0b6357271b02fb871e0afcbdc.tar.bz2 |
add preliminary support for the Motorola EZX Linux phone platform
see http://openezx.org
-rw-r--r-- | libopie2/opiecore/device/device.pro | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 24 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_motorola_ezx.cpp | 325 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_motorola_ezx.h | 102 |
5 files changed, 448 insertions, 13 deletions
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 @@ | |||
1 | HEADERS += device/odevice.h \ | 1 | HEADERS += device/odevice.h \ |
2 | device/odevicebutton.h \ | 2 | device/odevicebutton.h \ |
3 | device/odevice_abstractmobiledevice.h \ | 3 | device/odevice_abstractmobiledevice.h \ |
4 | device/odevice_beagle.h \ | 4 | device/odevice_beagle.h \ |
5 | device/odevice_ipaq.h \ | 5 | device/odevice_ipaq.h \ |
6 | device/odevice_jornada.h \ | 6 | device/odevice_jornada.h \ |
7 | device/odevice_ramses.h \ | 7 | device/odevice_ramses.h \ |
8 | device/odevice_simpad.h \ | 8 | device/odevice_simpad.h \ |
9 | device/odevice_zaurus.h \ | 9 | device/odevice_zaurus.h \ |
10 | device/odevice_genuineintel.h \ | 10 | device/odevice_genuineintel.h \ |
11 | device/odevice_yopy.h \ | 11 | device/odevice_yopy.h \ |
12 | device/odevice_mypal.h \ | 12 | device/odevice_mypal.h \ |
13 | device/odevice_htc.h | 13 | device/odevice_htc.h \ |
14 | device/odevice_motorola_ezx.h | ||
14 | 15 | ||
15 | SOURCES += device/odevice.cpp \ | 16 | SOURCES += device/odevice.cpp \ |
16 | device/odevicebutton.cpp \ | 17 | device/odevicebutton.cpp \ |
17 | device/odevice_abstractmobiledevice.cpp \ | 18 | device/odevice_abstractmobiledevice.cpp \ |
18 | device/odevice_beagle.cpp \ | 19 | device/odevice_beagle.cpp \ |
19 | device/odevice_ipaq.cpp \ | 20 | device/odevice_ipaq.cpp \ |
20 | device/odevice_jornada.cpp\ | 21 | device/odevice_jornada.cpp\ |
21 | device/odevice_ramses.cpp \ | 22 | device/odevice_ramses.cpp \ |
22 | device/odevice_simpad.cpp \ | 23 | device/odevice_simpad.cpp \ |
23 | device/odevice_zaurus.cpp \ | 24 | device/odevice_zaurus.cpp \ |
24 | device/odevice_genuineintel.cpp \ | 25 | device/odevice_genuineintel.cpp \ |
25 | device/odevice_yopy.cpp \ | 26 | device/odevice_yopy.cpp \ |
26 | device/odevice_mypal.cpp \ | 27 | device/odevice_mypal.cpp \ |
27 | device/odevice_htc.cpp | 28 | device/odevice_htc.cpp \ |
29 | device/odevice_motorola_ezx.cpp | ||
28 | 30 | ||
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,88 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | 3 | =. (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | 30 | ||
31 | #include "odevice_beagle.h" | 31 | #include "odevice_beagle.h" |
32 | #include "odevice_ipaq.h" | 32 | #include "odevice_ipaq.h" |
33 | #include "odevice_mypal.h" | 33 | #include "odevice_mypal.h" |
34 | #include "odevice_jornada.h" | 34 | #include "odevice_jornada.h" |
35 | #include "odevice_ramses.h" | 35 | #include "odevice_ramses.h" |
36 | #include "odevice_simpad.h" | 36 | #include "odevice_simpad.h" |
37 | #include "odevice_yopy.h" | 37 | #include "odevice_yopy.h" |
38 | #include "odevice_zaurus.h" | 38 | #include "odevice_zaurus.h" |
39 | #include "odevice_genuineintel.h" | 39 | #include "odevice_genuineintel.h" |
40 | #include "odevice_htc.h" | 40 | #include "odevice_htc.h" |
41 | #include "odevice_motorola_ezx.h" | ||
41 | 42 | ||
42 | /* QT */ | 43 | /* QT */ |
43 | #include <qapplication.h> | 44 | #include <qapplication.h> |
44 | #include <qfile.h> | 45 | #include <qfile.h> |
45 | #include <qtextstream.h> | 46 | #include <qtextstream.h> |
46 | #include <qwindowsystem_qws.h> | 47 | #include <qwindowsystem_qws.h> |
47 | 48 | ||
48 | /* OPIE */ | 49 | /* OPIE */ |
49 | #include <qpe/config.h> | 50 | #include <qpe/config.h> |
50 | #include <qpe/sound.h> | 51 | #include <qpe/sound.h> |
51 | #include <qpe/qcopenvelope_qws.h> | 52 | #include <qpe/qcopenvelope_qws.h> |
52 | #include <qpe/sound.h> | 53 | #include <qpe/sound.h> |
53 | 54 | ||
54 | #include <opie2/okeyfilter.h> | 55 | #include <opie2/okeyfilter.h> |
55 | #include <opie2/oresource.h> | 56 | #include <opie2/oresource.h> |
56 | 57 | ||
57 | /* STD */ | 58 | /* STD */ |
58 | #include <fcntl.h> | 59 | #include <fcntl.h> |
59 | #include <math.h> | 60 | #include <math.h> |
60 | #include <stdlib.h> | 61 | #include <stdlib.h> |
61 | #include <signal.h> | 62 | #include <signal.h> |
62 | #include <sys/ioctl.h> | 63 | #include <sys/ioctl.h> |
63 | #include <sys/time.h> | 64 | #include <sys/time.h> |
64 | #include <unistd.h> | 65 | #include <unistd.h> |
65 | #ifndef QT_NO_SOUND | 66 | #ifndef QT_NO_SOUND |
66 | #include <linux/soundcard.h> | 67 | #include <linux/soundcard.h> |
67 | #endif | 68 | #endif |
68 | 69 | ||
69 | namespace Opie { | 70 | namespace Opie { |
70 | namespace Core { | 71 | namespace Core { |
71 | 72 | ||
72 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 73 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
73 | 74 | ||
74 | 75 | ||
75 | /* STATIC and common implementation */ | 76 | /* STATIC and common implementation */ |
76 | /* EXPORT */ ODistribution distributions[] = { | 77 | /* EXPORT */ ODistribution distributions[] = { |
77 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 78 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
78 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, | 79 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, |
79 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 80 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
80 | { System_Unknown, "Linux", "/etc/issue" }, | 81 | { System_Unknown, "Linux", "/etc/issue" }, |
81 | }; | 82 | }; |
82 | 83 | ||
83 | 84 | ||
84 | /* EXPORT */ bool isQWS(){ | 85 | /* EXPORT */ bool isQWS(){ |
85 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 86 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
86 | } | 87 | } |
87 | 88 | ||
88 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 89 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
@@ -101,96 +102,97 @@ struct default_button default_buttons [] = { | |||
101 | "devicebuttons/z_calendar", | 102 | "devicebuttons/z_calendar", |
102 | "datebook", "nextView()", | 103 | "datebook", "nextView()", |
103 | "today", "raise()" }, | 104 | "today", "raise()" }, |
104 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 105 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
105 | "devicebuttons/z_contact", | 106 | "devicebuttons/z_contact", |
106 | "addressbook", "raise()", | 107 | "addressbook", "raise()", |
107 | "addressbook", "beamBusinessCard()" }, | 108 | "addressbook", "beamBusinessCard()" }, |
108 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 109 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
109 | "devicebuttons/z_home", | 110 | "devicebuttons/z_home", |
110 | "QPE/Launcher", "home()", | 111 | "QPE/Launcher", "home()", |
111 | "buttonsettings", "raise()" }, | 112 | "buttonsettings", "raise()" }, |
112 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 113 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
113 | "devicebuttons/z_menu", | 114 | "devicebuttons/z_menu", |
114 | "QPE/TaskBar", "toggleMenu()", | 115 | "QPE/TaskBar", "toggleMenu()", |
115 | "QPE/TaskBar", "toggleStartMenu()" }, | 116 | "QPE/TaskBar", "toggleStartMenu()" }, |
116 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 117 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
117 | "devicebuttons/z_mail", | 118 | "devicebuttons/z_mail", |
118 | "opiemail", "raise()", | 119 | "opiemail", "raise()", |
119 | "opiemail", "newMail()" }, | 120 | "opiemail", "newMail()" }, |
120 | }; | 121 | }; |
121 | 122 | ||
122 | ODevice *ODevice::inst() | 123 | ODevice *ODevice::inst() |
123 | { | 124 | { |
124 | static ODevice *dev = 0; | 125 | static ODevice *dev = 0; |
125 | QString cpu_info; | 126 | QString cpu_info; |
126 | 127 | ||
127 | if ( !dev ) | 128 | if ( !dev ) |
128 | { | 129 | { |
129 | QFile f( PATH_PROC_CPUINFO ); | 130 | QFile f( PATH_PROC_CPUINFO ); |
130 | if ( f.open( IO_ReadOnly ) ) | 131 | if ( f.open( IO_ReadOnly ) ) |
131 | { | 132 | { |
132 | QTextStream s( &f ); | 133 | QTextStream s( &f ); |
133 | while ( !s.atEnd() ) | 134 | while ( !s.atEnd() ) |
134 | { | 135 | { |
135 | QString line; | 136 | QString line; |
136 | line = s.readLine(); | 137 | line = s.readLine(); |
137 | if ( line.startsWith( "Hardware" ) ) | 138 | if ( line.startsWith( "Hardware" ) ) |
138 | { | 139 | { |
139 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 140 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
140 | cpu_info = line; | 141 | cpu_info = line; |
141 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 142 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
142 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 143 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
143 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); | 144 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); |
144 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 145 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
145 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 146 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
146 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 147 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
147 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 148 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
148 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); | 149 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); |
150 | else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); | ||
149 | 151 | ||
150 | else qWarning( "ODevice() - unknown hardware - using default." ); | 152 | else qWarning( "ODevice() - unknown hardware - using default." ); |
151 | break; | 153 | break; |
152 | } else if ( line.startsWith( "vendor_id" ) ) { | 154 | } else if ( line.startsWith( "vendor_id" ) ) { |
153 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 155 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
154 | cpu_info = line; | 156 | cpu_info = line; |
155 | if( line.contains( "genuineintel", false ) ) { | 157 | if( line.contains( "genuineintel", false ) ) { |
156 | dev = new Internal::GenuineIntel(); | 158 | dev = new Internal::GenuineIntel(); |
157 | break; | 159 | break; |
158 | } | 160 | } |
159 | } | 161 | } |
160 | } | 162 | } |
161 | } | 163 | } |
162 | else | 164 | else |
163 | { | 165 | { |
164 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 166 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
165 | } | 167 | } |
166 | if ( !dev ) dev = new ODevice(); | 168 | if ( !dev ) dev = new ODevice(); |
167 | dev->init(cpu_info); | 169 | dev->init(cpu_info); |
168 | } | 170 | } |
169 | return dev; | 171 | return dev; |
170 | } | 172 | } |
171 | 173 | ||
172 | ODevice::ODevice() | 174 | ODevice::ODevice() |
173 | { | 175 | { |
174 | d = new ODeviceData; | 176 | d = new ODeviceData; |
175 | 177 | ||
176 | d->m_modelstr = "Unknown"; | 178 | d->m_modelstr = "Unknown"; |
177 | d->m_model = Model_Unknown; | 179 | d->m_model = Model_Unknown; |
178 | d->m_vendorstr = "Unknown"; | 180 | d->m_vendorstr = "Unknown"; |
179 | d->m_vendor = Vendor_Unknown; | 181 | d->m_vendor = Vendor_Unknown; |
180 | d->m_systemstr = "Unknown"; | 182 | d->m_systemstr = "Unknown"; |
181 | d->m_system = System_Unknown; | 183 | d->m_system = System_Unknown; |
182 | d->m_sysverstr = "0.0"; | 184 | d->m_sysverstr = "0.0"; |
183 | d->m_rotation = Rot0; | 185 | d->m_rotation = Rot0; |
184 | d->m_direction = CW; | 186 | d->m_direction = CW; |
185 | d->m_qteDriver = "Transformed"; | 187 | d->m_qteDriver = "Transformed"; |
186 | 188 | ||
187 | d->m_holdtime = 1000; // 1000ms | 189 | d->m_holdtime = 1000; // 1000ms |
188 | d->m_buttons = 0; | 190 | d->m_buttons = 0; |
189 | d->m_cpu_frequencies = new QStrList; | 191 | d->m_cpu_frequencies = new QStrList; |
190 | 192 | ||
191 | 193 | ||
192 | /* mixer */ | 194 | /* mixer */ |
193 | d->m_sound = d->m_vol = d->m_mixer = -1; | 195 | d->m_sound = d->m_vol = d->m_mixer = -1; |
194 | 196 | ||
195 | /* System QCopChannel created */ | 197 | /* System QCopChannel created */ |
196 | d->m_initializedButtonQcop = false; | 198 | d->m_initializedButtonQcop = false; |
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,60 +1,60 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 41 | ||
42 | 42 | ||
43 | #include <qstrlist.h> | 43 | #include <qstrlist.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | 46 | ||
47 | class Sound; | 47 | class Sound; |
48 | 48 | ||
49 | namespace Opie{ | 49 | namespace Opie{ |
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum OModel { |
57 | Model_Unknown, // = 0 | 57 | Model_Unknown, // = 0 |
58 | 58 | ||
59 | Model_Series_Mask = 0xffff0000, | 59 | Model_Series_Mask = 0xffff0000, |
60 | 60 | ||
@@ -79,128 +79,136 @@ enum OModel { | |||
79 | 79 | ||
80 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), | 80 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), |
81 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), | 81 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), |
82 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), | 82 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), |
83 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), | 83 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), |
84 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), | 84 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), |
85 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), | 85 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), |
86 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), | 86 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), |
87 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), | 87 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), |
88 | Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), | 88 | Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), |
89 | 89 | ||
90 | Model_SIMpad = ( 3 << 16 ), | 90 | Model_SIMpad = ( 3 << 16 ), |
91 | 91 | ||
92 | Model_SIMpad_All = ( Model_SIMpad | 0xffff ), | 92 | Model_SIMpad_All = ( Model_SIMpad | 0xffff ), |
93 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), | 93 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), |
94 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), | 94 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), |
95 | Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), | 95 | Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), |
96 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), | 96 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), |
97 | 97 | ||
98 | Model_Ramses = ( 4 << 16 ), | 98 | Model_Ramses = ( 4 << 16 ), |
99 | 99 | ||
100 | Model_Ramses_All = ( Model_Ramses | 0xffff ), | 100 | Model_Ramses_All = ( Model_Ramses | 0xffff ), |
101 | Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), | 101 | Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), |
102 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), | 102 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), |
103 | 103 | ||
104 | Model_Yopy = ( 5 << 16 ), | 104 | Model_Yopy = ( 5 << 16 ), |
105 | 105 | ||
106 | Model_Yopy_All = ( Model_Yopy | 0xffff ), | 106 | Model_Yopy_All = ( Model_Yopy | 0xffff ), |
107 | Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), | 107 | Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), |
108 | Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), | 108 | Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), |
109 | Model_Yopy_3700 = ( Model_Yopy | 0x0003 ), | 109 | Model_Yopy_3700 = ( Model_Yopy | 0x0003 ), |
110 | 110 | ||
111 | Model_Beagle = ( 6 << 16 ), | 111 | Model_Beagle = ( 6 << 16 ), |
112 | 112 | ||
113 | Model_Beagle_All = ( Model_Beagle | 0xffff ), | 113 | Model_Beagle_All = ( Model_Beagle | 0xffff ), |
114 | Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), | 114 | Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), |
115 | 115 | ||
116 | Model_GenuineIntel = ( 7 << 16 ), | 116 | Model_GenuineIntel = ( 7 << 16 ), |
117 | 117 | ||
118 | Model_MyPal = ( 8 << 16 ), | 118 | Model_MyPal = ( 8 << 16 ), |
119 | 119 | ||
120 | Model_MyPal_All = ( Model_MyPal | 0xffff ), | 120 | Model_MyPal_All = ( Model_MyPal | 0xffff ), |
121 | Model_MyPal_620 = ( Model_MyPal | 0x0001 ), | 121 | Model_MyPal_620 = ( Model_MyPal | 0x0001 ), |
122 | Model_MyPal_716 = ( Model_MyPal | 0x0002 ), | 122 | Model_MyPal_716 = ( Model_MyPal | 0x0002 ), |
123 | Model_MyPal_730 = ( Model_MyPal | 0x0003 ), | 123 | Model_MyPal_730 = ( Model_MyPal | 0x0003 ), |
124 | 124 | ||
125 | Model_HTC = ( 9 << 16 ), | 125 | Model_HTC = ( 9 << 16 ), |
126 | Model_HTC_All = ( Model_HTC | 0xffff ), | 126 | Model_HTC_All = ( Model_HTC | 0xffff ), |
127 | Model_HTC_Universal = ( Model_HTC | 0x0001 ) | 127 | Model_HTC_Universal = ( Model_HTC | 0x0001 ), |
128 | |||
129 | Model_Motorola = ( 9 << 17 ), | ||
130 | Model_Motorola_All = ( Model_Motorola | 0xffff ), | ||
131 | Model_Motorola_EZX = ( Model_Motorola | 0x0001 ), | ||
132 | |||
128 | }; | 133 | }; |
129 | 134 | ||
130 | /** | 135 | /** |
131 | * The vendor of the device | 136 | * The vendor of the device |
132 | */ | 137 | */ |
133 | enum OVendor { | 138 | enum OVendor { |
134 | Vendor_Unknown, | 139 | Vendor_Unknown, |
135 | 140 | ||
136 | Vendor_HP, | 141 | Vendor_HP, |
137 | Vendor_Sharp, | 142 | Vendor_Sharp, |
138 | Vendor_SIEMENS, | 143 | Vendor_SIEMENS, |
139 | Vendor_MundN, | 144 | Vendor_MundN, |
140 | Vendor_GMate, | 145 | Vendor_GMate, |
141 | Vendor_MasterIA, | 146 | Vendor_MasterIA, |
142 | Vendor_GenuineIntel, | 147 | Vendor_GenuineIntel, |
143 | Vendor_Asus, | 148 | Vendor_Asus, |
144 | Vendor_HTC | 149 | Vendor_HTC, |
150 | Vendor_Motorola, | ||
145 | }; | 151 | }; |
146 | 152 | ||
147 | /** | 153 | /** |
148 | * The System used | 154 | * The System used |
149 | */ | 155 | */ |
150 | enum OSystem { | 156 | enum OSystem { |
151 | System_Unknown, | 157 | System_Unknown, |
152 | 158 | ||
153 | System_Familiar, | 159 | System_Familiar, |
154 | System_Zaurus, | 160 | System_Zaurus, |
155 | System_OpenZaurus, | 161 | System_OpenZaurus, |
156 | System_Linupy, | 162 | System_Linupy, |
157 | System_OpenEmbedded, | 163 | System_OpenEmbedded, |
158 | System_PC | 164 | System_PC, |
165 | System_OpenEZX, | ||
166 | System_Angstrom, | ||
159 | }; | 167 | }; |
160 | 168 | ||
161 | typedef struct { | 169 | typedef struct { |
162 | OSystem system; | 170 | OSystem system; |
163 | char* sysstr; | 171 | char* sysstr; |
164 | char* sysvfile; | 172 | char* sysvfile; |
165 | } ODistribution; | 173 | } ODistribution; |
166 | 174 | ||
167 | extern ODistribution distributions[]; | 175 | extern ODistribution distributions[]; |
168 | 176 | ||
169 | 177 | ||
170 | enum OLedState { | 178 | enum OLedState { |
171 | Led_Off, | 179 | Led_Off, |
172 | Led_On, | 180 | Led_On, |
173 | Led_BlinkSlow, | 181 | Led_BlinkSlow, |
174 | Led_BlinkFast | 182 | Led_BlinkFast |
175 | }; | 183 | }; |
176 | 184 | ||
177 | enum OLed { | 185 | enum OLed { |
178 | Led_Mail, | 186 | Led_Mail, |
179 | Led_Power, | 187 | Led_Power, |
180 | Led_BlueTooth | 188 | Led_BlueTooth |
181 | }; | 189 | }; |
182 | 190 | ||
183 | enum OHardKey { | 191 | enum OHardKey { |
184 | HardKey_Datebook = Qt::Key_F9, | 192 | HardKey_Datebook = Qt::Key_F9, |
185 | HardKey_Contacts = Qt::Key_F10, | 193 | HardKey_Contacts = Qt::Key_F10, |
186 | HardKey_Menu = Qt::Key_F11, | 194 | HardKey_Menu = Qt::Key_F11, |
187 | HardKey_Home = Qt::Key_F12, | 195 | HardKey_Home = Qt::Key_F12, |
188 | HardKey_Mail = Qt::Key_F13, | 196 | HardKey_Mail = Qt::Key_F13, |
189 | HardKey_Record = Qt::Key_F24, | 197 | HardKey_Record = Qt::Key_F24, |
190 | HardKey_Suspend = Qt::Key_F34, | 198 | HardKey_Suspend = Qt::Key_F34, |
191 | HardKey_Backlight = Qt::Key_F35, | 199 | HardKey_Backlight = Qt::Key_F35, |
192 | HardKey_Action = Qt::Key_F10, | 200 | HardKey_Action = Qt::Key_F10, |
193 | HardKey_OK = Qt::Key_F11, | 201 | HardKey_OK = Qt::Key_F11, |
194 | HardKey_End = Qt::Key_F12, | 202 | HardKey_End = Qt::Key_F12, |
195 | }; | 203 | }; |
196 | 204 | ||
197 | enum ODirection { | 205 | enum ODirection { |
198 | CW = 0, | 206 | CW = 0, |
199 | CCW = 1, | 207 | CCW = 1, |
200 | Flip = 2, | 208 | Flip = 2, |
201 | }; | 209 | }; |
202 | 210 | ||
203 | enum OHingeStatus { | 211 | enum OHingeStatus { |
204 | CASE_CLOSED = 3, | 212 | CASE_CLOSED = 3, |
205 | CASE_PORTRAIT = 2, | 213 | CASE_PORTRAIT = 2, |
206 | CASE_LANDSCAPE = 0, | 214 | CASE_LANDSCAPE = 0, |
@@ -345,53 +353,49 @@ signals: | |||
345 | 353 | ||
346 | private slots: | 354 | private slots: |
347 | void systemMessage ( const QCString &, const QByteArray & ); | 355 | void systemMessage ( const QCString &, const QByteArray & ); |
348 | void playingStopped(); | 356 | void playingStopped(); |
349 | 357 | ||
350 | protected: | 358 | protected: |
351 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); | 359 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); |
352 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); | 360 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); |
353 | void reloadButtonMapping(); | 361 | void reloadButtonMapping(); |
354 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); | 362 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); |
355 | 363 | ||
356 | /* ugly virtual hook */ | 364 | /* ugly virtual hook */ |
357 | virtual void virtual_hook( int id, void* data ); | 365 | virtual void virtual_hook( int id, void* data ); |
358 | }; | 366 | }; |
359 | 367 | ||
360 | class ODeviceData { | 368 | class ODeviceData { |
361 | 369 | ||
362 | public: | 370 | public: |
363 | QString m_vendorstr; | 371 | QString m_vendorstr; |
364 | OVendor m_vendor; | 372 | OVendor m_vendor; |
365 | 373 | ||
366 | QString m_modelstr; | 374 | QString m_modelstr; |
367 | OModel m_model; | 375 | OModel m_model; |
368 | 376 | ||
369 | QString m_systemstr; | 377 | QString m_systemstr; |
370 | OSystem m_system; | 378 | OSystem m_system; |
371 | 379 | ||
372 | QString m_sysverstr; | 380 | QString m_sysverstr; |
373 | 381 | ||
374 | Transformation m_rotation; | 382 | Transformation m_rotation; |
375 | ODirection m_direction; | 383 | ODirection m_direction; |
376 | 384 | ||
377 | QString m_qteDriver; | 385 | QString m_qteDriver; |
378 | 386 | ||
379 | QValueList <ODeviceButton> *m_buttons; | 387 | QValueList <ODeviceButton> *m_buttons; |
380 | uint m_holdtime; | 388 | uint m_holdtime; |
381 | QStrList *m_cpu_frequencies; | 389 | QStrList *m_cpu_frequencies; |
382 | bool m_initializedButtonQcop : 1; | 390 | bool m_initializedButtonQcop : 1; |
383 | 391 | ||
384 | /* values for changeMixerForAlarm */ | 392 | /* values for changeMixerForAlarm */ |
385 | int m_sound, m_vol, m_mixer; | 393 | int m_sound, m_vol, m_mixer; |
386 | }; | 394 | }; |
387 | 395 | ||
388 | extern bool isQWS(); | 396 | extern bool isQWS(); |
389 | extern QCString makeChannel ( const char *str ); | 397 | extern QCString makeChannel ( const char *str ); |
390 | } | 398 | } |
391 | } | 399 | } |
392 | 400 | ||
393 | |||
394 | |||
395 | |||
396 | #endif | 401 | #endif |
397 | |||
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 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | =. (C) 2006 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
4 | .=l. | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This program is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; version 2 of the License. | ||
11 | ._= =} : | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This program is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
28 | |||
29 | #include "odevice_motorola_ezx.h" | ||
30 | |||
31 | /* OPIE */ | ||
32 | #include <opie2/oinputsystem.h> | ||
33 | #include <opie2/oresource.h> | ||
34 | |||
35 | #include <qpe/config.h> | ||
36 | #include <qpe/sound.h> | ||
37 | |||
38 | /* QT */ | ||
39 | #include <qapplication.h> | ||
40 | #include <qfile.h> | ||
41 | #include <qtextstream.h> | ||
42 | #include <qwindowsystem_qws.h> | ||
43 | #include <qcopchannel_qws.h> | ||
44 | |||
45 | /* STD */ | ||
46 | #include <assert.h> | ||
47 | #include <string.h> | ||
48 | #include <errno.h> | ||
49 | #include <fcntl.h> | ||
50 | #include <math.h> | ||
51 | #include <stdlib.h> | ||
52 | #include <signal.h> | ||
53 | #include <sys/ioctl.h> | ||
54 | #include <sys/time.h> | ||
55 | #include <unistd.h> | ||
56 | #ifndef QT_NO_SOUND | ||
57 | #include <linux/soundcard.h> | ||
58 | #endif | ||
59 | |||
60 | using namespace Opie::Core; | ||
61 | using namespace Opie::Core::Internal; | ||
62 | |||
63 | struct ezx_button ezx_buttons [] = { | ||
64 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | ||
65 | "devicebuttons/z_calendar", | ||
66 | "datebook", "nextView()", | ||
67 | "today", "raise()" }, | ||
68 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | ||
69 | "devicebuttons/z_contact", | ||
70 | "addressbook", "raise()", | ||
71 | "addressbook", "beamBusinessCard()" }, | ||
72 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | ||
73 | "devicebuttons/z_home", | ||
74 | "QPE/Launcher", "home()", | ||
75 | "buttonsettings", "raise()" }, | ||
76 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | ||
77 | "devicebuttons/z_menu", | ||
78 | "QPE/TaskBar", "toggleMenu()", | ||
79 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
80 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | ||
81 | "devicebuttons/z_mail", | ||
82 | "opiemail", "raise()", | ||
83 | "opiemail", "newMail()" }, | ||
84 | }; | ||
85 | |||
86 | void Motorola_EZX::init(const QString& cpu_info) | ||
87 | { | ||
88 | qDebug( "Motorola_EZX::init()" ); | ||
89 | // Set the time to wait until the system is really suspended | ||
90 | // the delta between apm --suspend and sleeping | ||
91 | setAPMTimeOut( 15000 ); | ||
92 | |||
93 | d->m_vendorstr = "OpenEZX Team"; | ||
94 | d->m_systemstr = "OpenEZX"; | ||
95 | d->m_system = System_OpenEZX; | ||
96 | // sysver already gathered | ||
97 | |||
98 | // check the Motorola_EZX model | ||
99 | QString model; | ||
100 | int loc = cpu_info.find( ":" ); | ||
101 | if ( loc != -1 ) | ||
102 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | ||
103 | else | ||
104 | model = cpu_info; | ||
105 | |||
106 | if ( model == "Motorola Ezx Platform" ) { | ||
107 | d->m_model = Model_Motorola_EZX; | ||
108 | d->m_modelstr = "Motorola_EZX"; | ||
109 | } else assert( 0 ); | ||
110 | |||
111 | // set path to backlight device in kernel 2.6 | ||
112 | m_backlightdev = "/sys/class/backlight/ezx-bl/"; | ||
113 | d->m_rotation = Rot0; | ||
114 | //initHingeSensor(); | ||
115 | |||
116 | // set default qte driver and led state | ||
117 | d->m_qteDriver = "Transformed"; | ||
118 | m_leds[0] = Led_Off; | ||
119 | |||
120 | qDebug( "Motorola_EZX::init() - Using the 2.6 OpenEZX HAL on a %s", (const char*) d->m_modelstr ); | ||
121 | } | ||
122 | |||
123 | void Motorola_EZX::initButtons() | ||
124 | { | ||
125 | qDebug( "Motorola_EZX::initButtons()" ); | ||
126 | if ( d->m_buttons ) | ||
127 | return; | ||
128 | |||
129 | d->m_buttons = new QValueList <ODeviceButton>; | ||
130 | |||
131 | struct ezx_button * ezx_buttons; | ||
132 | int buttoncount; | ||
133 | |||
134 | /* | ||
135 | |||
136 | switch ( d->m_model ) | ||
137 | { | ||
138 | case Model_Motorola_EZX_SL6000: | ||
139 | pezx_buttons = ezx_buttons_6000; | ||
140 | buttoncount = ARRAY_SIZE(ezx_buttons_6000); | ||
141 | break; | ||
142 | case Model_Motorola_EZX_SLC3100: // fallthrough | ||
143 | case Model_Motorola_EZX_SLC3000: // fallthrough | ||
144 | case Model_Motorola_EZX_SLC1000: // fallthrough | ||
145 | case Model_Motorola_EZX_SLC7x0: | ||
146 | if ( isQWS( ) ) | ||
147 | { | ||
148 | addPreHandler(this); | ||
149 | } | ||
150 | pezx_buttons = ezx_buttons_c700; | ||
151 | buttoncount = ARRAY_SIZE(ezx_buttons_c700); | ||
152 | break; | ||
153 | default: | ||
154 | pezx_buttons = ezx_buttons; | ||
155 | buttoncount = ARRAY_SIZE(ezx_buttons); | ||
156 | break; | ||
157 | } | ||
158 | |||
159 | for ( int i = 0; i < buttoncount; i++ ) { | ||
160 | struct ezx_button *zb = pezx_buttons + i; | ||
161 | ODeviceButton b; | ||
162 | |||
163 | b.setKeycode( zb->code ); | ||
164 | b.setUserText( QObject::tr( "Button", zb->utext )); | ||
165 | b.setPixmap( OResource::loadPixmap( zb->pix )); | ||
166 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | ||
167 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | ||
168 | d->m_buttons->append( b ); | ||
169 | } | ||
170 | */ | ||
171 | reloadButtonMapping(); | ||
172 | } | ||
173 | |||
174 | void Motorola_EZX::playAlarmSound() | ||
175 | { | ||
176 | #ifndef QT_NO_SOUND | ||
177 | static Sound snd ( "alarm" ); | ||
178 | if(!snd.isFinished()) | ||
179 | return; | ||
180 | |||
181 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | ||
182 | snd. play(); | ||
183 | #endif | ||
184 | } | ||
185 | |||
186 | QValueList <OLed> Motorola_EZX::ledList() const | ||
187 | { | ||
188 | QValueList <OLed> vl; | ||
189 | vl << Led_Mail; | ||
190 | return vl; | ||
191 | } | ||
192 | |||
193 | QValueList <OLedState> Motorola_EZX::ledStateList( OLed l ) const | ||
194 | { | ||
195 | QValueList <OLedState> vl; | ||
196 | |||
197 | if ( l == Led_Mail ) | ||
198 | vl << Led_Off << Led_On << Led_BlinkSlow; | ||
199 | return vl; | ||
200 | } | ||
201 | |||
202 | OLedState Motorola_EZX::ledState( OLed which ) const | ||
203 | { | ||
204 | if ( which == Led_Mail ) | ||
205 | return m_leds [0]; | ||
206 | else | ||
207 | return Led_Off; | ||
208 | } | ||
209 | |||
210 | bool Motorola_EZX::setLedState( OLed which, OLedState st ) | ||
211 | { | ||
212 | // Currently not supported | ||
213 | qDebug( "Motorola_EZX::setLedState: ODevice handling not yet implemented" ); | ||
214 | return false; | ||
215 | } | ||
216 | |||
217 | int Motorola_EZX::displayBrightnessResolution() const | ||
218 | { | ||
219 | // Currently not supported | ||
220 | qDebug( "Motorola_EZX::displayBrightnessResolution: ODevice handling not yet implemented" ); | ||
221 | return 100; | ||
222 | |||
223 | #if 0 | ||
224 | int res = 1; | ||
225 | if (m_embedix) | ||
226 | { | ||
227 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | ||
228 | if ( fd ) | ||
229 | { | ||
230 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | ||
231 | ::close( fd ); | ||
232 | return value ? value : res; | ||
233 | } | ||
234 | } | ||
235 | else | ||
236 | { | ||
237 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); | ||
238 | if ( fd ) | ||
239 | { | ||
240 | char buf[100]; | ||
241 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | ||
242 | ::close( fd ); | ||
243 | } | ||
244 | } | ||
245 | return res; | ||
246 | #endif | ||
247 | } | ||
248 | |||
249 | bool Motorola_EZX::setDisplayBrightness( int bright ) | ||
250 | { | ||
251 | qDebug( "Motorola_EZX::setDisplayBrightness( %d )", bright ); | ||
252 | return false; | ||
253 | |||
254 | #if 0 | ||
255 | bool res = false; | ||
256 | |||
257 | if ( bright > 255 ) bright = 255; | ||
258 | if ( bright < 0 ) bright = 0; | ||
259 | |||
260 | int numberOfSteps = displayBrightnessResolution(); | ||
261 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | ||
262 | |||
263 | if ( m_embedix ) | ||
264 | { | ||
265 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | ||
266 | if ( fd ) | ||
267 | { | ||
268 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | ||
269 | ::close( fd ); | ||
270 | } | ||
271 | } | ||
272 | else | ||
273 | { | ||
274 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | ||
275 | if ( fd ) | ||
276 | { | ||
277 | char buf[100]; | ||
278 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | ||
279 | res = ( ::write( fd, &buf[0], len ) == 0 ); | ||
280 | ::close( fd ); | ||
281 | } | ||
282 | } | ||
283 | return res; | ||
284 | #endif | ||
285 | } | ||
286 | |||
287 | bool Motorola_EZX::setDisplayStatus( bool on ) | ||
288 | { | ||
289 | bool res = false; | ||
290 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); | ||
291 | if ( fd ) | ||
292 | { | ||
293 | char buf[10]; | ||
294 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | ||
295 | buf[1] = '\0'; | ||
296 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | ||
297 | ::close( fd ); | ||
298 | } | ||
299 | return res; | ||
300 | } | ||
301 | |||
302 | void Motorola_EZX::systemMessage( const QCString &msg, const QByteArray & ) | ||
303 | { | ||
304 | if ( msg == "deviceButtonMappingChanged()" ) { | ||
305 | reloadButtonMapping(); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | bool Motorola_EZX::suspend() { | ||
310 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
311 | return false; | ||
312 | |||
313 | bool res = false; | ||
314 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); | ||
315 | |||
316 | struct timeval tvs, tvn; | ||
317 | ::gettimeofday ( &tvs, 0 ); | ||
318 | |||
319 | ::sync(); // flush fs caches | ||
320 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
321 | |||
322 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); | ||
323 | |||
324 | return res; | ||
325 | } | ||
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 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | =. (C) 2006 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
4 | .=l. | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This program is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; version 2 of the License. | ||
11 | ._= =} : | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This program is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | */ | ||
28 | |||
29 | #ifndef ODEVICE_MOTOROLA_EZX | ||
30 | #define ODEVICE_MOTOROLA_EZX | ||
31 | |||
32 | #include "odevice_abstractmobiledevice.h" | ||
33 | |||
34 | /* QT */ | ||
35 | #include <qfile.h> | ||
36 | #include <qwindowsystem_qws.h> | ||
37 | |||
38 | #ifndef ARRAY_SIZE | ||
39 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
40 | #endif | ||
41 | |||
42 | // Audio | ||
43 | // LED | ||
44 | // Power Management | ||
45 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | ||
46 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | ||
47 | #define APM_EVT_POWER_BUTTON (1 << 0) | ||
48 | |||
49 | // Vesa Standard | ||
50 | #define FB_BLANK_UNBLANK 0 | ||
51 | #define FB_BLANK_POWERDOWN 4 | ||
52 | |||
53 | namespace Opie { | ||
54 | namespace Core { | ||
55 | namespace Internal { | ||
56 | |||
57 | class Motorola_EZX : public OAbstractMobileDevice | ||
58 | { | ||
59 | Q_OBJECT | ||
60 | |||
61 | protected: | ||
62 | virtual void init(const QString&); | ||
63 | virtual void initButtons(); | ||
64 | //void initHingeSensor(); | ||
65 | |||
66 | protected slots: | ||
67 | //void hingeSensorTriggered(); | ||
68 | void systemMessage( const QCString &msg, const QByteArray & ); | ||
69 | |||
70 | public: | ||
71 | virtual bool setDisplayBrightness( int b ); | ||
72 | virtual bool setDisplayStatus( bool on ); | ||
73 | virtual int displayBrightnessResolution() const; | ||
74 | |||
75 | virtual void playAlarmSound(); | ||
76 | |||
77 | virtual QValueList <OLed> ledList() const; | ||
78 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | ||
79 | virtual OLedState ledState( OLed led ) const; | ||
80 | virtual bool setLedState( OLed led, OLedState st ); | ||
81 | |||
82 | virtual bool suspend(); | ||
83 | |||
84 | protected: | ||
85 | QString m_backlightdev; | ||
86 | OLedState m_leds[1]; | ||
87 | QFile m_hinge; | ||
88 | }; | ||
89 | |||
90 | struct ezx_button { | ||
91 | Qt::Key code; | ||
92 | char *utext; | ||
93 | char *pix; | ||
94 | char *fpressedservice; | ||
95 | char *fpressedaction; | ||
96 | char *fheldservice; | ||
97 | char *fheldaction; | ||
98 | }; | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | #endif | ||