summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 39b37cd..a824392 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -13,48 +13,49 @@
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#include "odevice_beagle.h" 30#include "odevice_beagle.h"
31#include "odevice_ipaq.h" 31#include "odevice_ipaq.h"
32#include "odevice_jornada.h" 32#include "odevice_jornada.h"
33#include "odevice_ramses.h" 33#include "odevice_ramses.h"
34#include "odevice_simpad.h" 34#include "odevice_simpad.h"
35#include "odevice_yopy.h" 35#include "odevice_yopy.h"
36#include "odevice_zaurus.h" 36#include "odevice_zaurus.h"
37#include "odevice_genuineintel.h"
37 38
38/* QT */ 39/* QT */
39#include <qapplication.h> 40#include <qapplication.h>
40#include <qfile.h> 41#include <qfile.h>
41#include <qtextstream.h> 42#include <qtextstream.h>
42#include <qwindowsystem_qws.h> 43#include <qwindowsystem_qws.h>
43 44
44/* OPIE */ 45/* OPIE */
45#include <qpe/config.h> 46#include <qpe/config.h>
46#include <qpe/resource.h> 47#include <qpe/resource.h>
47#include <qpe/sound.h> 48#include <qpe/sound.h>
48#include <qpe/qcopenvelope_qws.h> 49#include <qpe/qcopenvelope_qws.h>
49#include <qpe/sound.h> 50#include <qpe/sound.h>
50#include <opie2/okeyfilter.h> 51#include <opie2/okeyfilter.h>
51 52
52/* STD */ 53/* STD */
53#include <fcntl.h> 54#include <fcntl.h>
54#include <math.h> 55#include <math.h>
55#include <stdlib.h> 56#include <stdlib.h>
56#include <signal.h> 57#include <signal.h>
57#include <sys/ioctl.h> 58#include <sys/ioctl.h>
58#include <sys/time.h> 59#include <sys/time.h>
59#include <unistd.h> 60#include <unistd.h>
60#ifndef QT_NO_SOUND 61#ifndef QT_NO_SOUND
@@ -122,48 +123,55 @@ ODevice *ODevice::inst()
122 QString cpu_info; 123 QString cpu_info;
123 124
124 if ( !dev ) 125 if ( !dev )
125 { 126 {
126 QFile f( PATH_PROC_CPUINFO ); 127 QFile f( PATH_PROC_CPUINFO );
127 if ( f.open( IO_ReadOnly ) ) 128 if ( f.open( IO_ReadOnly ) )
128 { 129 {
129 QTextStream s( &f ); 130 QTextStream s( &f );
130 while ( !s.atEnd() ) 131 while ( !s.atEnd() )
131 { 132 {
132 QString line; 133 QString line;
133 line = s.readLine(); 134 line = s.readLine();
134 if ( line.startsWith( "Hardware" ) ) 135 if ( line.startsWith( "Hardware" ) )
135 { 136 {
136 qDebug( "ODevice() - found '%s'", (const char*) line ); 137 qDebug( "ODevice() - found '%s'", (const char*) line );
137 cpu_info = line; 138 cpu_info = line;
138 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); 139 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
139 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); 140 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
140 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); 141 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
141 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); 142 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
142 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); 143 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
143 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); 144 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle();
144 else qWarning( "ODevice() - unknown hardware - using default." ); 145 else qWarning( "ODevice() - unknown hardware - using default." );
145 break; 146 break;
147 } else if ( line.startsWith( "vendor_id" ) ) {
148 qDebug( "ODevice() - found '%s'", (const char*) line );
149 cpu_info = line;
150 if( line.contains( "genuineintel", false ) ) {
151 dev = new Internal::GenuineIntel();
152 break;
153 }
146 } 154 }
147 } 155 }
148 } 156 }
149 else 157 else
150 { 158 {
151 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); 159 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO );
152 } 160 }
153 if ( !dev ) dev = new ODevice(); 161 if ( !dev ) dev = new ODevice();
154 dev->init(cpu_info); 162 dev->init(cpu_info);
155 } 163 }
156 return dev; 164 return dev;
157} 165}
158 166
159ODevice::ODevice() 167ODevice::ODevice()
160{ 168{
161 d = new ODeviceData; 169 d = new ODeviceData;
162 170
163 d->m_modelstr = "Unknown"; 171 d->m_modelstr = "Unknown";
164 d->m_model = Model_Unknown; 172 d->m_model = Model_Unknown;
165 d->m_vendorstr = "Unknown"; 173 d->m_vendorstr = "Unknown";
166 d->m_vendor = Vendor_Unknown; 174 d->m_vendor = Vendor_Unknown;
167 d->m_systemstr = "Unknown"; 175 d->m_systemstr = "Unknown";
168 d->m_system = System_Unknown; 176 d->m_system = System_Unknown;
169 d->m_sysverstr = "0.0"; 177 d->m_sysverstr = "0.0";