-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 62bb68a..7b99eb4 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,173 +1,173 @@ | |||
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-2005 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 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include <qfile.h> | 43 | #include <qfile.h> |
44 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
45 | #include <qwindowsystem_qws.h> | 45 | #include <qwindowsystem_qws.h> |
46 | 46 | ||
47 | /* OPIE */ | 47 | /* OPIE */ |
48 | #include <qpe/config.h> | 48 | #include <qpe/config.h> |
49 | #include <qpe/sound.h> | 49 | #include <qpe/sound.h> |
50 | #include <qpe/qcopenvelope_qws.h> | 50 | #include <qpe/qcopenvelope_qws.h> |
51 | #include <qpe/sound.h> | 51 | #include <qpe/sound.h> |
52 | 52 | ||
53 | #include <opie2/okeyfilter.h> | 53 | #include <opie2/okeyfilter.h> |
54 | #include <opie2/oresource.h> | 54 | #include <opie2/oresource.h> |
55 | 55 | ||
56 | /* STD */ | 56 | /* STD */ |
57 | #include <fcntl.h> | 57 | #include <fcntl.h> |
58 | #include <math.h> | 58 | #include <math.h> |
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <signal.h> | 60 | #include <signal.h> |
61 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> |
62 | #include <sys/time.h> | 62 | #include <sys/time.h> |
63 | #include <unistd.h> | 63 | #include <unistd.h> |
64 | #ifndef QT_NO_SOUND | 64 | #ifndef QT_NO_SOUND |
65 | #include <linux/soundcard.h> | 65 | #include <linux/soundcard.h> |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | namespace Opie { | 68 | namespace Opie { |
69 | namespace Core { | 69 | namespace Core { |
70 | 70 | ||
71 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 71 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
72 | 72 | ||
73 | 73 | ||
74 | /* STATIC and common implementation */ | 74 | /* STATIC and common implementation */ |
75 | /* EXPORT */ ODistribution distributions[] = { | 75 | /* EXPORT */ ODistribution distributions[] = { |
76 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 76 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
77 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | 77 | { System_OpenZaurus, "OpenZaurus", "/etc/openzaurus-version" }, |
78 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 78 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
79 | { System_Unknown, "Linux", "/etc/issue" }, | 79 | { System_Unknown, "Linux", "/etc/issue" }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | 82 | ||
83 | /* EXPORT */ bool isQWS(){ | 83 | /* EXPORT */ bool isQWS(){ |
84 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 84 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
85 | } | 85 | } |
86 | 86 | ||
87 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 87 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
88 | if ( str && !::strchr ( str, '/' )) | 88 | if ( str && !::strchr ( str, '/' )) |
89 | return QCString ( "QPE/Application/" ) + str; | 89 | return QCString ( "QPE/Application/" ) + str; |
90 | else | 90 | else |
91 | return str; | 91 | return str; |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | /* Now the default implementation of ODevice */ | 96 | /* Now the default implementation of ODevice */ |
97 | 97 | ||
98 | struct default_button default_buttons [] = { | 98 | struct default_button default_buttons [] = { |
99 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 99 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
100 | "devicebuttons/z_calendar", | 100 | "devicebuttons/z_calendar", |
101 | "datebook", "nextView()", | 101 | "datebook", "nextView()", |
102 | "today", "raise()" }, | 102 | "today", "raise()" }, |
103 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 103 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
104 | "devicebuttons/z_contact", | 104 | "devicebuttons/z_contact", |
105 | "addressbook", "raise()", | 105 | "addressbook", "raise()", |
106 | "addressbook", "beamBusinessCard()" }, | 106 | "addressbook", "beamBusinessCard()" }, |
107 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 107 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
108 | "devicebuttons/z_home", | 108 | "devicebuttons/z_home", |
109 | "QPE/Launcher", "home()", | 109 | "QPE/Launcher", "home()", |
110 | "buttonsettings", "raise()" }, | 110 | "buttonsettings", "raise()" }, |
111 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 111 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
112 | "devicebuttons/z_menu", | 112 | "devicebuttons/z_menu", |
113 | "QPE/TaskBar", "toggleMenu()", | 113 | "QPE/TaskBar", "toggleMenu()", |
114 | "QPE/TaskBar", "toggleStartMenu()" }, | 114 | "QPE/TaskBar", "toggleStartMenu()" }, |
115 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 115 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
116 | "devicebuttons/z_mail", | 116 | "devicebuttons/z_mail", |
117 | "opiemail", "raise()", | 117 | "opiemail", "raise()", |
118 | "opiemail", "newMail()" }, | 118 | "opiemail", "newMail()" }, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | ODevice *ODevice::inst() | 121 | ODevice *ODevice::inst() |
122 | { | 122 | { |
123 | static ODevice *dev = 0; | 123 | static ODevice *dev = 0; |
124 | QString cpu_info; | 124 | QString cpu_info; |
125 | 125 | ||
126 | if ( !dev ) | 126 | if ( !dev ) |
127 | { | 127 | { |
128 | QFile f( PATH_PROC_CPUINFO ); | 128 | QFile f( PATH_PROC_CPUINFO ); |
129 | if ( f.open( IO_ReadOnly ) ) | 129 | if ( f.open( IO_ReadOnly ) ) |
130 | { | 130 | { |
131 | QTextStream s( &f ); | 131 | QTextStream s( &f ); |
132 | while ( !s.atEnd() ) | 132 | while ( !s.atEnd() ) |
133 | { | 133 | { |
134 | QString line; | 134 | QString line; |
135 | line = s.readLine(); | 135 | line = s.readLine(); |
136 | if ( line.startsWith( "Hardware" ) ) | 136 | if ( line.startsWith( "Hardware" ) ) |
137 | { | 137 | { |
138 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 138 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
139 | cpu_info = line; | 139 | cpu_info = line; |
140 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); | 140 | if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); |
141 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); | 141 | else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); |
142 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); | 142 | else if ( line.contains( "mypal", false ) ) dev = new Internal::MyPal(); |
143 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); | 143 | else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); |
144 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); | 144 | else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); |
145 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); | 145 | else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); |
146 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); | 146 | else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); |
147 | else qWarning( "ODevice() - unknown hardware - using default." ); | 147 | else qWarning( "ODevice() - unknown hardware - using default." ); |
148 | break; | 148 | break; |
149 | } else if ( line.startsWith( "vendor_id" ) ) { | 149 | } else if ( line.startsWith( "vendor_id" ) ) { |
150 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 150 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
151 | cpu_info = line; | 151 | cpu_info = line; |
152 | if( line.contains( "genuineintel", false ) ) { | 152 | if( line.contains( "genuineintel", false ) ) { |
153 | dev = new Internal::GenuineIntel(); | 153 | dev = new Internal::GenuineIntel(); |
154 | break; | 154 | break; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | } | 158 | } |
159 | else | 159 | else |
160 | { | 160 | { |
161 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); | 161 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); |
162 | } | 162 | } |
163 | if ( !dev ) dev = new ODevice(); | 163 | if ( !dev ) dev = new ODevice(); |
164 | dev->init(cpu_info); | 164 | dev->init(cpu_info); |
165 | } | 165 | } |
166 | return dev; | 166 | return dev; |
167 | } | 167 | } |
168 | 168 | ||
169 | ODevice::ODevice() | 169 | ODevice::ODevice() |
170 | { | 170 | { |
171 | d = new ODeviceData; | 171 | d = new ODeviceData; |
172 | 172 | ||
173 | d->m_modelstr = "Unknown"; | 173 | d->m_modelstr = "Unknown"; |