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/opiecore/device/odevice.cpp | |
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
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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; |