Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 8f5be8b..e4233eb 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,89 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2002-2006 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 | #include "odevice_motorola_ezx.h" |
42 | #include "odevice_palm.h" | ||
42 | 43 | ||
43 | /* QT */ | 44 | /* QT */ |
44 | #include <qapplication.h> | 45 | #include <qapplication.h> |
45 | #include <qfile.h> | 46 | #include <qfile.h> |
46 | #include <qtextstream.h> | 47 | #include <qtextstream.h> |
47 | #include <qwindowsystem_qws.h> | 48 | #include <qwindowsystem_qws.h> |
48 | 49 | ||
49 | /* OPIE */ | 50 | /* OPIE */ |
50 | #include <qpe/config.h> | 51 | #include <qpe/config.h> |
51 | #include <qpe/sound.h> | 52 | #include <qpe/sound.h> |
52 | #include <qpe/qcopenvelope_qws.h> | 53 | #include <qpe/qcopenvelope_qws.h> |
53 | #include <qpe/sound.h> | 54 | #include <qpe/sound.h> |
54 | 55 | ||
55 | #include <opie2/okeyfilter.h> | 56 | #include <opie2/okeyfilter.h> |
56 | #include <opie2/oresource.h> | 57 | #include <opie2/oresource.h> |
57 | 58 | ||
58 | /* STD */ | 59 | /* STD */ |
59 | #include <fcntl.h> | 60 | #include <fcntl.h> |
60 | #include <math.h> | 61 | #include <math.h> |
61 | #include <stdlib.h> | 62 | #include <stdlib.h> |
62 | #include <signal.h> | 63 | #include <signal.h> |
63 | #include <sys/ioctl.h> | 64 | #include <sys/ioctl.h> |
64 | #include <sys/time.h> | 65 | #include <sys/time.h> |
65 | #include <unistd.h> | 66 | #include <unistd.h> |
66 | #ifndef QT_NO_SOUND | 67 | #ifndef QT_NO_SOUND |
67 | #include <linux/soundcard.h> | 68 | #include <linux/soundcard.h> |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | namespace Opie { | 71 | namespace Opie { |
71 | namespace Core { | 72 | namespace Core { |
72 | 73 | ||
73 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 74 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
74 | 75 | ||
75 | 76 | ||
76 | /* STATIC and common implementation */ | 77 | /* STATIC and common implementation */ |
77 | /* EXPORT */ ODistribution distributions[] = { | 78 | /* EXPORT */ ODistribution distributions[] = { |
78 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 79 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
79 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, | 80 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, |
80 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 81 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
81 | { System_Unknown, "Linux", "/etc/issue" }, | 82 | { System_Unknown, "Linux", "/etc/issue" }, |
82 | }; | 83 | }; |
83 | 84 | ||
84 | 85 | ||
85 | /* EXPORT */ bool isQWS(){ | 86 | /* EXPORT */ bool isQWS(){ |
86 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 87 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
87 | } | 88 | } |
88 | 89 | ||
89 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 90 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
@@ -103,96 +104,97 @@ struct default_button default_buttons [] = { | |||
103 | "datebook", "nextView()", | 104 | "datebook", "nextView()", |
104 | "today", "raise()" }, | 105 | "today", "raise()" }, |
105 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 106 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
106 | "devicebuttons/z_contact", | 107 | "devicebuttons/z_contact", |
107 | "addressbook", "raise()", | 108 | "addressbook", "raise()", |
108 | "addressbook", "beamBusinessCard()" }, | 109 | "addressbook", "beamBusinessCard()" }, |
109 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 110 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
110 | "devicebuttons/z_home", | 111 | "devicebuttons/z_home", |
111 | "QPE/Launcher", "home()", | 112 | "QPE/Launcher", "home()", |
112 | "buttonsettings", "raise()" }, | 113 | "buttonsettings", "raise()" }, |
113 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 114 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
114 | "devicebuttons/z_menu", | 115 | "devicebuttons/z_menu", |
115 | "QPE/TaskBar", "toggleMenu()", | 116 | "QPE/TaskBar", "toggleMenu()", |
116 | "QPE/TaskBar", "toggleStartMenu()" }, | 117 | "QPE/TaskBar", "toggleStartMenu()" }, |
117 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 118 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
118 | "devicebuttons/z_mail", | 119 | "devicebuttons/z_mail", |
119 | "opiemail", "raise()", | 120 | "opiemail", "raise()", |
120 | "opiemail", "newMail()" }, | 121 | "opiemail", "newMail()" }, |
121 | }; | 122 | }; |
122 | 123 | ||
123 | ODevice *ODevice::inst() | 124 | ODevice *ODevice::inst() |
124 | { | 125 | { |
125 | static ODevice *dev = 0; | 126 | static ODevice *dev = 0; |
126 | QString cpu_info; | 127 | QString cpu_info; |
127 | 128 | ||
128 | if ( !dev ) | 129 | if ( !dev ) |
129 | { | 130 | { |
130 | QFile f( PATH_PROC_CPUINFO ); | 131 | QFile f( PATH_PROC_CPUINFO ); |
131 | if ( f.open( IO_ReadOnly ) ) | 132 | if ( f.open( IO_ReadOnly ) ) |
132 | { | 133 | { |
133 | QTextStream s( &f ); | 134 | QTextStream s( &f ); |
134 | while ( !s.atEnd() ) | 135 | while ( !s.atEnd() ) |
135 | { | 136 | { |
136 | QString line; | 137 | QString line; |
137 | line = s.readLine(); | 138 | line = s.readLine(); |
138 | if ( line.startsWith( "Hardware" ) ) | 139 | if ( line.startsWith( "Hardware" ) ) |
139 | { | 140 | { |
140 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 141 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
141 | cpu_info = line; | 142 | cpu_info = line; |
142 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 143 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
143 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 144 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
144 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); | 145 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); |
145 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 146 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
146 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 147 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
147 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 148 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
148 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 149 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
149 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); | 150 | else if ( line.contains( "HTC", false ) ) dev = new Internal::HTC(); |
150 | else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); | 151 | else if ( line.contains( "Motorola", false ) ) dev = new Internal::Motorola_EZX(); |
152 | else if ( line.contains( "Palm", false ) ) dev = new Internal::Palm(); | ||
151 | 153 | ||
152 | else qWarning( "ODevice() - unknown hardware - using default." ); | 154 | else qWarning( "ODevice() - unknown hardware - using default." ); |
153 | break; | 155 | break; |
154 | } else if ( line.startsWith( "vendor_id" ) ) { | 156 | } else if ( line.startsWith( "vendor_id" ) ) { |
155 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 157 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
156 | cpu_info = line; | 158 | cpu_info = line; |
157 | if( line.contains( "genuineintel", false ) ) { | 159 | if( line.contains( "genuineintel", false ) ) { |
158 | dev = new Internal::GenuineIntel(); | 160 | dev = new Internal::GenuineIntel(); |
159 | break; | 161 | break; |
160 | } | 162 | } |
161 | } | 163 | } |
162 | } | 164 | } |
163 | } | 165 | } |
164 | else | 166 | else |
165 | { | 167 | { |
166 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 168 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
167 | } | 169 | } |
168 | if ( !dev ) dev = new ODevice(); | 170 | if ( !dev ) dev = new ODevice(); |
169 | dev->init(cpu_info); | 171 | dev->init(cpu_info); |
170 | } | 172 | } |
171 | return dev; | 173 | return dev; |
172 | } | 174 | } |
173 | 175 | ||
174 | ODevice::ODevice() | 176 | ODevice::ODevice() |
175 | { | 177 | { |
176 | d = new ODeviceData; | 178 | d = new ODeviceData; |
177 | 179 | ||
178 | d->m_modelstr = "Unknown"; | 180 | d->m_modelstr = "Unknown"; |
179 | d->m_model = Model_Unknown; | 181 | d->m_model = Model_Unknown; |
180 | d->m_vendorstr = "Unknown"; | 182 | d->m_vendorstr = "Unknown"; |
181 | d->m_vendor = Vendor_Unknown; | 183 | d->m_vendor = Vendor_Unknown; |
182 | d->m_systemstr = "Unknown"; | 184 | d->m_systemstr = "Unknown"; |
183 | d->m_system = System_Unknown; | 185 | d->m_system = System_Unknown; |
184 | d->m_sysverstr = "0.0"; | 186 | d->m_sysverstr = "0.0"; |
185 | d->m_rotation = Rot0; | 187 | d->m_rotation = Rot0; |
186 | d->m_direction = CW; | 188 | d->m_direction = CW; |
187 | d->m_qteDriver = "Transformed"; | 189 | d->m_qteDriver = "Transformed"; |
188 | 190 | ||
189 | d->m_holdtime = 1000; // 1000ms | 191 | d->m_holdtime = 1000; // 1000ms |
190 | d->m_buttons = 0; | 192 | d->m_buttons = 0; |
191 | d->m_cpu_frequencies = new QStrList; | 193 | d->m_cpu_frequencies = new QStrList; |
192 | 194 | ||
193 | 195 | ||
194 | /* mixer */ | 196 | /* mixer */ |
195 | d->m_sound = d->m_vol = d->m_mixer = -1; | 197 | d->m_sound = d->m_vol = d->m_mixer = -1; |
196 | 198 | ||
197 | /* System QCopChannel created */ | 199 | /* System QCopChannel created */ |
198 | d->m_initializedButtonQcop = false; | 200 | d->m_initializedButtonQcop = false; |