author | mickeyl <mickeyl> | 2004-06-12 16:54:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-06-12 16:54:50 (UTC) |
commit | b1235df3628d178891eeefed630a22da46b25952 (patch) (side-by-side diff) | |
tree | c88a3cb04adcc9fe214ff08e3c0b96b21e3c4f0a | |
parent | 7a62e8e3601ee98f5f06261c361fe8132334cd56 (diff) | |
download | opie-b1235df3628d178891eeefed630a22da46b25952.zip opie-b1235df3628d178891eeefed630a22da46b25952.tar.gz opie-b1235df3628d178891eeefed630a22da46b25952.tar.bz2 |
- refactor the distribution detection code
- add detection of OpenEmbedded and generic linux distributions
- simplify the zaurus model detection code
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 65 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 64 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 25 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 19 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 65 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.cpp | 11 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 69 |
8 files changed, 141 insertions, 189 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index cef7f63..5b73e59 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -1,36 +1,36 @@ /* - This file is part of the Opie Project - Copyright (C) The Opie Team <opie-devel@handhelds.org> + This file is part of the Opie Project + Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. - .>+-= -_;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software -- . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. -: = ...= . :.=- --. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "odevice_ipaq.h" #include "odevice_jornada.h" #include "odevice_ramses.h" #include "odevice_simpad.h" #include "odevice_yopy.h" #include "odevice_zaurus.h" @@ -134,27 +134,48 @@ ODevice::ODevice() d->m_model = Model_Unknown; d->m_vendorstr = "Unknown"; d->m_vendor = Vendor_Unknown; d->m_systemstr = "Unknown"; d->m_system = System_Unknown; d->m_sysverstr = "0.0"; d->m_rotation = Rot0; d->m_direction = CW; d->m_holdtime = 1000; // 1000ms d->m_buttons = 0; d->m_cpu_frequencies = new QStrList; + + // New distribution detection code first checks for legacy distributions, + // identified by /etc/familiar-version or /etc/oz_version. + // Then check for OpenEmbedded and lastly, read /etc/issue + + for ( unsigned int i = 0; i < sizeof distributions; ++i ) + { + if ( QFile::exists( distributions[i].sysvfile ) ) + { + d->m_systemstr = distributions[i].sysstr; + d->m_system = distributions[i].system; + d->m_sysverstr = "<Unknown>"; + QFile f( distributions[i].sysvfile ); + if ( f.open( IO_ReadOnly ) ) + { + QTextStream ts( &f ); + d->m_sysverstr = ts.readLine(); + } + break; + } + } } -void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) +void ODevice::systemMessage( const QCString &msg, const QByteArray & ) { if ( msg == "deviceButtonMappingChanged()" ) { reloadButtonMapping(); } } void ODevice::init(const QString&) { } /** * This method initialises the button mapping diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index aaebde3..474d792 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -1,36 +1,36 @@ /* - This file is part of the Opie Project - Copyright (C) The Opie Team <opie-devel@handhelds.org> + This file is part of the Opie Project + Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. - .>+-= -_;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software -- . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. -: = ...= . :.=- --. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ODEVICE_H_ #define ODEVICE_H_ /* OPIE */ #include <opie2/odevicebutton.h> #include <qpe/qpeapplication.h> /* for Transformation enum.. */ @@ -85,49 +85,71 @@ enum OModel { Model_Ramses = ( 4 << 24 ), Model_Ramses_All = ( Model_Ramses | 0xffffff ), Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), Model_Yopy = ( 5 << 24 ), Model_Yopy_All = ( Model_Yopy | 0xffffff ), Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), + Model_Beagle = ( 6 << 24 ), + + Model_Beagle_All = ( Model_Beagle | 0xffffff ), + Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), + }; /** * The vendor of the device */ enum OVendor { Vendor_Unknown, Vendor_HP, Vendor_Sharp, Vendor_SIEMENS, Vendor_MundN, Vendor_GMate, + Vendor_MasterIA, }; /** * The System used */ enum OSystem { System_Unknown, System_Familiar, System_Zaurus, System_OpenZaurus, System_Linupy, + System_OpenEmbedded, +}; + +typedef struct { + OSystem system; + char* sysstr; + char* sysvfile; +} ODistribution; + +static ODistribution distributions[] = +{ + { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, + { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, + { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, + { System_Unknown, "Linux", "/etc/issue" }, + }; enum OLedState { Led_Off, Led_On, Led_BlinkSlow, Led_BlinkFast }; enum OLed { Led_Mail, Led_Power, diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index efe35e7..16c0538 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp @@ -129,67 +129,42 @@ void iPAQ::init(const QString& model) d->m_model = Model_iPAQ_H37xx; else if ( d->m_modelstr == "H3800" ) d->m_model = Model_iPAQ_H38xx; else if ( d->m_modelstr == "H3900" ) d->m_model = Model_iPAQ_H39xx; else if ( d->m_modelstr == "H5400" ) d->m_model = Model_iPAQ_H5xxx; else if ( d->m_modelstr == "H2200" ) d->m_model = Model_iPAQ_H22xx; else d->m_model = Model_Unknown; - - switch ( d->m_model ) { case Model_iPAQ_H31xx: case Model_iPAQ_H38xx: d->m_rotation = Rot90; break; case Model_iPAQ_H5xxx: case Model_iPAQ_H22xx: d->m_rotation = Rot0; break; case Model_iPAQ_H36xx: case Model_iPAQ_H37xx: case Model_iPAQ_H39xx: default: d->m_rotation = Rot270; break; } - QFile f( "/etc/familiar-version" ); - if ( f. open ( IO_ReadOnly )) { - d->m_systemstr = "Familiar"; - d->m_system = System_Familiar; - - QTextStream ts ( &f ); - d->m_sysverstr = ts. readLine(). mid ( 10 ); - - f. close(); - } else { - f. setName ( "/etc/oz_version" ); - - if ( f. open ( IO_ReadOnly )) { - d->m_systemstr = "OpenEmbedded/iPaq"; - d->m_system = System_Familiar; - - QTextStream ts ( &f ); - ts.setDevice ( &f ); - d->m_sysverstr = ts. readLine(); - f. close(); - } - } - m_leds [0] = m_leds [1] = Led_Off; m_power_timer = 0; } void iPAQ::initButtons() { if ( d->m_buttons ) return; if ( isQWS( ) ) diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 1f69326..5d32901 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp @@ -105,37 +105,26 @@ struct j_button jornada56x_buttons [] = { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), "devicebuttons/jornada56x_record", "QPE/VMemo", "toggleRecord()", "sound", "raise()" }, }; void Jornada::init(const QString&) { d->m_vendorstr = "HP"; d->m_vendor = Vendor_HP; d->m_modelstr = "Jornada 56x"; d->m_model = Model_Jornada_56x; - d->m_systemstr = "Familiar"; - d->m_system = System_Familiar; d->m_rotation = Rot0; - - QFile f ( "/etc/familiar-version" ); - f.setName ( "/etc/familiar-version" ); - if ( f.open ( IO_ReadOnly )) { - - QTextStream ts ( &f ); - d->m_sysverstr = ts.readLine().mid( 10 ); - - f. close(); - } + //Distribution detecting code is now in base class } void Jornada::initButtons() { if ( d->m_buttons ) return; d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { j_button *ib = jornada56x_buttons + i; ODeviceButton b; @@ -169,27 +158,27 @@ bool Jornada::setDisplayBrightness( int bright ) if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; QString cmdline; int value = 255 - bright; if ( !bright ) cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); else cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); - + res = ( ::system( (const char*) cmdline ) == 0 ); - + return res; } bool Jornada::suspend( ) { qDebug("ODevice::suspend"); if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices return false; @@ -200,20 +189,20 @@ bool Jornada::suspend( ) struct timeval tvs; ::gettimeofday ( &tvs, 0 ); ::sync(); // flush fs caches res = ( ::system ( "apm --suspend" ) == 0 ); return res; } bool Jornada::setDisplayStatus ( bool on ) { bool res = false; - + QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "0" : "4", on? "0" : "4" ); res = ( ::system( (const char*) cmdline ) == 0 ); return res; } diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp index 32467f1..7db2af1 100644 --- a/libopie2/opiecore/device/odevice_ramses.cpp +++ b/libopie2/opiecore/device/odevice_ramses.cpp @@ -73,35 +73,25 @@ void Ramses::init(const QString&) { d->m_vendorstr = "M und N"; d->m_vendor = Vendor_MundN; QFile f("/proc/sys/board/ramses"); d->m_modelstr = "Ramses"; d->m_model = Model_Ramses_MNCI; d->m_rotation = Rot0; d->m_holdtime = 1000; - f.setName("/etc/oz_version"); - - if (f.open(IO_ReadOnly)) { - d->m_systemstr = "OpenEmbedded/Ramses"; - d->m_system = System_OpenZaurus; - - QTextStream ts(&f); - ts.setDevice(&f); - d->m_sysverstr = ts.readLine(); - f.close(); - } + // Distribution detection code now in the base class m_power_timer = 0; #ifdef QT_QWS_ALLOW_OVERCLOCK #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** #define OC(x...) x #else #define OC(x...) #endif // This table is true for a Intel XScale PXA 255 diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 6630763..6d4624b 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp @@ -1,36 +1,36 @@ /* - This file is part of the Opie Project - Copyright (C) The Opie Team <opie-devel@handhelds.org> + This file is part of the Opie Project + Copyright (C) The Opie Team <opie-devel@handhelds.org> =. .=l. - .>+-= -_;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software -- . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. -: = ...= . :.=- --. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "odevice_simpad.h" /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> @@ -125,46 +125,25 @@ void SIMpad::init(const QString&) d->m_modelstr = "SL4"; d->m_model = Model_SIMpad_SL4; switch ( d->m_model ) { default: d->m_rotation = Rot0; d->m_direction = CCW; d->m_holdtime = 1000; // 1000ms break; } - f. setName ( "/etc/familiar-version" ); - if ( f. open ( IO_ReadOnly )) { - d->m_systemstr = "Familiar"; - d->m_system = System_Familiar; - - QTextStream ts ( &f ); - d->m_sysverstr = ts. readLine(). mid ( 10 ); - - f. close(); - } else { - f. setName ( "/etc/oz_version" ); - - if ( f. open ( IO_ReadOnly )) { - d->m_systemstr = "OpenEmbedded/SIMpad"; - d->m_system = System_OpenZaurus; - - QTextStream ts ( &f ); - ts.setDevice ( &f ); - d->m_sysverstr = ts. readLine(); - f. close(); - } - } + //Distribution detecting code is now in base class m_leds [0] = m_leds [1] = Led_Off; m_power_timer = 0; } void SIMpad::initButtons() { if ( d->m_buttons ) return; diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index 493ed25..223aa76 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp @@ -69,36 +69,27 @@ struct yopy_button yopy_buttons [] = { "devicebuttons/yopy_end", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, }; void Yopy::init(const QString&) { d->m_vendorstr = "G.Mate"; d->m_vendor = Vendor_GMate; d->m_modelstr = "Yopy3700"; d->m_model = Model_Yopy_3700; d->m_rotation = Rot0; - d->m_systemstr = "Linupy"; d->m_system = System_Linupy; - - QFile f ( "/etc/issue" ); - if ( f. open ( IO_ReadOnly ) ) - { - QTextStream ts ( &f ); - ts.readLine(); - d->m_sysverstr = ts. readLine(); - f. close(); - } + // Distribution detection code now in the base class } void Yopy::initButtons() { if ( d->m_buttons ) return ; d->m_buttons = new QValueList <ODeviceButton>; for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) { diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index e8b813e..6ac3157 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -106,105 +106,90 @@ struct z_button z_buttons_c700 [] = { // class up into individual classes. We need three classes // // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860) // // Only question right now is: Do we really need to do it? Because as soon // as the OpenZaurus kernel is ready, there will be a unified interface for all // Zaurus models (concerning apm, backlight, buttons, etc.) // // Comments? - mickeyl. -void Zaurus::init(const QString&) +void Zaurus::init(const QString& cpu_info) { - d->m_vendorstr = "Sharp"; - d->m_vendor = Vendor_Sharp; - m_embedix = true; // Not openzaurus means: It has an embedix kernel ! - - // QFile f ( "/proc/filesystems" ); - QString model; - - // It isn't a good idea to check the system configuration to - // detect the distribution ! - // Otherwise it may happen that any other distribution is detected as openzaurus, just - // because it uses a jffs2 filesystem.. - // (eilers) - // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read(). find ( "\tjffs2\n" ) >= 0 )) { - QFile f ("/etc/oz_version"); - if ( f.exists() ){ + // generic distribution code already scanned /etc/issue at that point - + // embedix releases contain "Embedix <version> | Linux for Embedded Devices" + if ( d->m_sysverstr.contains( "embedix", false ) ) + { + d->m_vendorstr = "Sharp"; + d->m_vendor = Vendor_Sharp; + d->m_systemstr = "Zaurus"; + d->m_system = System_Zaurus; + m_embedix = true; + } + else + { d->m_vendorstr = "OpenZaurus Team"; d->m_systemstr = "OpenZaurus"; d->m_system = System_OpenZaurus; + // sysver already gathered - if ( f. open ( IO_ReadOnly )) { - QTextStream ts ( &f ); - d->m_sysverstr = ts. readLine();//. mid ( 10 ); - f. close(); - } - - // Openzaurus sometimes uses the embedix kernel! - // => Check whether this is an embedix kernel + // Openzaurus sometimes uses the embedix kernel, check if this is one FILE *uname = popen("uname -r", "r"); + QFile f; QString line; if ( f.open(IO_ReadOnly, uname) ) { QTextStream ts ( &f ); line = ts. readLine(); int loc = line. find ( "embedix" ); if ( loc != -1 ) m_embedix = true; else m_embedix = false; - f. close(); + f.close(); } pclose(uname); } - else { - d->m_systemstr = "Zaurus"; - d->m_system = System_Zaurus; - } - f. setName ( "/proc/cpuinfo" ); - if ( f. open ( IO_ReadOnly ) ) { - QTextStream ts ( &f ); - QString line; - while( line = ts. readLine() ) { - if ( line. left ( 8 ) == "Hardware" ) - break; - } - int loc = line. find ( ":" ); - if ( loc != -1 ) - model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); - } + // check the Zaurus model + QString model; + int loc = cpu_info.find( ":" ); + if ( loc != -1 ) + model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); + else + model = cpu_info; if ( model == "SHARP Corgi" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C700"; } else if ( model == "SHARP Shepherd" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C750"; } else if ( model == "SHARP Husky" ) { d->m_model = Model_Zaurus_SLC7x0; d->m_modelstr = "Zaurus SL-C760"; } else if ( model == "SHARP Poodle" ) { d->m_model = Model_Zaurus_SLB600; d->m_modelstr = "Zaurus SL-B500 or SL-5600"; } else if ( model == "Sharp-Collie" || model == "Collie" ) { d->m_model = Model_Zaurus_SL5500; d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; } else { d->m_model = Model_Zaurus_SL5500; - d->m_modelstr = "Zaurus (Model unknown)"; + d->m_modelstr = "Unkown Zaurus"; } + // set initial rotation + bool flipstate = false; switch ( d->m_model ) { case Model_Zaurus_SLA300: d->m_rotation = Rot0; break; case Model_Zaurus_SLC7x0: d->m_rotation = rotation(); d->m_direction = direction(); break; case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: |